[OpenVPN home] [Date Prev] [Date Index] [Date Next]
[OpenVPN mailing lists] [Thread Prev] [Thread Index] [Thread Next]
Google
 
Web openvpn.net

[Openvpn-users] Re: Management Interface problem


  • Subject: [Openvpn-users] Re: Management Interface problem
  • From: Charles Duffy <cduffy@xxxxxxxxxxx>
  • Date: Sun, 20 Mar 2005 22:32:23 -0600

On Sun, 20 Mar 2005 12:29:44 +0100, Claas Hilbrecht wrote:

> Both commands work more or less but sometimes OpenVPN doesn't return the 
> status information.

Mmm.

I ended up writing a slightly longer script that actually waits 'till it
sees the end of the status list before sending quit. I haven't seen it
fail yet (though, admittedly, my testing's rather limited -- I ended up
abandoning the approach that made it necessary).

This is, obviously, very very crude -- it was meant as a
proof-of-concept for my internal use only.

---
#!/bin/env python2.3

import sys
from socket import *

MGMT_PORT = 58792

s = socket(AF_INET, SOCK_STREAM)
s.connect(('127.0.0.1', MGMT_PORT))
f = s.makefile()
f.write('status 2\n')
f.flush()
while True:
        line = f.readline()
        if line[0] == '>':
                sys.stderr.write(line)
        else:
                sys.stdout.write(line)
                if line[:3] == 'END':
                        f.write('quit\n')
                        f.flush()
                        sys.exit(0)



____________________________________________
Openvpn-users mailing list
Openvpn-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/openvpn-users