Page 1 of 1

Empty environment variables on (dis)connect scripts

Posted: Mon Feb 15, 2016 11:46 am
by netizen
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.

Re: Empty environment variables on (dis)connect scripts

Posted: Mon Feb 15, 2016 2:23 pm
by Traffic
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.

Re: Empty environment variables on (dis)connect scripts

Posted: Tue Feb 16, 2016 10:01 am
by netizen
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.

Re: Empty environment variables on (dis)connect scripts

Posted: Tue Feb 16, 2016 10:40 am
by Traffic
Thanks for letting us know 8-)