Hi,
As title says, I can run OpenVPN Server manually by executing this:
openvpn --config /etc/openvpn/server/server.conf
But when trying to start it as a service, it crash and doesn't start.
This is
/lib/systemd/system/openvpn-server@.service
[Unit]
Description=OpenVPN service for %i
After=network-online.target
Wants=network-online.target
Documentation=man:openvpn(8)
Documentation=https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage
Documentation=https://community.openvpn.net/openvpn/wiki/HOWTO
[Service]
Type=notify
PrivateTmp=true
WorkingDirectory=/etc/openvpn/server
ExecStart=openvpn --status %t/openvpn-server/status-%i.log --status-version 2 --suppress-timestamps --config %i.conf
CapabilityBoundingSet=CAP_IPC_LOCK CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW CAP_SETGID CAP_SETUID CAP_SYS_CHROOT CAP_DAC_OVERRIDE CAP_AUDIT_WRITE
LimitNPROC=10
DeviceAllow=/dev/null rw
DeviceAllow=/dev/net/tun rw
ProtectSystem=true
ProtectHome=true
KillMode=process
RestartSec=5s
Restart=on-failure
[Install]
WantedBy=multi-user.target
This is
service openvpn-server@server start output
root@vpn1-lynspyre:/etc/openvpn# service openvpn-server@server start
Job for openvpn-server@server.service failed because the control process exited with error code.
See "systemctl status openvpn-server@server.service" and "journalctl -xe" for details.
root@vpn1-lynspyre:/etc/openvpn#
This is
journalctl -xe output
-- A start job for unit openvpn-server@.service.service has begun execution.
--
-- The job identifier is 3395617.
Jun 04 17:37:13 vpn1-lynspyre systemd[225225]: openvpn-server@server.service: F
Jun 04 17:37:13 vpn1-lynspyre systemd[225225]: openvpn-server@server.service: F
-- Subject: Process /usr/sbin/openvpn could not be executed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- The process /usr/sbin/openvpn could not be executed and failed.
--
-- The error number returned by this process is ERRNO.
Jun 04 17:37:13 vpn1-lynspyre systemd[1]: openvpn-server@server.service: Main p
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- An ExecStart= process belonging to unit openvpn-server@server.service has ex
--
-- The process' exit code is 'exited' and its exit status is 226.
Jun 04 17:37:13 vpn1-lynspyre systemd[1]: openvpn-server@server.service: Failed
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- The unit openvpn-server@.service.service has entered the 'failed' state with r
Jun 04 17:37:13 vpn1-lynspyre systemd[1]: Failed to start OpenVPN service for .se
-- Subject: A start job for unit openvpn-server@server.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit openvpn-server@server.service has finished with a failu
--
-- The job identifier is 3395617 and the job result is failed.
This is part of the
/var/log/ when executing the server manually
Thu Jun 4 17:53:43 2020 us=44356 port_share_port = '[UNDEF]'
Thu Jun 4 17:53:43 2020 us=44365 client = DISABLED
Thu Jun 4 17:53:43 2020 us=44374 pull = DISABLED
Thu Jun 4 17:53:43 2020 us=44383 auth_user_pass_file = '[UNDEF]'
Thu Jun 4 17:53:43 2020 us=44394 OpenVPN 2.4.7 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Feb 20 2019
Thu Jun 4 17:53:43 2020 us=44410 library versions: OpenSSL 1.1.1d 10 Sep 2019, LZO 2.10
Thu Jun 4 17:53:43 2020 us=44831 Diffie-Hellman initialized with 2048 bit key
Thu Jun 4 17:53:43 2020 us=45229 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Thu Jun 4 17:53:43 2020 us=45261 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Thu Jun 4 17:53:43 2020 us=45290 TLS-Auth MTU parms [ L:1621 D:1184 EF:66 EB:0 ET:0 EL:3 ]
Thu Jun 4 17:53:43 2020 us=45379 ROUTE_GATEWAY xxx.xx.xx.x
Thu Jun 4 17:53:43 2020 us=45750 TUN/TAP device tun0 opened
Thu Jun 4 17:53:43 2020 us=45806 TUN/TAP TX queue length set to 100
Thu Jun 4 17:53:43 2020 us=45828 do_ifconfig, tt->did_ifconfig_ipv6_setup=0
Thu Jun 4 17:53:43 2020 us=45845 /sbin/ip link set dev tun0 up mtu 1500
Thu Jun 4 17:53:43 2020 us=47546 /sbin/ip addr add dev tun0 local 10.8.0.1 peer 10.8.0.2
Thu Jun 4 17:53:43 2020 us=48829 /sbin/ip route add 10.8.0.0/24 via 10.8.0.2
Thu Jun 4 17:53:43 2020 us=50076 Data Channel MTU parms [ L:1621 D:1450 EF:121 EB:406 ET:0 EL:3 ]
Thu Jun 4 17:53:43 2020 us=50377 Could not determine IPv4/IPv6 protocol. Using AF_INET
Thu Jun 4 17:53:43 2020 us=50408 Socket Buffers: R=[4194304->4194304] S=[4194304->4194304]
Thu Jun 4 17:53:43 2020 us=50428 UDPv4 link local (bound): [AF_INET]xxx.xx.xx.xx:1194
Thu Jun 4 17:53:43 2020 us=50439 UDPv4 link remote: [AF_UNSPEC]
Thu Jun 4 17:53:43 2020 us=50453 GID set to nogroup
Thu Jun 4 17:53:43 2020 us=50467 UID set to nobody
Thu Jun 4 17:53:43 2020 us=50483 MULTI: multi_init called, r=256 v=256
Thu Jun 4 17:53:43 2020 us=50502 IFCONFIG POOL: base=10.8.0.4 size=62, ipv6=0
Thu Jun 4 17:53:43 2020 us=50517 ifconfig_pool_read(), in='lynspyre,10.8.0.4', TODO: IPv6
Thu Jun 4 17:53:43 2020 us=50528 succeeded -> ifconfig_pool_set()
Thu Jun 4 17:53:43 2020 us=50539 IFCONFIG POOL LIST
Thu Jun 4 17:53:43 2020 us=50549 lynspyre,10.8.0.4
Thu Jun 4 17:53:43 2020 us=50587 Initialization Sequence Completed
Hope anyone could help me.
Thanks in advance.