Page 1 of 1

Where is "openvpn.conf" located?

Posted: Fri Dec 28, 2018 5:34 pm
by Captain Brillo
As per this article https://www.maketecheasier.com/connect- ... lly-linux/

Trying to automate VPN connection and these instructions are giving me a problem:
Open “/etc/openvpn/openvpn.conf” with sudo. Look for a line that contains “auth-user-pass.” It’ll probably be sitting there alone with nothing else on the line. After it, add “auth.txt” on the same line. Save the file and close it.

Create a new file in “/etc/openvpn” called “auth.txt.” On the first line of the file, place your username. Include your password on the second line. There is no need for anything else in the file. Save and close it.
I've tried "storing" the password for every user in "Network Connections" but that doesn't work.
Can't find that conf file, so where is it that I automate this?

Re: Where is "openvpn.conf" located?

Posted: Fri Dec 28, 2018 6:25 pm
by rene
/etc/openvpn/openvpn.conf is actually something you have to create and which is specific for each VPN provider and server and protocol (TCP and UDP) thereof; you can usually download the files (generally named e.g. us-123.foovpn.com.udp1194.ovpn) from the VPN provider; I keep e.g. FooVPN's .opvn files in /etc/openvpn/client/FooVPN and link the one I aim to in fact use as /etc/openvpn/openvpn.conf.

That is however not generally advisable. NetworkManager manages multiple VPN connections nicely: what does not work for you? If you want to map multiple FooVPN usernames onto a single Linux user just create multiple VPN connections, one for each FooVPN username.

So as to use NetworkManager: click network icon in systray -> Network Connections -> + -> Import a saved VPN configuration -> Create -> browse to an .ovpn file as mentioned above as well and as downloaded from FooVPN -> Add e.g. "(username)" to the connection name and fill in the FooVPN username and password -> Save.

Re: Where is "openvpn.conf" located?

Posted: Fri Dec 28, 2018 6:41 pm
by Captain Brillo
Thanks, but that's not the problem; I've put the password there for all users, doesn't help at startup, I'm still asked for the password.

What I'm trying to do is automate openvpn connection at startup without needing to enter any password info.
As the referenced article says, I need to find the file with this in it (look at the link!):
cipher AES-256-CBC
auth SHA512
tls-cipher TLS...
...
nobind
auth-user-pass...
So far I can't find it.

I don't know how to automate this without somebody else's app/program; the article mentioned above shows how to do this, if I can find the right file to edit.

The desired result will be seamless VPN connection at startup.

Re: Where is "openvpn.conf" located?

Posted: Fri Dec 28, 2018 6:50 pm
by Pippin

Code: Select all

auth-user-pass /etc/openvpn/passwordfile
;)

Re: Where is "openvpn.conf" located?

Posted: Fri Dec 28, 2018 7:05 pm
by rene
Captain Brillo wrote:
Fri Dec 28, 2018 6:41 pm
So far I can't find it.
As I spelled out already, you need to create /etc/openvpn/openvpn.conf. The by yourself linked article does so by copying a by the VPN provider provided .ovpn file; I myself suggested to simply link that file. Whichever way, the .ovpn file you should get from your VPN provider.

Re: Where is "openvpn.conf" located?

Posted: Fri Dec 28, 2018 7:05 pm
by Gruppo Sportivo
Try this:

Code: Select all

sudo nano /etc/openvpn/login.conf
Add 2 lines for login and password. Line one is going to be your VPN access login and line two is going to be your password. To save and exit Nano press CTRL -x it will ask you to save it type Y

Set the proper permissions for the conf file:

Code: Select all

sudo chmod 400 /etc/openvpn/login.conf
Create a new config file with your VPN information name.ovpn

Code: Select all

sudo cp name.ovpn /etc/openvpn/name.conf
By adding the new line OpenVPN automatically knows where to grab the password:

Code: Select all

sudo nano /etc/openvpn/name.conf
At the line auth-user-pass add login.conf so it looks exactly like auth-user-pass login.conf

Re: Where is "openvpn.conf" located?

Posted: Fri Dec 28, 2018 7:29 pm
by Captain Brillo
My bad.
And thank you.
I just wasn't getting the "create" part.

Got it now.... :oops: