0

I configure OpenVPN on my VPS (Fedora 23) and I have an issue with starting it as systemd service. From command line (openvpn server.conf) all works fine, but when I try start it via systemd it fails.

systemctl status [email protected] show me this:

[email protected] - OpenVPN Robust And Highly Flexible Tunneling Application On myvps/tcp
  Loaded: loaded (/usr/lib/systemd/system/[email protected]; enabled; vendor preset: disabled)
  Active: failed (Result: exit-code) since Thu 2015-12-10 06:04:07 UTC; 13min ago
Main PID: 500 (code=exited, status=1/FAILURE)

Dec 10 06:04:07 myvps openvpn[500]: ROUTE: default_gateway=UNDEF
Dec 10 06:04:07 myvps openvpn[500]: TUN/TAP device tun0 opened
Dec 10 06:04:07 myvps openvpn[500]: TUN/TAP TX queue length set to 100
Dec 10 06:04:07 myvps openvpn[500]: do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Dec 10 06:04:07 myvps openvpn[500]: /usr/local/sbin/unpriv-ip link set dev tun0 up mtu 1500
Dec 10 06:04:07 myvps openvpn[500]: Linux ip link set failed: could not execute external program
Dec 10 06:04:07 myvps openvpn[500]: Exiting due to fatal error
Dec 10 06:04:07 myvps systemd[1]: [email protected]: Main process exited, code=exited, status=1/FAILURE
Dec 10 06:04:07 myvps systemd[1]: [email protected]: Unit entered failed state.
Dec 10 06:04:07 myvps systemd[1]: [email protected]: Failed with result 'exit-code'.

I see that OpenVPN can't execute ip command, but I don't see why. When I start OpenVPN manually I don't get this error.

The unpriv-ip script is set up as described in official howto.

The OpenVPN service start after network.target and wanted by multi-user.target, if it matters.

Can someone explain me what is the problem?

Thank you.

UPD (for Anubioz)

# dnf install iproute
Last metadata expiration check performed 1:27:44 ago on Thu Dec 10 05:52:27 2015.
Package iproute-4.1.1-3.fc23.x86_64 is already installed, skipping.
Dependencies resolved.
Nothing to do.
Complete!

# ls -l /usr/local/sbin/unpriv-ip 
-rwxr-xr-x. 1 root root 27 Dec 10 01:23 /usr/local/sbin/unpriv-ip

UPD2 (for Anubioz)

# dnf install iputils
Last metadata expiration check performed 1:42:05 ago on Thu Dec 10 05:52:27 2015.
Package iputils-20140519-7.fc23.x86_64 is already installed, skipping.
Dependencies resolved.
Nothing to do.
Complete!

1 Answer 1

0
  1. Check that /usr/local/sbin/unpriv-ip script has execute permissions (+x chmod flag)

You can set it with the following command

chmod +x /usr/local/sbin/unpriv-ip

  1. Check that your openvpn config has the script-security 2 line to allow execution of external scripts.

  2. Make sure you got iproute package installed and the ip command availible on your system.

You can install it with:

yum install iproute iputils

  1. Try adding sleep 5 to the top of your /usr/local/sbin/unpriv-ip script to make sure it won't be executed before tun0 device is availible.
13
  • Of course, the script has execute permissions and iproute is installed. Otherwise I think OpenVPN would fails even I start it manually.
    – shau-kote
    Dec 10, 2015 at 7:23
  • Yeah, that's true, I edited the answer
    – Anubioz
    Dec 10, 2015 at 7:33
  • No, both packages are already installed.
    – shau-kote
    Dec 10, 2015 at 7:37
  • And ip commad is availible, of course.
    – shau-kote
    Dec 10, 2015 at 7:39
  • Do you have script-security 2 in your config? Does the /usr/local/sbin/unpriv-ip link set dev tun0 up mtu 1500 work when run from command line as a opevpn user? Can you paste the contents somewhere?
    – Anubioz
    Dec 10, 2015 at 7:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .