From 81d23b58e8d4fe0560d70ae4c6009e8f9f25eca2 Mon Sep 17 00:00:00 2001 From: Christian Goeschel Ndjomouo Date: Sat, 4 Apr 2026 00:16:41 -0400 Subject: [PATCH 1/3] shared/pager: add support for more(1) pager in secure mode The more(1) pager (part of util-linux) now supports secure mode, which can be enabled with the PAGERSECURE environment variable. Adding support for more(1) in secure mode serves as an alternative for systems that do not have less installed or for users who prefer it. Commit d2fce960f9cac740 introduced secure mode in more(1) and the new feature is available in version 2.42 of util-linux. Signed-off-by: Christian Goeschel Ndjomouo --- src/shared/pager.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/shared/pager.c b/src/shared/pager.c index 3c89aacab4..61718aeaa6 100644 --- a/src/shared/pager.c +++ b/src/shared/pager.c @@ -206,6 +206,13 @@ void pager_open(PagerFlags flags) { _exit(EXIT_FAILURE); } + /* Some pager implementations support the PAGERSECURE environment variable, e.g. more(1) */ + r = set_unset_env("PAGERSECURE", use_secure_mode ? "1" : NULL, true); + if (r < 0) { + log_error_errno(r, "Failed to adjust environment variable PAGERSECURE: %m"); + _exit(EXIT_FAILURE); + } + if (trust_pager && pager_args) { /* The pager config might be set globally, and we cannot * know if the user adjusted it to be appropriate for the * secure mode. Thus, start the pager specified through @@ -228,8 +235,8 @@ void pager_open(PagerFlags flags) { static const char* pagers[] = { "pager", "less", "more", "(built-in)" }; for (unsigned i = 0; i < ELEMENTSOF(pagers); i++) { - /* Only less (and our trivial fallback) implement secure mode right now. */ - if (use_secure_mode && !STR_IN_SET(pagers[i], "less", "(built-in)")) + /* Only less, more (and our trivial fallback) implement secure mode right now. */ + if (use_secure_mode && !STR_IN_SET(pagers[i], "less", "more", "(built-in)")) continue; r = loop_write(exe_name_pipe[1], pagers[i], strlen(pagers[i]) + 1); From 84e53b8cfcdd0d3fe5810279bdf261e6cd5910f9 Mon Sep 17 00:00:00 2001 From: Christian Goeschel Ndjomouo Date: Sat, 4 Apr 2026 00:29:02 -0400 Subject: [PATCH 2/3] man: document secure mode support for the more(1) pager Signed-off-by: Christian Goeschel Ndjomouo --- man/common-variables.xml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/man/common-variables.xml b/man/common-variables.xml index 0f807b2cde..74463c23d6 100644 --- a/man/common-variables.xml +++ b/man/common-variables.xml @@ -190,11 +190,14 @@ allowing untrusted users to execute commands with elevated privileges. This option takes a boolean argument. When set to true, the "secure mode" of the pager is - enabled. In "secure mode", will be set when invoking the pager, which - instructs the pager to disable commands that open or create new files or start new subprocesses. + enabled. In "secure mode", and will be set + when invoking the pager, which instructs the pager to disable commands that open or create new files or + start new subprocesses. Currently only less1 is known - to understand this variable and implement "secure mode". + project='man-pages'>less1 and + more1 are known + to understand these variables, respectively, and implement "secure mode". When set to false, no limitation is placed on the pager. Setting SYSTEMD_PAGERSECURE=0 or not removing it from the inherited environment may allow From df87d750380425384464a991594706137a528a75 Mon Sep 17 00:00:00 2001 From: Christian Goeschel Ndjomouo Date: Mon, 20 Apr 2026 23:41:12 -0400 Subject: [PATCH 3/3] doc: bump util-linux baseline to v2.42 This baseline bump is mainly to support the secure mode feature in more(1) that has been made available since util-linux v2.42. Signed-off-by: Christian Goeschel Ndjomouo --- README | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README b/README index ddcb863f4a..51a78bd2a1 100644 --- a/README +++ b/README @@ -264,9 +264,9 @@ REQUIREMENTS: During runtime, you need the following additional dependencies: - util-linux >= v2.27.1 required (including but not limited to: mount, - umount, swapon, swapoff, sulogin, - agetty, fsck) + util-linux >= v2.42 required (including but not limited to: mount, + umount, swapon, swapoff, sulogin, + agetty, fsck, more) dbus >= 1.4.0 (strictly speaking optional, but recommended) NOTE: If using dbus < 1.9.18, you should override the default policy directory (--with-dbuspolicydir=/etc/dbus-1/system.d).