gladiatr72 wroteHey there,
I just ran a few tests on a utility vpn setup that utilizes some client-connect goodness for firewall manipulation. Are you sure your non-zero code is actually making it out? What happens when you preload your script's variables and run it from the shell? My test netted the following from the logs:
Thu Jan 6 11:43:02 2011 us=911918 stephen.spencer_util/10.10.2.2:49751 client-connect command failed: shell command exited with error status: 1
Thu Jan 6 11:43:04 2011 us=934373 stephen.spencer_util/10.10.2.2:49751 PUSH: Received control message: 'PUSH_REQUEST'
Thu Jan 6 11:43:04 2011 us=934470 stephen.spencer_util/10.10.2.2:49751 SENT CONTROL [stephen.spencer_util]: 'AUTH_FAILED' (status=1)
Thu Jan 6 11:43:04 2011 us=934484 stephen.spencer_util/10.10.2.2:49751 Delayed exit in 5 seconds
Thu Jan 6 11:43:07 2011 us=47099 read UDPv4 [ECONNREFUSED]: Connection refused (code=111)
This was just a few little bash bits to do an 'exit 1' when the identifying bits of the CN on my phone's certificate shows up.
So, anyway, the hook does work as documented.
-S
Hi again,
Firstable i want to know that in my case, i don't use bash script, but external program ("/usr/bin/php phpscript"). I'm not sure if that matters, but in my logs there is a message "external program exited", not an "shell script exited".
So, i'm gonna be more precise in my examples, here are the logs from the client/server:
Server Logs:
Thu Jan 6 20:08:56 2011 us=687123 test-user/my.test.ip.addr:33545 client-connect command failed: external program exited with error status: 1
RThu Jan 6 20:08:59 2011 us=41041 test-user/my.test.ip.addr:33545 PUSH: Received control message: 'PUSH_REQUEST'
WRThu Jan 6 20:09:04 2011 us=282193 test-user/my.test.ip.addr:33545 PUSH: Received control message: 'PUSH_REQUEST'
WRThu Jan 6 20:09:09 2011 us=523075 test-user/my.test.ip.addr:33545 PUSH: Received control message: 'PUSH_REQUEST'
....
....
As you see below, the exit code is identified as "1".
Client Logs:
Thu Jan 6 20:08:58 2011 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)
Thu Jan 6 20:09:04 2011 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)
Thu Jan 6 20:09:09 2011 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)
Thu Jan 6 20:09:14 2011 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)
Thu Jan 6 20:09:19 2011 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)
Thu Jan 6 20:09:24 2011 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)
Thu Jan 6 20:09:29 2011 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)
..... infinite.....
Here is a part of my server config:
dev tun
fast-io
client-cert-not-required
user vpn
group vpn
persist-tun
persist-key
server x.x.x.x 255.255.0.0
username-as-common-name
client-connect "/usr/local/bin/php My_script.php"
client-disconnect "/usr/local/bin/php My_script.php"
duplicate-cn
tmp-dir /tmp
client-config-dir ccd
script-security 2
keepalive 1 5
comp-lzo
tls-server
dh ssl/dh1024.pem
cert ssl/server.crt
key ssl/server.key
ca ssl/ca.crt
plugin /etc/openvpn/mysql-auth/libopenvpn-mysql-auth.so -c /etc/openvpn/mysql-auth.cnf -d
Regards