Saving Username/Password

How to customize and extend your OpenVPN installation.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

captainp0w3r
OpenVpn Newbie
Posts: 3
Joined: Sat Sep 22, 2012 4:50 pm

Saving Username/Password

Post by captainp0w3r » Sat Sep 22, 2012 4:54 pm

Is there a way to save my VPN provider's username/password credentials when using OpenVPN's client instead of having to type it in each type I establish a connection to a server? Here is a config file from a randomly chosen server as it is now.

client
dev tun
proto udp
remote us-texas.privateinternetaccess.com 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
tls-client
remote-cert-tls server
auth-user-pass
comp-lzo
verb 1
reneg-sec 0

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: Saving Username/Password

Post by maikcat » Mon Sep 24, 2012 7:22 am

--auth-user-pass [up]
Authenticate with server using username/password. up is a file containing username/password on 2 lines (Note: OpenVPN will only read passwords from a file if it has been built with the --enable-password-save configure option, or on Windows by defining ENABLE_PASSWORD_SAVE in config-win32.h).

If up is omitted, username/password will be prompted from the console.

The server configuration must specify an --auth-user-pass-verify script to verify the username/password provided by the client.
Michael.
Amiga 500 , Zx +2 owner
Long live Dino Dini (Kick off 2 Creator)

Inflammable means flammable? (Dr Nick Riviera,Simsons Season13)

"objects in mirror are losing"

joglomedia
OpenVpn Newbie
Posts: 1
Joined: Mon Sep 24, 2012 2:19 pm

Re: Saving Username/Password

Post by joglomedia » Mon Sep 24, 2012 2:22 pm

As maikcat said above

try this solution

add this line to your openvpn clients config file
auth-user-pass login.conf
create new file named login.conf and then add your clients username and password
username
password

captainp0w3r
OpenVpn Newbie
Posts: 3
Joined: Sat Sep 22, 2012 4:50 pm

Re: Saving Username/Password

Post by captainp0w3r » Wed Sep 26, 2012 3:49 am

Ok I'm a little confused with
or on Windows by defining ENABLE_PASSWORD_SAVE in config-win32.h).

If up is omitted, username/password will be prompted from the console.

The server configuration must specify an --auth-user-pass-verify script to verify the username/password provided by the client.
Do I merely need to do what jogomedia said and define a file on the auth-user-pass line and in that file enter my username/password on two lines? Or could you clarify what the above quote from Maikcat means?

User avatar
xauen
Forum Team
Posts: 80
Joined: Tue May 10, 2011 7:57 pm
Location: Manila, Philippines
Contact:

Re: Saving Username/Password

Post by xauen » Sat Oct 06, 2012 11:59 am

1. Create a txt file on a folder alongside your .ovpn files name it what ever you want ex. 'pass.txt'
2. Put your user/pass inside the file in two(2) lines, like:

Code: Select all

username
password
3. Then save it.
4. open up your .ovpn file in notepad and add:

Code: Select all

auth-user-pass pass.txt
5. save and connect to your openvpn server.
"Never be bullied into silence. Never allow yourself to be made a victim. Accept no ones definition of you"
-IDK

seccentral
OpenVpn Newbie
Posts: 14
Joined: Tue Aug 06, 2013 12:24 pm

Re: Saving Username/Password

Post by seccentral » Sat Oct 12, 2013 4:34 pm

Options error: --auth-user-pass fails with 'passwords.txt': No such file or dire
ctory
Options error: Please correct these errors.
Use --help for more information.
Press any key to continue...
how do i fix that ?

seccentral
OpenVpn Newbie
Posts: 14
Joined: Tue Aug 06, 2013 12:24 pm

Re: Saving Username/Password

Post by seccentral » Sun Oct 13, 2013 12:31 am

its there with the .ovpn folder.
where do i need to put it ?

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: Saving Username/Password

Post by maikcat » Mon Oct 14, 2013 5:28 am

you can use absolute path name as well...

Michael.
Amiga 500 , Zx +2 owner
Long live Dino Dini (Kick off 2 Creator)

Inflammable means flammable? (Dr Nick Riviera,Simsons Season13)

"objects in mirror are losing"

seccentral
OpenVpn Newbie
Posts: 14
Joined: Tue Aug 06, 2013 12:24 pm

Re: Saving Username/Password

Post by seccentral » Mon Oct 14, 2013 6:17 pm

ty, works only in full path. could be a windows os problem :/

Kyrax
OpenVpn Newbie
Posts: 3
Joined: Fri Nov 15, 2013 9:14 am

Re: Saving Username/Password

Post by Kyrax » Fri Nov 15, 2013 9:20 am

xauen wrote:1. Create a txt file on a folder alongside your .ovpn files name it what ever you want ex. 'pass.txt'
2. Put your user/pass inside the file in two(2) lines, like:

Code: Select all

username
password
3. Then save it.
4. open up your .ovpn file in notepad and add:

Code: Select all

auth-user-pass pass.txt
5. save and connect to your openvpn server.
Good morning,

i tried this but the password continue to be asked. it look like the second line isn't read. (the file pass.txt was created with notepad++)
No error messages appear in logs.

Version 2.3.2
OS: Win 7 64 bits

Thanks for your help

MatVPN
OpenVpn Newbie
Posts: 16
Joined: Tue Jul 23, 2013 1:16 pm

