OpenVPN3:会话启动:如何通过用户名和密码

发布于 2025-01-31 14:43:27 字数 181 浏览 2 评论 0原文

目前,我正在使用OpenVPN3客户端连接到VPN服务器,因为

openvpn3 session-start --config /home/user/client.ovpn

它要求提供用户名和密码。

是否有任何简单的方法传递用户名和密码。因为每次输入用户名和密码都很烦人

Currently I am using openvpn3 client to connect to vpn server as

openvpn3 session-start --config /home/user/client.ovpn

then it asks for username and password.

Is there any easy way to pass username and password. Because everytime to enter username and password is annoying

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

你爱我像她 2025-02-07 14:43:27

您可以使用printf使用\ n作为定界符传递用户名和密码:

printf "MY_USERNAME\nMY_PASSWORD\n" | openvpn3 session-start --config client.ovpn

You can pass username and password with printf using \n as a delimiter:

printf "MY_USERNAME\nMY_PASSWORD\n" | openvpn3 session-start --config client.ovpn
浅黛梨妆こ 2025-02-07 14:43:27

您可以使用此简单的Python脚本连接到VPN:

import pexpect
from pexpect import popen_spawn

commands = "openvpn3 session-start --config profile-40.ovpn"
commands_list = commands.split(" ")
username = "x"
password = "x"

session = pexpect.popen_spawn.PopenSpawn(commands)
session.expect("Auth User name: ")
session.sendline(username)
print("first_done")

session.expect("Auth Password: ")
session.sendline(password)
print("second_done")

You can use this simple python script to connect to VPN:

import pexpect
from pexpect import popen_spawn

commands = "openvpn3 session-start --config profile-40.ovpn"
commands_list = commands.split(" ")
username = "x"
password = "x"

session = pexpect.popen_spawn.PopenSpawn(commands)
session.expect("Auth User name: ")
session.sendline(username)
print("first_done")

session.expect("Auth Password: ")
session.sendline(password)
print("second_done")
浊酒尽余欢 2025-02-07 14:43:27

OpenVPN3会话启动
https://github.com/openvpn/openvpn/openvpn/openvpn3-linux

请参阅有关的说明
https://community.openity.openvpn.net/openvpn/openvpn/openvpn/wiki/popn/wiki/openvpn3liux to to to to to to to to to
在Debian,Ubuntu,Fedora,
Red Hat Enterprise Linux,Centos和Scientific Linux。


当我对Fedora 36进行升级时,内置了最新的OpenVPN3-Linux V18客户端。不必手动升级 /安装它:

openvpn3-admin version --services

EG:以前的V17突然停止工作时间花费10个小时,试图与许多“ OpenVPN3 Session-Start”进行调试, :

openvpn3 config-import --config profile.udp.ovpn --persistent
openvpn3 config-manage --config profile.udp.ovpn --enable-legacy-algorithms true --show
openvpn3 session-start --config profile.udp.ovpn
openvpn3 sessions-list 
openvpn3 session-manage --config profile.udp.ovpn --disconnect

实际上认为这是Cipher AES-256-CBC旧问题。这不是出于某种原因,安装OpenVPN3 Linux客户端的权限?因为它没有创建 tun
因此我自己做了一个实际问题):

sudo ip tuntap add name tun0 mode tun
sudo ip link show

要求提供VPN用户名&密码,因此将它们添加到文本文件login.txt在配置文件目录中,并且
auth-user-pass login.txt to profile.udp.ovpn,因此它将自动传递用户名和密码。

Another solution to pass the username and password is to use

fyi更openvpn3-client会话启动帮助在这里: https://github.com/openvpn/openvpn3-linux/issues?q=cipher

openvpn3 session-start as per
https://github.com/OpenVPN/openvpn3-linux

See the instructions on
https://community.openvpn.net/openvpn/wiki/OpenVPN3Linux how to
install pre-built OpenVPN 3 Linux packages on Debian, Ubuntu, Fedora,
Red Hat Enterprise Linux, CentOS and Scientific Linux.

When I did an upgrade to Fedora 36 the latest openvpn3-linux v18 client was built in. Did not have to manually upgrade / install it:

openvpn3-admin version --services

e.g: previous v17 suddenly stopped working spend 10 hours trying to debug with many "openvpn3 session-start":

openvpn3 config-import --config profile.udp.ovpn --persistent
openvpn3 config-manage --config profile.udp.ovpn --enable-legacy-algorithms true --show
openvpn3 session-start --config profile.udp.ovpn
openvpn3 sessions-list 
openvpn3 session-manage --config profile.udp.ovpn --disconnect

Actually thinking it was a cipher AES-256-CBC legacy issue that others were having. It was not for some reason, permissions on install of the OpenVPN3 Linux client? as it was NOT creating a TUN.
So I made one myself (that was the actual issue):

sudo ip tuntap add name tun0 mode tun
sudo ip link show

and it connected after asking for VPN Username & Password, so added those to text file login.txt in the profile directory and
auth-user-pass login.txt to profile.udp.ovpn so it would pass username and password automatically.

Another solution to pass the username and password is to use openvpn3-autoload

FYI more openvpn3-client session start help is here: https://github.com/OpenVPN/openvpn3-linux/issues?q=cipher

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文