What's new

Enable disable vpn from browser

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

carefulcomputer

New Around Here
I have setup ipsec vpn on my router and my laptop and it is working fine. Now I am trying to enable/disable VPN using based on some triggers from laptop.
I checked the http call made by web browser to server when I enable/disable the VPN (using chrome dev console). Looks like when clicking the 'apply' button it sends all vpn parameters and 'start/stop' command in POST payload.

Code:
productid: RT-AC5300
current_page: Advanced_VPN_IPSec.asp
next_page: Advanced_VPN_IPSec.asp
modified: 0
action_mode: apply
action_script: ipsec_stop
action_wait: 5
preferred_lang: EN
ipsec_server_enable: 0
ipsec_profile_1: 4>Host-to-Net>null>null>wan>>1>PSK>null>null>null>null>null>1>10.10.10>null>1>null>null>0>null>null>null>1>>>eap-md5>1>500>4500>10>1>null>null>null>null><<<<>1
ipsec_preshared_key: PSK
ipsec_clients_start: 10.10.10
ipsec_dns1:
ipsec_dns2:
ipsec_wins1:
ipsec_wins2:
ipsec_local_public_interface: wan
ipsec_dead_peer_detection: 1
ipsec_dpd: 10
ipsec_export_cert: 0
ipsec_client_list_username:
ipsec_client_list_password:
ipsec_client_list_ike: 3

to
Code:
http://RouterIP/start_apply.htm

Is there a way to only enable/disable VPN using HTTP call without sending all parameters (i.e. psk, user/pass etc ?).
 
I am answering my own question. Yes, you can. I found only some of parameters can be sent to turn on/off VPN. Above post was about IPSec vpn, but I found that to be unstable (causing router to reboot). So I switched to openVPN. Here are parameters for turning on openVPN , rest of parameters need not be sent.

'current_page': 'Advanced_VPN_OpenVPN.asp',
'next_page': 'Advanced_VPN_OpenVPN.asp',
'modified': 0,
'action_mode':'apply',
'action_wait':15,
'VPNServer_mode':'openvpn'
'action_script' : 'restart_chpass;restart_vpnserver1';
'VPNServer_enable' : 1;
'vpn_serverx_start' :'1,';
 
Why not use SSH?

OpenVPN server 1 (change the number for the second instance):
Code:
service stop_vpnserver1
service start_vpnserver1

PPTPD:
Code:
service stop_pptpd
service start_pptpd
 
that's a good point. My triggering client is javascript. For ssh I would have to shell out to console. Not a big deal, but HTTP is little more convenient.
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top