0

I have a server with OpenVPN installed on it, and I also have laptops (clients) running Ubuntu with openvpn installed. On the client, if I manually run the command "sudo openvpn /etc/openvpn/client.conf" the client is configured to prompt me for login info (username and password) which it will then use in authentication with the server. I would like this process to happen automatically on startup. Basically, I need logging into the client laptop and logging into the openvpn server to be the same action. I want the the authentication information for logging into openvpn to be the same as the login information for logging into the laptop's local user account. How can I do this?? Details please.

  • Does it have to be Username/Password? I know you can do this via pubkey auth on /etc/network/if-up.d – CaffeineAddiction Jun 1 '16 at 20:43
  • What would the method you are talking about entail? – Tommy Orok Jun 1 '16 at 20:59
2

Use "auth-user-pass credentials-file.txt" option in your client config file. The credentials file should be in the form:

username
password

Yes, you will have the plaintext file with username and password.

  • Thank you so much for your reply, but that only tells me how I would take care of the automatic authorization part. How do I configure openvpn to start upon login in the first place? – Tommy Orok Jun 2 '16 at 10:30
  • Try to run it from bash-profile or so. Implement locking to not to run it more than once. – Nikita Kipriyanov Jun 8 '16 at 6:02
0

I assume You have downloaded .ovpn file with information about vpn.

Create next to it, a file, auth.txt and insert in first line vpn login, in second line vpn password.

admin
master

Save file and close it. Edit Your .ovpn file, find line starting with auth-user-pass and add auth.txt. Save file and close it.

enter image description here

!! However I would write with full path to auth.txt e.g. auth-user-pass /etc/openvpn/auth.txt

Now You should be able call sudo openvpn <.ovpn file> without providing credentials.

I based information on here and here

There is a small note how to autorun scripts on system boot: here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.