8

Is it possible to connect to an openvpn server using a username and password. I read that you need a config file on ubuntu, but I don't have a config file.

How can I connect to my openvpn server using credentials?

12

Yes it's possible. To do this, you have already an OpenVPN server installed, and the user created in the server.

The easiest openvpn client is network-manager. If you are using Ubuntu run:

aptitude install network-manager-openvpn
restart network-manager

Now click on the network-manager applet, select configure VPN, and setup a new open-vpn connection. Set the gateway to you server Set the type to Password Point your CA to a copy of your server’s ca.crt and everything should just work

Attached is a simple client configuration file that will work. Edit it to match your server’s settings where appropriate. You will need this and your ca.crt in the same directory.

On linux my file is called /etc/openvpn/client.conf

##############################################
# Sample client-side OpenVPN 2.0 config file.
# for connecting to multi-client server. 
##############################################

# Specify that we are a client and that we
# will be pulling certain config file directives
# from the server.
client

dev tun
proto udp

# The hostname/IP and port of the server.
remote my-server-2.domain 1194


# host name of the OpenVPN server.  Very useful
# on machines which are not permanently connected
# to the internet such as laptops.
resolv-retry infinite

# Most clients don't need to bind to
# a specific local port number.
nobind

# Try to preserve some state across restarts.
persist-key
persist-tun

# Certificate Authority
ca ca.crt

# Username/Password authentication is used on the server
auth-user-pass

# Verify server certificate by checking
# that the certicate has the nsCertType
# field set to "server".  This is an
# important precaution to protect against
# a potential attack discussed here:
#  http://openvpn.net/howto.html#mitm
#
# To use this feature, you will need to generate
# your server certificates with the nsCertType
# field set to "server".  The build-key-server
# script in the easy-rsa folder will do this.
ns-cert-type server

# Set log file verbosity.
verb 3

# To start the openvpn client, simply type:
# openvpn --config /etc/openvpn/client.conf

That's it.

| improve this answer | |
0

On the server side you need a line like:

plugin /usr/lib/openvpn/openvpn-plugin-auth-pam.so openvpn

The above will enable the pam plugin and make it to use the /etc/pam.d/openvpn file as config (note: file does not exist by default, you may use 'login' instead of it to validate unix credentials or set up the openvpn one with the authentication method of your choice (ie: google authenticator))

On the client side as mentioned above you should use auth-user-pass in openvpn configfile, or if you use network manager choose "Password with Certfificates" (User + Pass + cert based auth) or the simple "Password" option (User + Pass based auth) on the Identity tab.

| improve this answer | |

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.