Windows MSA Account - OpenVPNService - Won't auto-connect

How to customize and extend your OpenVPN installation.

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

Post Reply
MrAutomation
OpenVpn Newbie
Posts: 4
Joined: Tue Mar 22, 2022 6:44 am

Windows MSA Account - OpenVPNService - Won't auto-connect

Post by MrAutomation » Tue Mar 22, 2022 6:47 am

Greetings,

I'm playing around with using the OpenVPN-GUI/Service to connect to a server however I'm getting no output when running the commands from powershell, via a Scheduled Task.

I am 100% certain the scheduled task executes, debug from the powershell script goes into EventViewer, however, when it comes time to doing the OpenVpn-GUI --connect <profile>, it doesn't give me any output.

I've assumed this was due to a lack of administrator privilages.

So I uninstalled and reinstalled and selected to install the service this time.

I've since tried to run openvpn --config <profile> and an assortment of other commands, none of actually worked within the context of the MSA running from a scheduled task.

I've read and re-read https://openvpn.net/community-resources ... n-process/ and apparently missed something obviously very simply.

Any help would be appreciated.

User avatar
openvpn_inc
OpenVPN Inc.
Posts: 1332
Joined: Tue Feb 16, 2021 10:41 am

Re: Windows MSA Account - OpenVPNService - Won't auto-connect

Post by openvpn_inc » Tue Mar 22, 2022 4:25 pm

Hi MrA,

The only thing I can suggest is that you check your profile for a "daemon" line and comment that. This would force openvpn to run in the foreground, and from there you might see what's happening (or not happening, as the case may be.)

regards, rob0
Image OpenVPN Inc.
Answers provided by OpenVPN Inc. staff members here are provided on a voluntary best-effort basis, and no rights can be claimed on the basis of answers posted in this public forum. If you wish to get official support from OpenVPN Inc. please use the official support ticket system: https://openvpn.net/support

MrAutomation
OpenVpn Newbie
Posts: 4
Joined: Tue Mar 22, 2022 6:44 am

Re: Windows MSA Account - OpenVPNService - Won't auto-connect

Post by MrAutomation » Tue Mar 22, 2022 10:36 pm

Unfortunately as it's running as an MSA, we can't actually see the GUI at all. Even forcing logging to a specific directory produces no results.

Are we supposed to use openvpn.exe instead of the gui when connecting programmatically?

I've also tried this; https://openvpn.net/community-resources ... le-window/

Without success.

Seems to be a relatively straight forward exercise;

Have scheduled task
Connect to vpn
...
Profit?

User avatar
openvpn_inc
OpenVPN Inc.
Posts: 1332
Joined: Tue Feb 16, 2021 10:41 am

Re: Windows MSA Account - OpenVPNService - Won't auto-connect

Post by openvpn_inc » Wed Mar 23, 2022 12:54 am

Hi MrA,

Are you not able to read or edit your profile? Then no, this will not be simple.

Yes, of course it makes more sense to use a command line tool for automated tasks. I've never done that on Windows. Are you not able to connect in to a PowerShell? I was thinking you could read and edit your profile, but if you can't, ugh.

regards, rob0
Image OpenVPN Inc.
Answers provided by OpenVPN Inc. staff members here are provided on a voluntary best-effort basis, and no rights can be claimed on the basis of answers posted in this public forum. If you wish to get official support from OpenVPN Inc. please use the official support ticket system: https://openvpn.net/support

MrAutomation
OpenVpn Newbie
Posts: 4
Joined: Tue Mar 22, 2022 6:44 am

Re: Windows MSA Account - OpenVPNService - Won't auto-connect

Post by MrAutomation » Thu Mar 24, 2022 3:01 am

Technically, we can use PSExec to execute a powershell script as the MSA account, however, it executes using Administrator privileges within the security context. Which bypasses the problem and isn't usable via Scheduled Task.

I can't grant the MSA Administrator access as it would mean anyone with access to the server would theoretically be able to rewrite the script to grant themselves admin privs.

We can modify environment and user variables within the context of the MSA though.

MrAutomation
OpenVpn Newbie
Posts: 4
Joined: Tue Mar 22, 2022 6:44 am

Re: Windows MSA Account - OpenVPNService - Won't auto-connect

Post by MrAutomation » Fri Mar 25, 2022 12:48 am

I've found that the OpenVPN Service does execute the AutoConfig after a server reboot.

Which is extremely odd but it works!

abis9
OpenVpn Newbie
Posts: 3
Joined: Sun Jul 03, 2022 2:45 am

Re: Windows MSA Account - OpenVPNService - Won't auto-connect

Post by abis9 » Sun Jul 03, 2022 2:56 am

Excellent it seems you have found the solution.

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

Re: Windows MSA Account - OpenVPNService - Won't auto-connect

Post by TinCanTech » Sun Jul 24, 2022 2:33 pm

MrAutomation wrote:
Fri Mar 25, 2022 12:48 am
I've found that the OpenVPN Service does execute the AutoConfig after a server reboot.

Which is extremely odd but it works!
A service restart would do the same.

Post Reply