What's new

VPN Director API or script

  • 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!

JVC

New Around Here
Is there a programmatic method (terminal) for changing the VPN Director configuration? For instance, changing a specific Local IP (Device) to use a specific Interface (WAN, OVPNx)?

Ultimately, what I would like to do is wrap these scripts into a RESTful interface that I can integrate with home automation. i.e. have a button that has an AppleTV on WAN or various OPVN connections.
 
You'd have to do it through an SSH terminal session by modifying the /jffs/openvpn/vpndirector_rulelist file and restarting the VPN services.

The firmware doesn't have a RESTful interface.
 
Last edited:
@ColinTaylor can you please advise where I can find more info on vpndirector_rulelist file?
Create a VPN Director rule or 2, look at the syntax in the policy file it creates where @ColinTaylor. Once you have that you can build a script around inserting or deleting those rules using the syntax.
 
@ColinTaylor can you please advise where I can find more info on vpndirector_rulelist file?
I don't believe it's documented anywhere, you'd have to look at the source code.

But as the previous post said, if you experiment with some rules it should be fairly obvious.
@Ranger802004 what I'm interested in is if I can add more than one network in the "Remote IP" field with a comma... or semicolon?
No, I don't believe so. You'd have to make multiple rules.
 
Last edited:
@Ranger802004 what I'm interested in is if I can add more than one network in the "Remote IP" field with a comma... or semicolon?
Negative, you'd have to make multiple rules for difference Destination Subnets, what are you trying to do exactly?
 
If it's any help, my killswitch script at least reads the VPN Director rules (but doesn't update them). That portion of the script might be useful as a starting point for both operations.

 
I almost have it working. Does anyone know the service command for restarting the routing/vpn?

(or how to apply the updated rules - including Wireguard)
 
Last edited:
I almost have it working. Does anyone know the service command for restarting the routing/vpn?

(or how to apply the updated rules - including Wireguard)
To restart VPN Client #1:
Code:
service restart_vpnclient1
 
Yes that's for OpenVPN (which is what you asked for in your original post). I don't know anything about WireGuard as I don't use it.
 
Try to restart vpndirector.
service restart_vpnrouting0
 
You could also try these, but it's just a guess:
Code:
service restart_wgc1
service restart_wgcall
 

Similar threads

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