运行错误的“ up” Windows下的带有OpenVPN的脚本
我在Windows下创建了OVPN配置,实际上我希望它在连接后运行PowerShell脚本。
OVPN文件的最后一行如下:
script-security 3
up test.py
测试的内容非常简单,我尝试了
A)
#!/usr/bin/env python
print('Hello World')
和 b)
#!C:\\Program Files\\Inkscape\\bin\\python.exe
print('Hello World')
在所有情况下,我在执行配置时都会遇到以下错误。
2022-05-31 13:58:08 openvpn_execve: CreateProcess test.py failed: Unknown error (errno=193)
2022-05-31 13:58:08 WARNING: Failed running command (--up/--down): external program did not execute -- returned error code -1
2022-05-31 13:58:08 Exiting due to fatal error
知道为什么这会一直在发生吗?
I created an ovpn configuration under windows and I actually wanted it to run a Powershell script after the connection is estabilshed.
The last lines of the ovpn-file are as follows
script-security 3
up test.py
The content of the test.py is very simple and I tried both
a)
#!/usr/bin/env python
print('Hello World')
and
b)
#!C:\\Program Files\\Inkscape\\bin\\python.exe
print('Hello World')
I am following the documentation here: https://openvpn.net/vpn-server-resources/explanation-of-client-side-scripting-with-simple-examples/
In all cases I keep getting the following error when executing the config.
2022-05-31 13:58:08 openvpn_execve: CreateProcess test.py failed: Unknown error (errno=193)
2022-05-31 13:58:08 WARNING: Failed running command (--up/--down): external program did not execute -- returned error code -1
2022-05-31 13:58:08 Exiting due to fatal error
Any idea why this keeps happening?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我现在找到了一个解决方案,但我全部不满意,但对此不满意。因此,寻找这样的解决方案。
显然,这里似乎有两个问题。
可以通过创建一个简单的批处理文件“ up.bat”并从其中运行PowerShell脚本来解决第一个脚本。
up.bat
文件的内容:说
现在我更改的唯一一件事就是在上面的OVPN-Config中
。现在运行了脚本,但不幸的是,不是作为超级用户,这是我的powershell脚本想要触发的命令所需的。
两个克服了它
为工作,我只是简单地将我的
up.bat
在此处获取该解决方案的代码: https://stackoverflow.com/a/12264592/1518458现在连接到VPN将提出一个Windows高程提示,一旦确认了PowerShell脚本将正确执行。
正如我所说,仍在寻找更好的解决方案:)
Okay I found a solution now but I am everything but not happy with it. So looking for s.o. to provide a better solution.
Apparently there seems to be two issues here.
The first one can be solved by creating a simple batch file "up.bat" and running the powershell script from in there.
The contents of the
up.bat
file:Now the only thing I changed was to say
in my above ovpn-Config.
Now that ran the script but unfortunately not as the superuser which would be required for the commands my PowerShell scripts wants to trigger.
Two overcome that it works to
For that to work I simply prepended my
up.bat
with the code taken from this solution here: https://stackoverflow.com/a/12264592/1518458Now connecting to the VPN will bring up a windows elevation prompt and once this is confirmed the Powershell script will execute properly.
As I said still looking for a nicer solution :)