Вопрос

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.

Это было полезно?

Решение

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" );
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top