# Webmin and OpenVPN help (CentOS 8)



## puma99dk| (Sep 2, 2021)

I have set up a lot of CentOS 6 servers with Webmin and OpenVPN but CentOS 8 is really giving me a headache and everytime I try to google my issue there isn't a general answer there are different answers and this really gives me a headache.

I need to get OpenVPN managed in Webmin on CentOS 8 but only thing that works is through the terminal and this is a no go because it need to easy to manage.

I have disabled SELinux and firewalld because they are not needed here (Firewalld is disabled because the server is behind a router).

I have tried several guides, even tried how I do on the older CentOS 6 but everytime I try to start OpenVPN through Webmin I receive this error: Command Execution Error systemctl start openvpn@%s.

It doesn't matter what name I give the VPN even if I follow a guide that doesn't come into this issue I do everytime.

I would love if someone could help me out since I am not the biggest linux guy more Windows.


----------



## Solaris17 (Sep 2, 2021)

thats not enough info what do the logs say? what does journalctl -xe say?


----------



## puma99dk| (Sep 2, 2021)

Solaris17 said:


> thats not enough info what do the logs say? what does journalctl -xe say?



Right now I am on a fresh install and created everything through Webmin-->Servers-->OpenVPN + CA

I didn't get an errors in the creation process but when I hit start I get this error: Command Execution Error systemctl start openvpn@%s.

And if I do journalctl -xe:


Spoiler



Sep 02 10:05:29 localhost.localdomain systemd[1]: openvpn-server@server.service: Service RestartSec=5s expired, scheduling restart.
Sep 02 10:05:29 localhost.localdomain systemd[1]: openvpn-server@server.service: Scheduled restart job, restart counter is at 144.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Automatic restarting of the unit openvpn-server@server.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Sep 02 10:05:29 localhost.localdomain systemd[1]: Stopped OpenVPN service for server.
-- Subject: Unit openvpn-server@server.service has finished shutting down
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit openvpn-server@server.service has finished shutting down.
Sep 02 10:05:29 localhost.localdomain openvpn[33129]: Options error: --dh fails with 'dh2048.pem': No such file or directory (errno=2)
Sep 02 10:05:29 localhost.localdomain openvpn[33129]: Options error: --ca fails with 'ca.crt': No such file or directory (errno=2)
Sep 02 10:05:29 localhost.localdomain openvpn[33129]: Options error: --cert fails with 'server.crt': No such file or directory (errno=2)
Sep 02 10:05:29 localhost.localdomain openvpn[33129]: WARNING: cannot stat file 'server.key': No such file or directory (errno=2)
Sep 02 10:05:29 localhost.localdomain openvpn[33129]: Options error: --key fails with 'server.key': No such file or directory (errno=2)
Sep 02 10:05:29 localhost.localdomain openvpn[33129]: WARNING: cannot stat file 'ta.key': No such file or directory (errno=2)
Sep 02 10:05:29 localhost.localdomain openvpn[33129]: Options error: --tls-auth fails with 'ta.key': No such file or directory (errno=2)
Sep 02 10:05:29 localhost.localdomain openvpn[33129]: Options error: Please correct these errors.
Sep 02 10:05:29 localhost.localdomain openvpn[33129]: Use --help for more information.
Sep 02 10:05:29 localhost.localdomain systemd[1]: Starting OpenVPN service for server...
-- Subject: Unit openvpn-server@server.service has begun start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit openvpn-server@server.service has begun starting up.
Sep 02 10:05:29 localhost.localdomain systemd[1]: openvpn-server@server.service: Main process exited, code=exited, status=1/FAILURE
Sep 02 10:05:29 localhost.localdomain systemd[1]: openvpn-server@server.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- The unit openvpn-server@server.service has entered the 'failed' state with result 'exit-code'.
Sep 02 10:05:29 localhost.localdomain systemd[1]: Failed to start OpenVPN service for server.
-- Subject: Unit openvpn-server@server.service has failed
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit openvpn-server@server.service has failed.
--
-- The result is failed.



It's annoying because when I check with File Manager I see all the contain in the keys folder:


----------



## Solaris17 (Sep 2, 2021)

```
Sep 02 10:05:29 localhost.localdomain openvpn[33129]: Options error: --dh fails with 'dh2048.pem': No such file or directory (errno=2)
Sep 02 10:05:29 localhost.localdomain openvpn[33129]: Options error: --ca fails with 'ca.crt': No such file or directory (errno=2)
Sep 02 10:05:29 localhost.localdomain openvpn[33129]: Options error: --cert fails with 'server.crt': No such file or directory (errno=2)
Sep 02 10:05:29 localhost.localdomain openvpn[33129]: WARNING: cannot stat file 'server.key': No such file or directory (errno=2)
Sep 02 10:05:29 localhost.localdomain openvpn[33129]: Options error: --key fails with 'server.key': No such file or directory (errno=2)
Sep 02 10:05:29 localhost.localdomain openvpn[33129]: WARNING: cannot stat file 'ta.key': No such file or directory (errno=2)
Sep 02 10:05:29 localhost.localdomain openvpn[33129]: Options error: --tls-auth fails with 'ta.key': No such file or directory (errno=2)
```

That is the issue. OpenVPN is trying to get the files from the wrong location.

You need to take the path of the files from the screen shot above and make sure they are in the openvpn config which is Something like:



> /etc/openvpn/client.conf



once you find the openVPN file edit it and make sure the paths match what webmin says above.

Alternatively if you want this issue not to come back between version upgrades, you can move all the files to the path openVPN expects.


----------



## puma99dk| (Sep 2, 2021)

Solaris17 said:


> ```
> Sep 02 10:05:29 localhost.localdomain openvpn[33129]: Options error: --dh fails with 'dh2048.pem': No such file or directory (errno=2)
> Sep 02 10:05:29 localhost.localdomain openvpn[33129]: Options error: --ca fails with 'ca.crt': No such file or directory (errno=2)
> Sep 02 10:05:29 localhost.localdomain openvpn[33129]: Options error: --cert fails with 'server.crt': No such file or directory (errno=2)
> ...



I tried adding the full path but then the openvpn module in webmin cannot see any files.

The weirdest part is this is made in the openvpn module for webmin and when I check the config file everything is where it's suppose to be.

So is this really just a CentOS 8 issue?


----------



## Solaris17 (Sep 2, 2021)

puma99dk| said:


> So is this really just a CentOS 8 issue?



Nope, Cent doesnt make webmin or openVPN

This isnt openVPN either because it is expecting the path.

This is a webmin problem.

It looks like you havent tried enough, but if you have tried everything you are willing too then this will remain broken as expected.

Here are results based on your -xe



			Options error: --dh fails with 'dh2048.pem': No such file or directory (errno=2) - Google Search


----------



## puma99dk| (Sep 3, 2021)

Solaris17 said:


> Nope, Cent doesnt make webmin or openVPN
> 
> This isnt openVPN either because it is expecting the path.
> 
> ...



I looked in the WorkingDirectory in openvpn-server@.service file in systemd:




and this points to WorkingDirectory=/etc/openvpn/server but webmin puts it in /etc/openvpn/servers


----------

