OpenVPN autostart on Windows 10

Need help configuring your VPN? Just post here and you'll get that help.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
MatejKovacic
OpenVPN User
Posts: 44
Joined: Wed Jun 19, 2013 9:43 am

OpenVPN autostart on Windows 10

Post by MatejKovacic » Wed Oct 21, 2020 7:18 pm

So, I have Windows 10 with all updates and try to autostart VPN. I have only one config file, from OpenVPN GUI connection is easily established, but after reboot, it does not autostart.

I went to services.msc and set OpenVPNService to automatic and also OpenVPN Legacy Service to automatic... and after restart, it is not started. And yes, I ticked "Start OpenVPN at Windows startup" in settings.

Any other idea?

MatejKovacic
OpenVPN User
Posts: 44
Joined: Wed Jun 19, 2013 9:43 am

Re: OpenVPN autostart on Windows 10

Post by MatejKovacic » Wed Oct 21, 2020 7:20 pm

BTW, I am using OpenVPN version 2.4.9.

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: OpenVPN autostart on Windows 10

Post by TinCanTech » Wed Oct 21, 2020 8:41 pm

MatejKovacic wrote:
Wed Oct 21, 2020 7:18 pm
I went to services.msc and set OpenVPNService to automatic and also OpenVPN Legacy Service to automatic
Those services only start files in C:\Program Files\OpenVPN\Config

MatejKovacic
OpenVPN User
Posts: 44
Joined: Wed Jun 19, 2013 9:43 am

Re: OpenVPN autostart on Windows 10

Post by MatejKovacic » Wed Oct 21, 2020 9:16 pm

Well, I have a config file in C:\Program Files\OpenVPN\config (config, not Config). But it does not start.

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: OpenVPN autostart on Windows 10

Post by TinCanTech » Wed Oct 21, 2020 9:37 pm

Your log should give you the answer.

MatejKovacic
OpenVPN User
Posts: 44
Joined: Wed Jun 19, 2013 9:43 am

Re: OpenVPN autostart on Windows 10

Post by MatejKovacic » Thu Oct 22, 2020 6:54 am

Well, the problem is there is no log. I mean, there is log, if I start connection manually. And in that case, connection works just fine. But the automatic connection doesn't start.

In Linux, there is /etc/default/openvpn file with AUTOSTART directive. That works just fine.

Unfortunately, I am not really a Windows user, but as I understand, services.msc should be the solution. Unfortunately it is not.

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: OpenVPN autostart on Windows 10

Post by TinCanTech » Thu Oct 22, 2020 1:03 pm

The services start Openvpn profile in the \config directory where Openvpn is installed.

If these don't work for you then you either don't have your profile in the right place or there is an error in the config. If you don't have a log then configure one using --log and --verb .. see the manual for details.

dullibert
OpenVpn Newbie
Posts: 1
Joined: Wed May 26, 2021 2:38 pm

Re: OpenVPN autostart on Windows 10

Post by dullibert » Wed May 26, 2021 2:52 pm

Hi there,

