|
158 | 158 | <varlistentry id='lesssecure'> |
159 | 159 | <term><varname>$SYSTEMD_PAGERSECURE</varname></term> |
160 | 160 |
|
161 | | - <listitem><para>Takes a boolean argument. When true, the "secure" mode of the pager is enabled; if |
162 | | - false, disabled. If <varname>$SYSTEMD_PAGERSECURE</varname> is not set at all, secure mode is enabled |
163 | | - if the effective UID is not the same as the owner of the login session, see |
164 | | - <citerefentry project='man-pages'><refentrytitle>geteuid</refentrytitle><manvolnum>2</manvolnum></citerefentry> |
165 | | - and <citerefentry><refentrytitle>sd_pid_get_owner_uid</refentrytitle><manvolnum>3</manvolnum></citerefentry>. |
166 | | - In secure mode, <option>LESSSECURE=1</option> will be set when invoking the pager, and the pager shall |
167 | | - disable commands that open or create new files or start new subprocesses. When |
168 | | - <varname>$SYSTEMD_PAGERSECURE</varname> is not set at all, pagers which are not known to implement |
169 | | - secure mode will not be used. (Currently only |
170 | | - <citerefentry project='man-pages'><refentrytitle>less</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
171 | | - implements secure mode.)</para> |
172 | | - |
173 | | - <para>Note: when commands are invoked with elevated privileges, for example under <citerefentry |
| 161 | + <listitem> |
| 162 | + <para>Common pager commands like <citerefentry |
| 163 | + project='man-pages'><refentrytitle>less</refentrytitle><manvolnum>1</manvolnum></citerefentry>, in |
| 164 | + addition to "paging", i.e. scrolling through the output, support opening of or writing to other files |
| 165 | + and running arbitrary shell commands. When commands are invoked with elevated privileges, for example |
| 166 | + under <citerefentry |
174 | 167 | project='man-pages'><refentrytitle>sudo</refentrytitle><manvolnum>8</manvolnum></citerefentry> or |
175 | 168 | <citerefentry |
176 | | - project='die-net'><refentrytitle>pkexec</refentrytitle><manvolnum>1</manvolnum></citerefentry>, care |
177 | | - must be taken to ensure that unintended interactive features are not enabled. "Secure" mode for the |
178 | | - pager may be enabled automatically as describe above. Setting <varname>SYSTEMD_PAGERSECURE=0</varname> |
179 | | - or not removing it from the inherited environment allows the user to invoke arbitrary commands. Note |
180 | | - that if the <varname>$SYSTEMD_PAGER</varname> or <varname>$PAGER</varname> variables are to be |
181 | | - honoured, <varname>$SYSTEMD_PAGERSECURE</varname> must be set too. It might be reasonable to completely |
182 | | - disable the pager using <option>--no-pager</option> instead.</para></listitem> |
| 169 | + project='die-net'><refentrytitle>pkexec</refentrytitle><manvolnum>1</manvolnum></citerefentry>, the |
| 170 | + pager becomes a security boundary. Care must be taken that only programs with strictly limited |
| 171 | + functionality are used as pagers, and unintended interactive features like opening or creation of new |
| 172 | + files or starting of subprocesses are not allowed. "Secure mode" for the pager may be enabled as |
| 173 | + described below, <emphasis>if the pager supports that</emphasis> (most pagers are not written in a way |
| 174 | + that takes this into consideration). It is recommended to either explicitly enable "secure mode" or to |
| 175 | + completely disable the pager using <option>--no-pager</option> or <varname>PAGER=cat</varname> when |
| 176 | + allowing untrusted users to execute commands with elevated privileges.</para> |
| 177 | + |
| 178 | + <para>This option takes a boolean argument. When set to true, the "secure mode" of the pager is |
| 179 | + enabled. In "secure mode", <option>LESSSECURE=1</option> will be set when invoking the pager, which |
| 180 | + instructs the pager to disable commands that open or create new files or start new subprocesses. |
| 181 | + Currently only <citerefentry |
| 182 | + project='man-pages'><refentrytitle>less</refentrytitle><manvolnum>1</manvolnum></citerefentry> is known |
| 183 | + to understand this variable and implement "secure mode".</para> |
| 184 | + |
| 185 | + <para>When set to false, no limitation is placed on the pager. Setting |
| 186 | + <varname>SYSTEMD_PAGERSECURE=0</varname> or not removing it from the inherited environment may allow |
| 187 | + the user to invoke arbitrary commands.</para> |
| 188 | + |
| 189 | + <para>When <varname>$SYSTEMD_PAGERSECURE</varname> is not set, systemd tools attempt to automatically |
| 190 | + figure out if "secure mode" should be enabled and whether the pager supports it. "Secure mode" is |
| 191 | + enabled if the effective UID is not the same as the owner of the login session, see |
| 192 | + <citerefentry project='man-pages'><refentrytitle>geteuid</refentrytitle><manvolnum>2</manvolnum></citerefentry> |
| 193 | + and |
| 194 | + <citerefentry><refentrytitle>sd_pid_get_owner_uid</refentrytitle><manvolnum>3</manvolnum></citerefentry>. |
| 195 | + In this case, <varname>SYSTEMD_PAGERSECURE=1</varname> will be set and pagers which are not known to |
| 196 | + implement "secure mode" will not be used at all.</para> |
| 197 | + |
| 198 | + <para>Note that if the <varname>$SYSTEMD_PAGER</varname> or <varname>$PAGER</varname> variables are to |
| 199 | + be honoured, <varname>$SYSTEMD_PAGERSECURE</varname> must be set too.</para> |
| 200 | + </listitem> |
183 | 201 | </varlistentry> |
184 | 202 |
|
185 | 203 | <varlistentry id='colors'> |
|
0 commit comments