OpenVPN / OpenVPN/openvpn

FreeBSD, DCO and --user non-root

Open
#748 2 comments 0 reactions 1 assignee View on GitHub

@cron2 is already working on this.

Since May 20, 2025.

DCO enhancement FreeBSD
Dominant language
C
Stars
14.6k
Forks
3.4k
PR merge metrics
No merged PRs in 30d

Description

Trying to run on FreeBSD with DCO enabled, and using --user nobody leads to

2025-05-20 09:57:00 DCO device tun7 opened
2025-05-20 09:57:00 ovpn-dco device [tun7] opened
...
2025-05-20 09:57:00 UID set to nobody
...
2025-05-20 09:57:00 Failed to poll for packets: Operation not permitted (errno=1)
2025-05-20 09:57:00 Failed to poll for packets: Operation not permitted (errno=1)
2025-05-20 09:57:16 Failed to poll for packets: Operation not permitted (errno=1)
2025-05-20 09:57:31 Failed to poll for packets: Operation not permitted (errno=1)

or, if the tun7 interface was precreated ("ifconfig tun7 create")

2025-05-20 09:57:59 Failed to create interface tun7 (SIOCSIFNAME): File exists (errno=17)
2025-05-20 09:57:59 dco_set_ifmode: failed to set ifmode=00008010: Invalid argument (errno=22)
2025-05-20 09:57:59 DCO device tun7 already exists, won't be destroyed at shutdown
2025-05-20 09:57:59 ovpn-dco device [tun7] opened
2025-05-20 09:57:59 /sbin/ifconfig tun7 10.194.2.250 10.194.2.249 mtu 1500 netmask 255.255.255.255 up
2025-05-20 09:57:59 /sbin/ifconfig tun7 inet6 fd00:abcd:194:2::103d/64 mtu 1500 up
2025-05-20 09:57:59 ../distro/dns-scripts/dns-updown
2025-05-20 09:57:59 dns up command exited with status 0
2025-05-20 09:57:59 /sbin/route add -net 10.194.0.0 10.194.2.249 255.255.0.0
add net 10.194.0.0: gateway 10.194.2.249
2025-05-20 09:57:59 /sbin/route add -net 10.194.2.1 10.194.2.249 255.255.255.255
add net 10.194.2.1: gateway 10.194.2.249
2025-05-20 09:57:59 Failed to create new peer: Invalid argument (errno=22)
2025-05-20 09:57:59 Exiting due to fatal error

... so "it just does not work". With --disable-dco it uses the tun/tap interface, which works.

So I think we need a check --user <nonroot> set? -> disable dco (for FreeBSD only, Linux DCO with capabilities works)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.