I'm using the openvpn option client-connect to run a script when a client connects.
The script works fine when I use simple commands but when I add commands that need root privileges it doesn't work and clients can't connect to the VPN server.
For example here are some commands I try to execute:
bgpctl reload
and
route add -net $ifconfig_pool_remote_ip/30 -interface $dev -static
.
The commands are tested and work correctly. I'm using freeBSD.
Any idea how to fix the problem?
Thank you!
Update
Actually there was no privileges issue.
The script could not execute the commands bgpctl
and route
because it couldn't recognize them.
I could fix the problem by specifying the full path to the commands:
/usr/local/sbin/bgpctl reload
/sbin/route add -net $ifconfig_pool_remote_ip/30 -interface $dev -static
Now it works.
Thanks roaima.