Linux: VPN Connection
-
I'm trying to write a VPN client application for Ubuntu using QtCreator 4.6.0. This would not be a cross platform application, it would only be released on Ubuntu and possibly some other Linux distros. I've found this page regarding the topic however, from the research I've done QtExtended was mainly for mobile devices and has been discontinued. So, how would I go about writing a VPN client application that implements a custom protocol I've written, using Qt Creator with C++? I already have a client library that I would be using along side this, so I would need to write my own implementation of whatever interface is supplied within Qt.
- I'm looking for something similar to iOS/OSX's PacketTunnelProvider from the NetworkExtension framework, or Android's VpnService.
- If that's not an option, what process should I be following to get this working the way I'd like?
- Are there any examples of doing this available online?
-
@vrazon This is a huge question... It's like saying how do I write Google Chrome?
To help guide you, you can google "vpn rfc" to get the RFC's for VPNs. That will give you a ton of technical data on VPNs.
You can also look up existing vpn technologies like OpenVPN and check out their source code to see how they are handling their VPN setup.
You can look at the code for that discontinued QVPNClient and see what they are doing.
This will be a large undertaking though, and you may want to consider just wrapping existing linux processes that handle vpns for you rather than trying to code your own. Again something like openvpn, or using network manager to setup a vpn with the PPTP protocol.
Sorry I can't give more, that's just too broad of a question.
-
Hi @vrazon,
Just to add to @ambershark, when it comes to cryptography, you never invent your own protocol or write your own library. You use something that is widely used and actively maintained.
If a new security leak comes up (think of heartbleed), then others are responsible for fixing that and update their libs. Otherwise you would be responsible for fixing the security hole. You don't want that.
-
@aha_1980 said in Linux: VPN Connection:
Hi @vrazon,
Just to add to @ambershark, when it comes to cryptography, you never invent your own protocol or write your own library. You use something that is widely used and actively maintained.
If a new security leak comes up (think of heartbleed), then others are responsible for fixing that and update their libs. Otherwise you would be responsible for fixing the security hole. You don't want that.
Disregard the fact that I'm using a custom protocol, just assume I'm using a protocol that's well established but is unknown, or better yet simply unsupported by Qt, and has no active client application that can be wrapped with Qt.
@ambershark said in Linux: VPN Connection:
@vrazon This is a huge question... It's like saying how do I write Google Chrome?
To help guide you, you can google "vpn rfc" to get the RFC's for VPNs. That will give you a ton of technical data on VPNs.
You can also look up existing vpn technologies like OpenVPN and check out their source code to see how they are handling their VPN setup.
You can look at the code for that discontinued QVPNClient and see what they are doing.
This will be a large undertaking though, and you may want to consider just wrapping existing linux processes that handle vpns for you rather than trying to code your own. Again something like openvpn, or using network manager to setup a vpn with the PPTP protocol.
Sorry I can't give more, that's just too broad of a question.
I'm looking for something that ties into the software like iOS's NetworkExtension or Android's VPN Service that gives me an interface to the local tunnel adapter so that I can implement specific pieces of the interface to integrate my protocol. What I gather from what you're telling me is that nothing of this sort exists with Qt, meaning I will have to create the tunnel, and write a client myself in C++ to run within my Qt client, correct?
-
@vrazon said in Linux: VPN Connection:
I'm looking for something that ties into the software like iOS's NetworkExtension or Android's VPN Service that gives me an interface to the local tunnel adapter so that I can implement specific pieces of the interface to integrate my protocol. What I gather from what you're telling me is that nothing of this sort exists with Qt, meaning I will have to create the tunnel, and write a client myself in C++ to run within my Qt client, correct?
It may exist. I haven't done anything that required something like that in Qt, so I just don't know if there is a class that handles it. My gut feeling is that it doesn't exist and you would have to find one someone else wrote, or else write your own.
I'm sure someone before you has written something (open sourced) like that. Even if it doesn't integrate with Qt fully, as long as it's in C++ you should be able to adapt and use it fairly easily.
You could take that QtExtended and adapt the classes you need for your current project too. Even that would be less work than writing your own.