Page 1 of 1

Connect and Disconnect server from external aplication

Posted: Wed May 17, 2017 9:55 am
by rul3s
I'm writting an windows aplication that uses OpenVPN as a server.
At first I was doing all the actions manually via openvpn-gui, start, connect, disconnect and kill.
Nowadays I'm doing this by CMD doing a openvpn-gui --connect config.ovpn to automatice this action, but, I'm having problems when disconnecting and connecting againg.

My wish would be to connect and disconnect without seeing it, in background, and I don't understand how to do it. I've readed about the management interface that if you enable it you can send commands trought it via localhost in windows, but I don't find examples how to do it.
I'm developing my windows app in QT so I can run CMD commands and send TCP messages.

Can anyone give me some examples to do those actions?

1- Start openvpn daemon with management port enabled.
2- Send connect message trought management.
3- Send disconnect trought management.
4- Stop openvpn daemon.

I've tried the following, but with no results.
openvpn --dev tap0 --management localhost 7505
this seem to start daemon with management interface, so then, in another window:
openvpn --management-client localhost 7505 -> doenst work
telnet localhost 7505 -> neither

So how to do this?

Thanks for your help.

Re: Connect and Disconnect server from external aplication

Posted: Wed Jun 14, 2017 7:15 am
by rul3s
Nothing? Can't anybody give me a little advice or something?