Re: Saving Username/Password

Post by MatVPN » Fri Nov 15, 2013 10:47 am

- Open your txt-file in notepad++
- Edit->EOL Conversion->Convert to Unixformat
- Save txt-file
- Try again

Does it help?
Mathias

Kyrax
OpenVpn Newbie
Posts: 3
Joined: Fri Nov 15, 2013 9:14 am

Re: Saving Username/Password

Post by Kyrax » Fri Nov 15, 2013 10:51 am

To be sure, username is the common name asked during creation of certificat?

Because when i don't use the option auth-user-pass, i don't need to put a username to connect (only the password..)

Kyrax
OpenVpn Newbie
Posts: 3
Joined: Fri Nov 15, 2013 9:14 am

Re: Saving Username/Password

Post by Kyrax » Fri Nov 15, 2013 10:55 am

MatVPN wrote:- Open your txt-file in notepad++
- Edit->EOL Conversion->Convert to Unixformat
- Save txt-file
- Try again

Does it help?
Mathias
Unfortunately no, for information the encoding format is UTF-8

tuliptromper
OpenVpn Newbie
Posts: 1
Joined: Thu Dec 05, 2013 6:56 am

Re: Saving Username/Password

Post by tuliptromper » Thu Dec 05, 2013 7:08 am

This worked for me. Note that you have to use double back slashes and quotes. My user/pw file was named login.txt:

client
dev tun
proto udp
remote ca-toronto.privateinternetaccess.com 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
tls-client
remote-cert-tls server
auth-user-pass "c:\\program files\\openvpn\\config\\login.txt"
comp-lzo
verb 1
reneg-sec 0

openvpn@aetm.us
OpenVpn Newbie
Posts: 2
Joined: Sun Apr 27, 2014 9:40 pm

Re: Saving Username/Password

Post by openvpn@aetm.us » Sun Apr 27, 2014 9:42 pm

I tried all these tips, with and without the full path, and then including the double "\\". That line in the .ovpn file now reads:
auth-user-pass "C:\\Program Files\\OpenVPN\\config\\login.conf"

OpenVPN still prompts me for a user and pass. Help!

openvpn@aetm.us
OpenVpn Newbie
Posts: 2
Joined: Sun Apr 27, 2014 9:40 pm

Re: Saving Username/Password

Post by openvpn@aetm.us » Sun Apr 27, 2014 9:49 pm

The log includes:
Sun Apr 27 17:43:45 2014 MANAGEMENT: >STATE:1398635025,GET_CONFIG,,,
Sun Apr 27 17:43:46 2014 SENT CONTROL [OpenVPN Server]: 'PUSH_REQUEST' (status=1)
Sun Apr 27 17:43:46 2014 AUTH: Received control message: AUTH_FAILED
Sun Apr 27 17:43:46 2014 SIGUSR1[soft,auth-failure] received, process restarting
Sun Apr 27 17:43:46 2014 MANAGEMENT: >STATE:1398635026,RECONNECTING,auth-failure,,
The config file does include a certificate and a key. It works fine after I enter the user and pass when prompted.

TJude
OpenVpn Newbie
Posts: 2
Joined: Wed Aug 27, 2014 4:16 am

Re: Saving Username/Password

Post by TJude » Wed Aug 27, 2014 4:18 am

Kyrax wrote:To be sure, username is the common name asked during creation of certificat?

Because when i don't use the option auth-user-pass, i don't need to put a username to connect (only the password..)
This is interesting, but I'm not sure I understand.

I don't want to store the password in plaintext on my machine, however, I'd like to skip the username prompt. Are you saying there is some way I could accomplish that?

js6033
OpenVpn Newbie
Posts: 1
Joined: Wed Sep 17, 2014 3:46 pm

Re: Saving Username/Password

Post by js6033 » Wed Sep 17, 2014 3:55 pm

I do as this:

client
dev tun
proto udp
; Cert
ns-cert-type server
cipher BF-CBC
;Host
resolv-retry infinite
;auth
auth-user-pass "C:\\Program\\OpenVPN\\config\\selogin.txt"

remote xxxxxxxxxxxxx
persist-key
persist-tun
nobind
comp-lzo
verb 2
<ca>
-----BEGIN CERTIFICATE-----
xxxx
-----END CERTIFICATE-----
</ca>

From client window:
Wed Sep 17 17:53:41 2014 OpenVPN 2.1_rc20 i686-pc-mingw32 [SSL] [LZO2] built on Nov 3 2009
Wed Sep 17 17:53:41 2014 Sorry, 'Auth' password cannot be read from a file
Wed Sep 17 17:53:41 2014 Exiting

OS WINXP 32 bit,
Something missing?

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: Saving Username/Password

Post by maikcat » Fri Sep 19, 2014 6:44 am

OpenVPN 2.1_rc20
that quite old...

download and use the latest version

Michael.

henning
OpenVpn Newbie
Posts: 1
Joined: Thu Oct 23, 2014 8:44 am

Re: Saving Username/Password

Post by henning » Thu Oct 23, 2014 8:47 am

I neither have to enter a username, and I found a line

Code: Select all

# askpass tunnel.pass
so I uncommented and created a file "tunnel.pass" in the config-directory with one line of my PW.

Works fine for me (on Win7, OpenVPN 2.3.4.0)

Post Reply