Page 1 of 1

openvpn doesn't find conf files outside /etc/openvpn

Posted: Sat Feb 27, 2021 1:48 pm
by jhulio
I want to run openvpn as a systemd service.

I downloaded my openvpn configuration files from my VPN provider.

I have one configuration file per VPN server.

I put one of those files inside /etc/openvpn to be recognized my openvpn.

Let's say the file is called /etc/openvpn/server534.conf.

Then I run

Code: Select all

sudo systemctl start openvpn-client@server534
In "server534.conf", I modified this line:

Code: Select all

auth-user-pass
to:

Code: Select all

auth-user-pass /home/myname/vpncredentials.txt
Because in the future I would like to start the service at login without manually inserting username and password.

However, as can be seen by the error logs in "journalctl -xe", the file "/home/myname/vpncredentials.txt" does not exist for openvpn started in this way. A "cat /home/myname/vpncredentials.txt" shows the file correctly.

If I move "vpncredentials.txt" inside /etc/openvpn and modify the configuration file accordingly, it works.

Why openvn does not recognize configuration files outside of /etc/openvpn?

How can I keep my configuration file outside /etc/openvpn?

Re: openvpn doesn't find conf files outside /etc/openvpn

Posted: Sat Feb 27, 2021 3:34 pm
by TinCanTech
You cannot use /home with openvpn and systemd because it is protected. Instead use /etc/openvpn/foo

Re: openvpn doesn't find conf files outside /etc/openvpn

Posted: Sat Feb 27, 2021 4:06 pm
by jhulio
Thanks for your answer.

What does it mean "it is protected"?

What the protection is, how is it called?

Can you point me to bibliographic references to study this protection? :)

Re: openvpn doesn't find conf files outside /etc/openvpn

Posted: Sat Feb 27, 2021 5:34 pm
by TinCanTech
systemd settings