Page 1 of 1

Client Disconnect command line on Windows

Posted: Mon Jul 08, 2013 6:23 pm
by patic
I have a problem to find a command line to disconnect et close application.

System : windows server 2008 r2 64
openvpn client version : 2.3.1 x86_64-w64-mingw32

my file .ovpn :
==============================
tls-client
client
dev tun
proto udp
tun-mtu 1400
remote **ip** **port**
pkcs12 **file**.p12
cipher BF-CBC
verb 3
ns-cert-type server
script-security 3
askpass password.txt
==============================

First I connect with this command line :
"C:\Program Files\OpenVPN\bin\openvpn-gui.exe" --connect **config**.ovpn

It's ok and I don't need to write the password. Just I have a problem with UAC again but I'll check this later.
The file "password.txt" is the same directory than the .ovpn et have just one line with the password.
I would pass the password in the command line but I have not been able.

I need to connect then disconnect automatic the night with a ETL (Microsoft SSIS) so I need a command line.

So now I need the command line for disconnect then close, but impossible to find.

Here we talk about a signal SIGTERM and command exit or quit but I'm not able to use them : http://openvpn.net/index.php/open-sourc ... ml#control

I have read too the pages below but no solution is ok
http://openvpn.net/index.php/open-sourc ... rface.html
https://community.openvpn.net/openvpn/w ... n23ManPage

I don't understand, sometimes I can use just "openvpn --version" for example et to connect I have to use "openvpn-gui.exe --connect ..." In my case, I don't need gui.

Many people have these problems but there is no solution on the post.

So, if someone knows how to do, thanks a lot.

p.s : sorry for my traduction if there is mistakes

Re: Client Disconnect command line on Windows

Posted: Tue Jul 09, 2013 2:19 pm
by patic
So, after many hours, I have a begin of solution for my problem.

First, I connect with the follow synthax :
"C:\Program Files\OpenVPN\bin\openvpn.exe" --config "C:\Program Files\OpenVPN\config\**config**.ovpn" --pkcs12 "C:\Program Files\OpenVPN\config\**cerificat**.p12" --management 127.0.0.1 23000 --script-security 3 --askpass "C:\Program Files\OpenVPN\config\password.txt"

I don't use the GUI, because with the GUI I can't use the management with telnet, I don't know why ...

Then, in a terminal with command line (cmd) :
telnet
o 127.0.0.1 23000
signal SIGTERM (if I want to stop the connection)

Others commands are here : http://openvpn.net/index.php/open-sourc ... rface.html

I have find a other solution with a other soft : openvpn-manager (https://github.com/jochenwierum/openvpn-manager/wiki), but I prefer the first solution.

So, now I have try to use all that with Microsoft SSIS et resolve the problem of UAC in Windows ...

Re: Client Disconnect command line on Windows

Posted: Tue Jul 09, 2013 2:24 pm
by patic
For admin, sorry but I don't find where is the function to close the topic