1

I'd like to start OpenVPN to connect to our OpenVPN server (on Debian) through my aplication in C++. Currently, I'm using key files only (public & private keys), but I need to add username authentication as well. I'm newbie in C++, so I would be grateful if you explain in details and all steps I need to take.

I also need to disconnect the VPN connection before quittig my application, and to avoid communicating when VPN is disconnected (to handle abrupt disconnections). So I also need a mechanism to detect VPN disconnections or to check if the OpenVPN connection is still in place, before sending sensitive data.

Thank you all.

Javad
  • 5,755
  • 4
  • 41
  • 51
  • Just a reminder: I need this app to be in native C++ since I would run it in Linux. – Javad Apr 15 '14 at 09:11
  • How did yiu manage updates from openvpn itself, i.e. status updates like authenticating, connected, disconnected, etc? – CybeX Dec 08 '17 at 04:41

1 Answers1

2

Solved. Used popen function/method mentioned here. And of course with this little change in the first line of the main() method:

FILE * f = popen( "/etc/init.d/openvpn start", "r" );
Community
  • 1
  • 1
Javad
  • 5,755
  • 4
  • 41
  • 51