I already have OpenVPN set to start automatically. That was easy enough, as there is a checkbox in settings, which automatically sets the OpenVPN service to automatic. I tried that out by restarting the desktop and it works.
I have several (4 at the moment) connection scripts. OpenVPN stores them nicely in the config folder. I can select "Connect" to the appropriate site and I get a connection. I set up silent. That works nicely too.
What I could not figure out how to do is that OpenVPN automatically connects to my sites, when I login to my computer.
I have my OVPN extension files stored nicely in my folder:
C:\Users\<user>\OpenVPN\config
I did research and came up with OpenVPN Server, but I am not interested in going the other way. I just want to automatically connect to the server, when I log into the computer.
OpenVPN Settings
OpenVPN About
OpenVPN Log On
My research turned up the following command, which I thought to schedule a minute or two after my computer starts.
openvpn-gui.exe --connect C:\Users\username\OpenVPN\config\ClientConnection1\clientconnection1.ovpn
I can discount the line above for two reasons.
I tried the command after OpenVPN was started and it did not work. Yes, I tried from an Administrative command window. I am not surprised as OpenVPN is already started. That gets me into point #2. (Yes, I realize that I can start OpenVPN manually and have Task Scheduler run the above command.)
I want to automatically connect on my desktop to 4 (could be any number) of sites automatically and the command line offers support for one.
How is that achieved?
Thoughts?
strong textUPDATE
Per the below comment, I copied my script files to the config-auto
folder as follows:
C:\Program Files\OpenVPN\config-auto
client-connect1 (a subdirectory)
README.txt
C:\Program Files\OpenVPN\config-auto\client-connect1
caConnection1.crt
clientConnection1.crt
clientConnection1.key
clientConnection1.ovpn
The contents of the script are:
client
dev tap
proto udp
dev-node NETGEAR-VPN
remote connection1.ddns.net 12974
resolv-retry infinite
nobind
key-direction 1
persist-key
persist-tun
ca caConnection1.crt
cert clientConnection1.crt
key clientConnection1.key
cipher AES-128-CBC
comp-lzo
verb 5
As stated, the script works when placed in either config
folder.
I restarted the computer (twice now) with the config files in the config-auto
folder as shown above, and nothingness, even after 5-minutes waiting.
I did see, thank you, this README.txt
file in the config-auto
directory substantiating the comment, just it does not work.
This directory or its subdirectories should contain OpenVPN
configuration files each having an extension of .ovpn
that should be automatically started at boot up.
When OpenVPNService is started, a separate OpenVPN
process will be instantiated for each configuration file.
OpenVPN GUI does not scan this directory.
UPDATE
I found the log file and here is the problem, so progress, just have to solve it now.
2021-04-10 18:26:50 WARNING: Compression for receiving enabled. Compression has been used in the past to break encryption. Sent packets are not compressed unless "allow-compression yes" is also set.
2021-04-10 18:26:50 us=900373 DEPRECATED OPTION: --cipher set to 'AES-128-CBC' but missing in --data-ciphers (AES-256-GCM:AES-128-GCM). Future OpenVPN version will ignore --cipher for cipher negotiations. Add 'AES-128-CBC' to --data-ciphers or change --cipher 'AES-128-CBC' to --data-ciphers-fallback 'AES-128-CBC' to silence this warning.
Options error: --ca fails with 'catheclient.crt': No such file or directory (errno=2)
Options error: --cert fails with 'clienttheclient.crt': No such file or directory (errno=2)
2021-04-10 18:26:50 us=900373 WARNING: cannot stat file 'clienttheclient.key': No such file or directory (errno=2)
Options error: --key fails with 'clienttheclient.key': No such file or directory (errno=2)
Options error: Please correct these errors.
Use --help for more information.
- OpenVPN continuously attempts to connect, not just once. The log file shows connection attempts every minute or so.
- The 3 files in question are in the same directory, a subdirectory of the config/auto-config folder. I might need to hard code the entire path.
\Program Files\OpenVPN\config-auto
folder for your.ovpn
configuration files. This should start a separate OpenVPN process on each file.update
on my question. I placed the config file in theconfig-auto
directory. I did not see that directory yesterday. I did see the README.txt file, which says the same thing as what you wrote. I MOVED the config files there, restarted the computer (twice), waited about 5-minutes, and nothing. If I copy the files back to either config folder and restart the GUI, then I am able to manually connect. I did verify thatOpenVPN Service
does start after the reboot.OpenVPNService
starts nicely and is set to automatic. I am happy to furnish a screenshot if you want, though I do not wish to make the question overtly long.