Browse code

documentation: avoid recommending --user nobody

Recommend to create an user dedicated to openvpn
so that there is no priviledge escalation between
different services using that user.

cf. https://wiki.ubuntu.com/nobody

Trac: #1335
CC: tincantech <tincantech@protonmail.com>
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20221129144731.35105-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25573.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>

Frank Lichtenheld authored on 2022/11/29 23:47:31
Showing 6 changed files
... ...
@@ -294,7 +294,7 @@ which mode OpenVPN is configured as.
294 294
 --persist-key
295 295
   Don't re-read key files across :code:`SIGUSR1` or ``--ping-restart``.
296 296
 
297
-  This option can be combined with ``--user nobody`` to allow restarts
297
+  This option can be combined with ``--user`` to allow restarts
298 298
   triggered by the :code:`SIGUSR1` signal. Normally if you drop root
299 299
   privileges in OpenVPN, the daemon cannot be restarted since it will now
300 300
   be unable to re-read protected key files.
... ...
@@ -491,7 +491,7 @@ which mode OpenVPN is configured as.
491 491
   able to gain control of an OpenVPN session. Though OpenVPN's security
492 492
   features make this unlikely, it is provided as a second line of defense.
493 493
 
494
-  By setting ``user`` to :code:`nobody` or somebody similarly unprivileged,
494
+  By setting ``user`` to an unprivileged user dedicated to run openvpn,
495 495
   the hostile party would be limited in what damage they could cause. Of
496 496
   course once you take away privileges, you cannot return them to an
497 497
   OpenVPN session. This means, for example, that if you want to reset an
... ...
@@ -501,5 +501,10 @@ which mode OpenVPN is configured as.
501 501
   operations in order to restart (such as re-reading key files or running
502 502
   ``ifconfig`` on the TUN device).
503 503
 
504
+  NOTE: Previous versions of openvpn used :code:`nobody` as the example
505
+  unpriviledged user. It is not recommended to actually use that user
506
+  since it is usually used by other system services already. Always
507
+  create a dedicated user for openvpn.
508
+
504 509
 --writepid file
505 510
   Write OpenVPN's main process ID to ``file``.
... ...
@@ -58,8 +58,8 @@ resolv-retry infinite
58 58
 nobind
59 59
 
60 60
 # Downgrade privileges after initialization (non-Windows only)
61
-;user nobody
62
-;group nobody
61
+;user openvpn
62
+;group openvpn
63 63
 
64 64
 # Try to preserve some state across restarts.
65 65
 persist-key
... ...
@@ -269,10 +269,10 @@ cipher AES-256-CBC
269 269
 # It's a good idea to reduce the OpenVPN
270 270
 # daemon's privileges after initialization.
271 271
 #
272
-# You can uncomment this out on
273
-# non-Windows systems.
274
-;user nobody
275
-;group nobody
272
+# You can uncomment this on non-Windows
273
+# systems after creating a dedicated user.
274
+;user openvpn
275
+;group openvpn
276 276
 
277 277
 # The persist options will try to avoid
278 278
 # accessing certain resources on restart
... ...
@@ -47,11 +47,11 @@ cipher AES-256-GCM
47 47
 # for local and remote.
48 48
 ; port 1194
49 49
 
50
-# Downgrade UID and GID to
51
-# "nobody" after initialization
50
+# Downgrade UID and GID to an
51
+# unpriviledged user after initialization
52 52
 # for extra security.
53
-; user nobody
54
-; group nobody
53
+; user openvpn
54
+; group openvpn
55 55
 
56 56
 # If you built OpenVPN with
57 57
 # LZO compression, uncomment
... ...
@@ -50,11 +50,11 @@ cipher AES-256-GCM
50 50
 # for local and remote.
51 51
 ; port 1194
52 52
 
53
-# Downgrade UID and GID to
54
-# "nobody" after initialization
53
+# Downgrade UID and GID to an
54
+# unpriviledged user after initialization
55 55
 # for extra security.
56
-; user nobody
57
-; group nobody
56
+; user openvpn
57
+; group openvpn
58 58
 
59 59
 # If you built OpenVPN with
60 60
 # LZO compression, uncomment
... ...
@@ -2020,7 +2020,7 @@ do_close_tun(struct context *c, bool force)
2020 2020
         }
2021 2021
 
2022 2022
         /* Run the down script -- note that it will run at reduced
2023
-         * privilege if, for example, "--user nobody" was used. */
2023
+         * privilege if, for example, "--user" was used. */
2024 2024
         run_up_down(c->options.down_script,
2025 2025
                     c->plugins,
2026 2026
                     OPENVPN_PLUGIN_DOWN,