简体   繁体   English

我将如何连接到提供证书文件 (.ovpn) 然后还指定用户名和密码的 VPN?

[英]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.

相关问题 如何在密码框顶部覆盖灰色字“密码”? - How would I go about overlaying the gray word 'password' on top of a password box? C# 我将如何将多个客户端连接到同一台服务器? - C# How would I go about connecting multiple clients to the same server? 我该如何进行单元测试呢? - How would I go about unit testing this? 如何在不编写 ovpn 文件的情况下连接 OpenVPN 服务器? - How can I connect an OpenVPN server without writing an ovpn file? 我如何按数字顺序排序包含名称和分数的文本文件(排行榜样式) - How would I go about sorting a text file that contains names and scores in numerical order (Leaderboard style) 我将如何以编程方式捕获内部音频? - How would I go about programmatically capturing internal audio? 我将如何实施不同速度的秒表? - How would I go about implementing a stopwatch with different speeds? 我将如何阅读bittorrent片段? - How would I go about reading bittorrent pieces? 我将如何创建ReturnAlteredObject扩展方法? - How would I go about creating a ReturnAlteredObject extension method? 我将如何在一个简单的有向图中倒数? - How would I go about counting backwards in a simple directed graph?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM