|
From: Patrick L. <pa...@ne...> - 2005-02-15 14:30:27
|
The 3 quotation marks make is possible to expand a string over more lines=
.
I did that to make it more readeble to make sure my script is working.
*sigh* tried programming the whole script in PHP but the same happens the=
re.
Trying to bash-script the "/usr/bin/mysql" command now.
> I'm not familiar with the phyton script language, but have you noticed =
the
> three quotation marks in your c.execute in disconnect?
> Because in connect you only have one.
>
> c.execute("""INSERT INTO disconnect (tijd, common_name,
> remote_ip, pool_remote_ip, pool_netmask,
> local_port, remote_port, bytes_sent, bytes_received) VALUES (%s=
,
> %s, %s,
> %s, %s, %s, %s, %s, %s)"""
>
>
> -andy
>
> -----Original Message-----
> From: Patrick Lodder [mailto:pa...@ne...]
> Sent: Tuesday, February 15, 2005 7:45 AM
> To: ope...@li...
> Subject: [Openvpn-users] client-connect / client-disconnect
>
> Hi all,
>
> I'm tearing my hair out at this at the moment. I have set up a OpenVPN
> server to serve as a vpn-gateway to my network
> In the config i've defined a client-connect and a client-disconnect
> script.
> When a client connects the client-connect script is run. When that clie=
nt
> disconnects the client-disconnect script is run.
> The connect-script works al the time. But the disconnect-script only wo=
rks
> once since the openvpn service is started. After that the log says it
> failed exit status 1.
> But the weird thing is the scripts are almost the same. One puts a reco=
rd
> in the openvpn.connect table of a Mysql-database the other puts a recor=
d
> in the openvpn.disconnect table.
>
> Does any of you have the same problem. I tested with openvpn-2.0_rc6 an=
d
> openvpn-2.0_rc13.
>
> For your reference i'll put my config and scripts below:
>
> server config:
> ++++++++++++++++++++
> user openvpn
> group openvpn
> local 192.168.111.111
> port 1194
> proto udp
> dev tap0
> persist-tun
> keepalive 10 60
> comp-lzo
> management 127.0.0.1 1195 /etc/openvpn/management.passwd
> management-log-cache 1000
> mode server
> tls-server
> ifconfig-pool 192.168.111.112 192.168.111.140 255.255.255.0
> max-clients 20
> client-connect /etc/openvpn/connect
> client-disconnect /etc/openvpn/disconnect
> push "dhcp-option DOMAIN mydom.tld"
> push "dhcp-option DNS 192.168.111.100"
> push "dhcp-option WINS 192.168.111.110"
> push "route-gateway 192.168.111.101"
> ca /etc/openvpn/cacert.pem
> cert /etc/openvpn/OVPN-cert.pem
> key /etc/openvpn/OVPN.key
> crl-verify /etc/openvpn/crl.pem
> tls-auth /etc/openvpn/ta.key 0
> dh /etc/openvpn/dh1024.pem
> verb 4
> status /var/openvpn/openvpn.stat
> status-version 1
> daemon
> ++++++++++++++++++++
> connect:
> ++++++++++++++++++++
> #! /usr/bin/env python
> import MySQLdb,posix,time;
> now =3D time.time()
> time =3D int(now)
>
> # posix.environ['common_name']
> # posix.environ['trusted_ip']
> # posix.environ['ifconfig_pool_remote_ip']
> # posix.environ['ifconfig_pool_netmask']
> # posix.environ['local_port']
> # posix.environ['trusted_port']
>
> db=3DMySQLdb.connect(host=3D"localhost",
> user=3D"ovpn",
> passwd=3D"ovpnpasswd",
> db=3D"openvpn")
> c =3D db.cursor()
>
> c.execute("INSERT INTO connect (time, common_name, remote_ip,
> pool_remote_ip, pool_netmask, local_port, remote_port) VALUES (%s, %s, =
%s,
> %s, %s, %s,
> %s)",(tijd,posix.environ['common_name'],posix.environ['trusted_ip'],pos=
ix.environ['ifconfig_pool_remote_ip'],posix.environ['ifconfig_pool_netmas=
k'],posix.environ['local_port'],posix.environ['trusted_port']))
> ++++++++++++++++++++
> disconnect:
> ++++++++++++++++++++
> #! /usr/bin/env python
> import MySQLdb,posix,time;
> now =3D time.time()
> time =3D int(now)
>
> # posix.environ['common_name']
> # posix.environ['trusted_ip']
> # posix.environ['ifconfig_pool_remote_ip']
> # posix.environ['ifconfig_pool_netmask']
> # posix.environ['local_port']
> # posix.environ['trusted_port']
> # posix.environ['bytes_sent']
> # posix.environ['bytes_received']
>
> db=3DMySQLdb.connect(host=3D"localhost",
> user=3D"ovpn",
> passwd=3D"ovpnpasswd",
> db=3D"openvpn")
> c =3D db.cursor()
>
> c.execute("""INSERT INTO disconnect (tijd, common_name,
> remote_ip, pool_remote_ip, pool_netmask,
> local_port, remote_port, bytes_sent, bytes_received) VALUES (%s=
,
> %s, %s,
> %s, %s, %s, %s, %s, %s)""",(tijd,posix.environ['common_name'],
> posix.environ['trusted_ip'],posix.environ['ifconfig_pool_remote_ip'],
> posix.environ['ifconfig_pool_netmask'],
> posix.environ['local_port'],posix.environ['trusted_port'],
> posix.environ['bytes_sent'],posix.environ['bytes_received']))
> ++++++++++++++++++++
> A piece of log:
> ++++++++++++++++++++
> Feb 15 12:45:17 titan openvpn[10829]: John_Doe/111.133.111.117:1448
> [John_Doe] Inactivity timeout (--ping-restart), restarting
> Feb 15 12:45:17 titan openvpn[10829]: John_Doe/111.133.111.117:1448
> SIGUSR1[soft,ping-restart] received, client-instance restarting
> Feb 15 12:45:17 titan openvpn[10829]: client-disconnect command failed:
> shell command exited with error status: 1
> ++++++++++++++++++++
>
> I hope one of you can help me sort this out.
>
> Cheers,
>
> Patrick
>
>
>
>
>
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users=
.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_ide95&alloc_id=14396&op=3Dclick
> _______________________________________________
> Openvpn-users mailing list
> Ope...@li...
> https://lists.sourceforge.net/lists/listinfo/openvpn-users
>
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users=
.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=3D6595&alloc_id=3D14396&op=3Dclick
> _______________________________________________
> Openvpn-users mailing list
> Ope...@li...
> https://lists.sourceforge.net/lists/listinfo/openvpn-users
>
--=20
NedLinux.nl
|