简体   繁体   中英

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. Is this possible? I'm using C# in Visual Studio 2019.

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

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! 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. 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. I am sure there are many more alternatives out there, this was purely an example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM