[英]How would I go about connecting to a VPN providing a certificate file (.ovpn) then also specifying a username and password?
I have recently been trying to create a VPN client in C# utilizing OpenVPN, I want my users to be able to select a .ovpn file, then enter a username and password to make a connection to the VPN.我最近一直在尝试使用 OpenVPN 在 C# 中创建一个 VPN 客户端,我希望我的用户能够选择一个 .ovpn 文件,然后输入用户名和密码以连接到 VPN。 Is this possible?
这可能吗? I'm using C# in Visual Studio 2019.
我在 Visual Studio 2019 中使用 C#。
A hint on how you are currently interfacing can make a huge difference, i will for now assume you just start/stop the service with commandline commands.关于您当前如何连接的提示可以产生巨大的不同,我现在假设您只是使用命令行命令启动/停止服务。
You could start a specific ovpn file by running openvpn --config sample.ovpn
您可以通过运行
openvpn --config sample.ovpn
来启动特定的 ovpn 文件
On how to add login and password to that config i will refer you to https://forums.openvpn.net/viewtopic.php?t=11342 However do note that storing any password is unsafe unless done very carefully and secure and always notify your users you are storing it!关于如何将登录名和密码添加到该配置,我将向您推荐https://forums.openvpn.net/viewtopic.php?t=11342但是请注意,除非非常小心和安全地完成并始终通知,否则存储任何密码都是不安全的您正在存储它的用户! Saving plaintext is not an option!
保存纯文本不是一种选择!
An alternative might be looking for an existing (open-source) c# app that provides this functionality and maybe forking the code.另一种方法可能是寻找提供此功能的现有(开源)c# 应用程序,并且可能会分叉代码。 For example: https://github.com/AirVPN/Eddie Note: I am not in any way connected to AirVPN or Eddie project other than knowing it exists.
例如: https : //github.com/AirVPN/Eddie注意:除了知道它存在之外,我没有以任何方式连接到 AirVPN 或 Eddie 项目。 I am sure there are many more alternatives out there, this was purely an example.
我相信还有更多的选择,这纯粹是一个例子。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.