Environment vars are not being resolved?

How to customize and extend your OpenVPN installation.

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

Post Reply
User avatar
NullDevice
OpenVpn Newbie
Posts: 13
Joined: Sun Sep 11, 2011 11:33 pm

Environment vars are not being resolved?

Post by NullDevice » Sat Jan 12, 2019 9:53 pm

Hello!

Did anyone have the problem yet that on the windows openvpn client, the up and down scripts cannot resolve environment variables?

I mean i have a file called "up.bat" , and when i run it manually, everything is working fine.
When OpenVPN runs it after successful connect, then variables like %USERPROFILE% are treated like the string "%USERPROFILE%" and are not resolved.

I do have "script-security 3" in my config. I guess this is right?

My version is OpenVPN GUI (Windows) v 11.10.0.0

ND

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

Re: Environment vars are not being resolved?

Post by TinCanTech » Sat Jan 12, 2019 10:01 pm

Like Linux, Windows does not inherit your environment ..
The common way people discover this is because scripts do not have access to $PATH.

Although, that's only a guess ..

User avatar
NullDevice
OpenVpn Newbie
Posts: 13
Joined: Sun Sep 11, 2011 11:33 pm

Re: Environment vars are not being resolved?

Post by NullDevice » Sun Jan 20, 2019 5:08 pm

Yes, seems its exactly that problem.
Is there are workaround? How do others use script with env.vars then normally?

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

Re: Environment vars are not being resolved?

Post by TinCanTech » Sun Jan 20, 2019 10:54 pm

NullDevice wrote:
Sun Jan 20, 2019 5:08 pm
Is there are workaround?
You mean, like a bug ?

User avatar
NullDevice
OpenVpn Newbie
Posts: 13
Joined: Sun Sep 11, 2011 11:33 pm

Re: Environment vars are not being resolved?

Post by NullDevice » Sat Jan 26, 2019 10:17 am

No, i mean tuning to OS to do exceptions for scripts or something like that. There are plenty of other applications using environment variables with scripts. F.e. Cisco AnyConnect VPN client. Scripts with environement vars are working there. So there must be a possiblity.

Post Reply