Empty environment variables on (dis)connect scripts

How to customize and extend your OpenVPN installation.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Post Reply
netizen
OpenVpn Newbie
Posts: 2
Joined: Mon Feb 15, 2016 10:24 am

Empty environment variables on (dis)connect scripts

Post by netizen » Mon Feb 15, 2016 11:46 am

Hi!

I run a bunch of openvpn servers from a gentoo fw, for a large amount of different configurations.
I also run a central syslog server.

I have this in each server config:

Code: Select all

script-security         3
client-connect          "/usr/local/bin/vpn ais CONNECT"
client-disconnect       "/usr/local/bin/vpn ais DISCONNECTED"
The /usr/local/bin/vpn script uses the binary "logger" to send custom syslog entries to central server:

Code: Select all

logger -n rex -P 999 -t VPNx[${1}${action}${action}] -- ${action}${rhostname} ${ifconfig_pool_remote_ip}" ("${trusted_ip}/${proto}")" ${signal} ${time_duration};;
And these are the entries I get on that one (edited public IP only):
20160215 114423 fw2 VPNx[ais--] 20º aisl.ais.vpn.region.ou 10.21.9.36 (1**.*0.4*.*9*/) 1797
20160215 114425 fw2 VPNx[ais++] 20º aisl.ais.vpn.region.ou 10.21.9.36 (1**.*0.4*.*9*/)
Nothing in $proto in both lines (first is a disconnect, last a connect), $signal also empty on disconnect.

Any hint as to why? man page doesn't seem very clear to me over if this is somehow scoped.

Many thanks.

User avatar
Traffic
OpenVPN Protagonist
Posts: 4066
Joined: Sat Aug 09, 2014 11:24 am

Re: Empty environment variables on (dis)connect scripts

Post by Traffic » Mon Feb 15, 2016 2:23 pm

netizen wrote:Any hint as to why? man page doesn't seem very clear to me
The man page is a little unclear and possibly out of date ..
netizen wrote:Nothing in $proto
--proto variable is scoped to $proto_1
netizen wrote:$signal also empty
I do not believe there is a $signal variable any longer.

I suggest you analyse your server environmental variables.

netizen
OpenVpn Newbie
Posts: 2
Joined: Mon Feb 15, 2016 10:24 am

Re: Empty environment variables on (dis)connect scripts

Post by netizen » Tue Feb 16, 2016 10:01 am

Traffic wrote:The man page is a little unclear and possibly out of date ..
--proto variable is scoped to $proto_1
I do not believe there is a $signal variable any longer.
I suggest you analyse your server environmental variables.
Thank you! I've adapted the scripts to that info, and it's working now.

User avatar
Traffic
OpenVPN Protagonist
Posts: 4066
Joined: Sat Aug 09, 2014 11:24 am

Re: Empty environment variables on (dis)connect scripts

Post by Traffic » Tue Feb 16, 2016 10:40 am

Thanks for letting us know 8-)

Post Reply