(not sure if it's cool to revive old posts, but I'm in a similar situation, so I figured I'd give it a go)

I am using OpenVPN GUI v 11.24.0.0 on Windows 10, and I would like to automatically log on to my server on startup. I followed the instructions and installed the program as a service, which launches properly. I also placed exactly one config file in Program Files\OpenVPN\config-auto (the file works properly under manual connection) - but nothing is happening. The service is running upon login, but I am not connected. I am not sure how to debug this. Couple of questions:

1.TinCanTech suggests to activate the log, but I am not sure how to do that. Do I log it through OpenVPN GUI, or from the windows service side?
2. Another major source of confusion is whether the service just automates the GUI functionality, or is a separate process - in other words: are any settings I am modifying in OpenVPN GUI - specifically "launch on user logon" - connected to the service, or can I turn that off and still get automatic logon via the service?
3. Finally, I am using password and certificate - does this affect how the service functions? In other words: when I manually log in through the GUI the first time I am asked for username and password. How is this resolved in the service?

Thanks for your help!
dulli

bunglle
OpenVpn Newbie
Posts: 1
Joined: Fri Jun 11, 2021 4:24 pm

Re: OpenVPN autostart on Windows 10

Post by bunglle » Fri Jun 11, 2021 4:29 pm

Hi,

I have the same problem,

Gui start on windows startup but not my server ( server.ovpn and other file place in config directory) , I need to start the manually the server in gui.

In previous version of the service this operation work fine.

Any Idea ?

admininator
OpenVpn Newbie
Posts: 17
Joined: Mon Jun 07, 2021 4:10 pm

Re: OpenVPN autostart on Windows 10

Post by admininator » Fri Jun 11, 2021 5:34 pm

bunglle wrote:
Fri Jun 11, 2021 4:29 pm
Hi,

I have the same problem,

Gui start on windows startup but not my server ( server.ovpn and other file place in config directory) , I need to start the manually the server in gui.

In previous version of the service this operation work fine.

Any Idea ?
I went through this last night. First, the gui and the service are unrelated. Pick one or the other. Service for automation, gui for manual start.

The documentation seems to be very old. Here's how I sorted it out.

1) Put your server.ovpn in C:\Program Files\OpenVPN\config-auto
2) Create a text file called "stdin.txt" and put it in the same folder.
3) Open stdin.txt and put your server key passphrase and save. Then - and this is what caused me a headache last night - the file has to be ANSI encoded otherwise you'll get a key decrypt error and your server instance won't start. This is nowhere in the documentation. I couldn't find it by searching the internet either. I just guessed it was probably an encoding issue and guessed it should be ANSI. I guessed right. :D
4) edit server.ovpn and add:

Code: Select all

askpass "C:\\Program Files\\OpenVPN\\config-auto\\stdin.txt"
5) In svcs, change startup type for "OpenVPNService" to automatic and start the service. It should auto load server.ovpn and connect automatically.

lochnerr
OpenVpn Newbie
Posts: 1
Joined: Sun Feb 06, 2022 11:41 pm

Re: OpenVPN autostart on Windows 10

Post by lochnerr » Mon Feb 07, 2022 12:06 am

So that I might possibly save some poor soul the 2 days of misery that I went through trying to get this to work, I add the following.

The instructions from 'admininator on Jun 11, 2021' are good, but there is something left out, at least with regard to the 64-bit Windows install circa February 2022.

You have a choice when you install the program to 'Install Now' or 'Customize'. If you do not do a custom installation, the OpenVPN Service will *NOT* be installed and your ovpn files in the /Program Files/OpenVPN/config-auto directory will be ignored on boot. OpenVPN will work, but only after you successfully login to windows. Not good if you want to login to Active Directory.

User avatar
vandreytrindade
OpenVpn Newbie
Posts: 18
Joined: Sun Jul 26, 2015 1:14 pm

Re: OpenVPN autostart on Windows 10

Post by vandreytrindade » Mon Nov 14, 2022 2:35 pm

@lochnerr,

Thanks a lot!

Helix751
OpenVpn Newbie
Posts: 1
Joined: Sun Oct 08, 2023 1:22 am

Re: OpenVPN autostart on Windows 10

Post by Helix751 » Sun Oct 08, 2023 1:25 am

I wonder where the auto connect certificates and keys have to be stored: In the same 'config-auto' folder together with the .ovpn file or can/should they stay in the 'config' folder?

wimein
OpenVpn Newbie
Posts: 1
Joined: Wed Dec 13, 2023 10:18 am

Re: OpenVPN autostart on Windows 10

Post by wimein » Wed Dec 13, 2023 10:23 am

Instead of using askpass in the .ovpn file I added this line

Code: Select all

auth-user-pass auth
and put a file "auth" in the C:\Program Files\OpenVPN\config-auto folder with the username in the 1st line and the password in the 2nd.

Works well.

Post Reply