What's new

Custom script for openVPN server - client connect event

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

Serra

Occasional Visitor
Hello, I would like to know if there is any way to have custom scripts run whenever an open VPN client connects to the open VPN server in router?

I have read the 'User scripts' page on wiki, also have done some basic searches on web but still cannot find a proper way to do so.

Is it possible to do?

Thank a lot.
 
Hello, I would like to know if there is any way to have custom scripts run whenever an open VPN client connects to the open VPN server in router?

I have read the 'User scripts' page on wiki, also have done some basic searches on web but still cannot find a proper way to do so.

Is it possible to do?

Here is an example...How to set a static IP to OpenVPN TUN clients
 

Thank you very much!

The key point is to use the 'client-connect <my script>' to register my script in the configuration.

May I ask one more question related to the Step 1 in the post:
Step 1. Simply enter two lines (into the VPN Server Custom Configuration) as shown below...clearly the comment line is optional! - and should be omitted if available NVRAM is low.

Does it mean to include the client-connect command in file openvpnserver1.postconf?
I don't use the custom CCD file for the openVPN server.
 
Last edited:
Thank you very much!

The key point is using the 'client-connect <my script>' to register my script in the configuration.

May I ask one more question related to the Step 1 in the post:


Does it mean to include the client-connect command in file openvpnserver1.postconf?
The GUI panel makes it easier to 'add' directives to the OpenVPN Server config, but clearly, if the firmware already includes the custom directive, then yes you would need to use the postconf script if you needed to override or delete it.

upload_2019-7-3_18-24-14.png
 
The GUI panel makes it easier to 'add' directives to the OpenVPN Server config, but clearly, if the firmware already includes the custom directive, then yes you would need to use the postconf script if you needed to override or delete it.

View attachment 18516

Got it. Thanks so much for the prompt and helpful replies. :)
 
I don't think you need the leading "--" in the custom config box; you need it in a .ovpn file though.
 

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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