Saving Username/Password

How to customize and extend your OpenVPN installation.
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: 4199
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)

thepodger
OpenVpn Newbie
Posts: 2
Joined: Tue Nov 04, 2014 2:49 pm

Re: Saving Username/Password

Post by thepodger » Tue Nov 04, 2014 2:56 pm

I have followed the "auth-user-pass password.txt" directions in Vista using V5 of the client and have yet to have any luck. Will update this post with the config settings soon. I suspect the OS is the issue. Will keep working on it a report findings here.

thepodger
OpenVpn Newbie
Posts: 2
Joined: Tue Nov 04, 2014 2:49 pm

Re: Saving Username/Password

Post by thepodger » Wed Nov 05, 2014 1:37 am

Here is my config file. As you can see, I have used the "Path-to-config-dir\\password.txt" format, but it has not worked for me.
I run the VPN program with this edited and the log does not register anything at all. I am sure it is a simple layout issue.
Any advice would be very welcome. BTW, I am using this with pfsense, a very solid, feature-rich, Open Source firewall is you are looking for one. Being able to save the user and pass for this client would be nice.
URL for pfsense: https://www.pfsense.org/

====Start of File ========
dev tun
persist-tun
persist-key
cipher AES-128-CBC
auth SHA1
tls-client
client
resolv-retry infinite
remote 50.74.48.226 1196 tcp-client
lport 0
verify-x509-name "Redacted-UserName" name
auth-user-pass "C:\Program Files\OpenVPN\config\\login.conf"
pkcs12 bpbuster-TCP-1196-FredK.p12
tls-auth bpbuster-TCP-1196-FredK-tls.key 1
comp-lzo
passtos

kpirlo
OpenVpn Newbie
Posts: 1
Joined: Mon Nov 24, 2014 3:36 pm

Re: Saving Username/Password

Post by kpirlo » Mon Nov 24, 2014 3:39 pm

I didn't see this mentioned in here yet, but I was trying to get this to work also and the only thing that worked for me was using the old style path (progra~1):

auth-user-pass "C:\\Progra~1\\OpenVPN\\config\\pass.txt"

Hope this helps someone else.

Sheepdisease
OpenVpn Newbie
Posts: 2
Joined: Tue Dec 02, 2014 9:34 pm

Re: Saving Username/Password

Post by Sheepdisease » Wed Dec 03, 2014 6:03 pm

I am having the same problem as above and wonder if someone could please assist?

Globule
OpenVpn Newbie
Posts: 1
Joined: Wed Dec 31, 2014 8:38 am

Re: Saving Username/Password

Post by Globule » Wed Dec 31, 2014 8:38 am

Check your client config file on your PC. You may have another entry auth-user-pass

Comment out the second one

User avatar
Traffic
OpenVPN Protagonist
Posts: 4081
Joined: Sat Aug 09, 2014 11:24 am

Re: Saving Username/Password

Post by Traffic » Wed Dec 31, 2014 1:00 pm

thepodger wrote:auth-user-pass "C:\Program Files\OpenVPN\config\\login.conf"
Can you not see the error ?

Code: Select all

auth-user-pass "C:\Program Files\OpenVPN\config\\login.conf"
# Replace with:
auth-user-pass "C:\\Program Files\\OpenVPN\\config\\login.conf"
You can also use this in OpenVPN:

Code: Select all

auth-user-pass "C:/Program Files/OpenVPN/config/login.conf"

KWhite
OpenVpn Newbie
Posts: 1
Joined: Tue Jan 06, 2015 11:23 am

Re: Saving Username/Password

Post by KWhite » Tue Jan 06, 2015 11:33 am

openvpn@aetm.us wrote: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!

Just create a new file using Notepad++

type in just 2 rows:
[username]
[pass]

your file should look like this:

John_Doe
mypassword

Go to Save As and select the config folder of your OpenVpn install (i.e. C:\Program Files\OpenVPN\config)
Save as "login.conf" . Select filetype "All Files".

Add to your .ovpn connection profile :

auth-user-pass login.conf

**Make sure this is the only line in the file like "auth-user-pass"

Save.

Connect.

This was the only way i could get it working on OpenVPN GUI v5-A.
Whenever i tried with a .txt pass file i would get " no such directory/ file...etc", even though the path was correct.

comeback1106
OpenVpn Newbie
Posts: 3
Joined: Wed Mar 04, 2015 7:17 am

Re: Saving Username/Password

Post by comeback1106 » Wed Mar 04, 2015 7:38 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.
I have try this way and this work for me. But more question, Can I include the password to this ovpn file? Thanks.

mrdiegoa
OpenVpn Newbie
Posts: 1
Joined: Fri May 15, 2015 10:42 am

Re: Saving Username/Password

Post by mrdiegoa » Fri May 15, 2015 10:46 am

Hi everybody.

Is there a means of storing just the login, without the password? The desired behavior would be that of the login/password dialog box appearing to the user already compiled in the login field.

Thanks,

Diego

oshliaer
OpenVpn Newbie
Posts: 1
Joined: Fri Oct 16, 2015 8:35 am

Re: Saving Username/Password

Post by oshliaer » Fri Oct 16, 2015 8:43 am

Hi! Just an additional.

"auth-user-pass" is enough for the normal job.
If you are using Windows you should to save the login/pass file to ASCII. Not UTF-8 or other.

It means using the notepad with default settings is a good idea.

Cheers!

freedomClub
OpenVpn Newbie
Posts: 2
Joined: Thu Oct 29, 2015 7:22 am

Re: Saving Username/Password

Post by freedomClub » Thu Oct 29, 2015 7:25 am

On windows the password file (eg. "login.conf") needs to be in:
1. DOS file format
2. Not UTF-8

freedomClub
OpenVpn Newbie
Posts: 2
Joined: Thu Oct 29, 2015 7:22 am

Re: Saving Username/Password

Post by freedomClub » Thu Oct 29, 2015 7:28 am

In windows the passwords file (eg. login.conf) needs to be:
1. DOS file format
2. Not UTF-8

thelimey
OpenVpn Newbie
Posts: 1
Joined: Thu Aug 08, 2013 3:13 pm

Re: Saving Username/Password

Post by thelimey » Tue Feb 16, 2016 6:52 pm

LOL. I had this issue, and eventually worked out it was because I was an idiot....

I forgot that:
1) Windows hides file extensions
2) notepad adds .txt to the file name

So OpenVPN was correct that the file login.conf didn't exist because it was actually named login.conf.txt

I tried with Notepad++ after others said that was the way they got it to work. It saves the file with the name you specify, without adding an extra .txt, that was when I realised what had happened.

joutcast
OpenVpn Newbie
Posts: 2
Joined: Fri Dec 09, 2016 10:32 pm

Re: Saving Username/Password

Post by joutcast » Fri Dec 09, 2016 10:43 pm

Not attempting to be captain obvious here, and please correct me if this is not getting over looked. However, I have not seen anyone specifying to insert the file name at the header of the file.... the only way it works for me is outlined below. This example assumes login.conf is the credentialing file and in the same directory.

In YourConnection.ovpn on auth-usr-pass line:

auth-usr-pass "./login.conf"

In your login.conf file:

login.conf
YourUserName
YourPassword

joutcast
OpenVpn Newbie
Posts: 2
Joined: Fri Dec 09, 2016 10:32 pm

Re: Saving Username/Password

Post by joutcast » Fri Dec 09, 2016 11:27 pm

Sorry it is "auth-user-pass" lol

Post Reply