Debian Codegraph @

po/ru/man7/user_namespaces.7.po

raw
1 # Russian translation of manpages
2 # This file is distributed under the same license as the manpages-l10n package.
3 # Copyright © of this file:
4 # Azamat Hackimov <[email protected]>, 2013, 2016.
5 # Dmitriy Ovchinnikov <[email protected]>, 2012.
6 # Dmitry Bolkhovskikh <[email protected]>, 2017.
7 # Katrin Kutepova <[email protected]>, 2018.
8 # Yuri Kozlov <[email protected]>, 2011-2019.
9 # Иван Павлов <[email protected]>, 2017.
10 msgid ""
11 msgstr ""
12 "Project-Id-Version: manpages-l10n\n"
13 "POT-Creation-Date: 2026-06-05 06:50+0200\n"
14 "PO-Revision-Date: 2024-12-21 19:50+0300\n"
15 "Last-Translator: Yuri Kozlov <[email protected]>\n"
16 "Language-Team: Russian <[email protected]>\n"
17 "Language: ru\n"
18 "MIME-Version: 1.0\n"
19 "Content-Type: text/plain; charset=UTF-8\n"
20 "Content-Transfer-Encoding: 8bit\n"
21 "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
22 "n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || "
23 "(n%100>=11 && n%100<=14)? 2 : 3);\n"
24 "X-Generator: Lokalize 2.0\n"
25
26 #. type: TH
27 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
28 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
29 #, fuzzy, no-wrap
30 #| msgid "See B<user_namespaces>(7)."
31 msgid "user_namespaces"
32 msgstr "См. B<user_namespaces>(7)."
33
34 #. type: TH
35 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
36 #: opensuse-tumbleweed
37 #, no-wrap
38 msgid "2026-02-08"
39 msgstr "8 февраля 2026 г."
40
41 #. type: TH
42 #: archlinux debian-unstable
43 #, fuzzy, no-wrap
44 #| msgid "Linux man-pages 6.17"
45 msgid "Linux man-pages 6.18"
46 msgstr "Справочные страницы Linux 6.17"
47
48 #. type: SH
49 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
50 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
51 #, no-wrap
52 msgid "NAME"
53 msgstr "НАИМЕНОВАНИЕ"
54
55 #. type: Plain text
56 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
57 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
58 msgid "user_namespaces - overview of Linux user namespaces"
59 msgstr "user_namespaces - обзор пользовательских пространств имён Linux"
60
61 #. type: SH
62 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
63 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
64 #, no-wrap
65 msgid "DESCRIPTION"
66 msgstr "ОПИСАНИЕ"
67
68 #. type: Plain text
69 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
70 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
71 msgid "For an overview of namespaces, see B<namespaces>(7)."
72 msgstr "Обзор пространств имён смотрите в B<namespaces>(7)."
73
74 #. #-#-#-#-# archlinux: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
75 #. FIXME: This page says very little about the interaction
76 #. of user namespaces and keys. Add something on this topic.
77 #. ============================================================
78 #. type: Plain text
79 #. #-#-#-#-# debian-trixie: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
80 #. FIXME: This page says very little about the interaction
81 #. of user namespaces and keys. Add something on this topic.
82 #. ============================================================
83 #. type: Plain text
84 #. #-#-#-#-# debian-unstable: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
85 #. FIXME: This page says very little about the interaction
86 #. of user namespaces and keys. Add something on this topic.
87 #. ============================================================
88 #. type: Plain text
89 #. #-#-#-#-# fedora-44: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
90 #. FIXME: This page says very little about the interaction
91 #. of user namespaces and keys. Add something on this topic.
92 #. ============================================================
93 #. type: Plain text
94 #. #-#-#-#-# fedora-rawhide: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
95 #. FIXME: This page says very little about the interaction
96 #. of user namespaces and keys. Add something on this topic.
97 #. ============================================================
98 #. type: Plain text
99 #. #-#-#-#-# mageia-cauldron: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
100 #. FIXME: This page says very little about the interaction
101 #. of user namespaces and keys. Add something on this topic.
102 #. ============================================================
103 #. type: Plain text
104 #. #-#-#-#-# opensuse-leap-16-1: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
105 #. FIXME: This page says very little about the interaction
106 #. of user namespaces and keys. Add something on this topic.
107 #. ============================================================
108 #. type: Plain text
109 #. #-#-#-#-# opensuse-tumbleweed: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
110 #. FIXME: This page says very little about the interaction
111 #. of user namespaces and keys. Add something on this topic.
112 #. ============================================================
113 #. type: Plain text
114 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
115 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
116 msgid ""
117 "User namespaces isolate security-related identifiers and attributes, in "
118 "particular, user IDs and group IDs (see B<credentials>(7)), the root "
119 "directory, keys (see B<keyrings>(7)), and capabilities (see "
120 "B<capabilities>(7)). A process's user and group IDs can be different inside "
121 "and outside a user namespace. In particular, a process can have a normal "
122 "unprivileged user ID outside a user namespace while at the same time having "
123 "a user ID of 0 inside the namespace; in other words, the process has full "
124 "privileges for operations inside the user namespace, but is unprivileged for "
125 "operations outside the namespace."
126 msgstr ""
127 "Пользовательские пространства имён изолируют идентификаторы и атрибуты "
128 "безопасности, в частности ID пользователя и ID группы (смотрите "
129 "B<credentials>(7)), корневой каталог, ключи (смотрите B<keyrings>(7)) и "
130 "мандаты (смотрите B<capabilities>(7)). Идентификаторы пользователя и группы "
131 "процесса могут отличаться внутри и снаружи пользовательского пространства "
132 "имён. В частности, процесс может иметь обычный бесправный пользовательский "
133 "ID снаружи и ID равный 0 внутри пространства имён; другими словами, процесс "
134 "имеет доступ ко всем операциям внутри пользовательского пространства имён, "
135 "но не имеет доступа к привилегированным операциям вне пространства имён."
136
137 #. type: SS
138 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
139 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
140 #, no-wrap
141 msgid "Nested namespaces, namespace membership"
142 msgstr "Вложенные пространства имён, членство пространств имён"
143
144 #. type: Plain text
145 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
146 #: opensuse-tumbleweed
147 #, fuzzy
148 #| msgid ""
149 #| "User namespaces can be nested; that is, each user namespace\\(emexcept "
150 #| "the initial (\"root\") namespace\\(emhas a parent user namespace, and "
151 #| "can have zero or more child user namespaces. The parent user namespace "
152 #| "is the user namespace of the process that creates the user namespace via "
153 #| "a call to B<unshare>(2) or B<clone>(2) with the B<CLONE_NEWUSER> flag."
154 msgid ""
155 "User namespaces can be nested; that is, each user namespace \\[em]except the "
156 "initial (\"root\") namespace\\[em] has a parent user namespace, and can have "
157 "zero or more child user namespaces. The parent user namespace is the user "
158 "namespace of the process that creates the user namespace via a call to "
159 "B<unshare>(2) or B<clone>(2) with the B<CLONE_NEWUSER> flag."
160 msgstr ""
161 "Пользовательские пространства имён могут быть вложенными, то есть каждое "
162 "пользовательское пространство имён — за исключением первого («корневого») — "
163 "имеет родительское пространство имён и может иметь ноль или более дочерних "
164 "пространств имён. Родительское пространство имён — это пользовательское "
165 "пространство имён процесса, которое создаётся с помощью вызова B<unshare>(2) "
166 "или B<clone>(2) с флагом B<CLONE_NEWUSER>."
167
168 #. commit 8742f229b635bf1c1c84a3dfe5e47c814c20b5c8
169 #. FIXME Explain the rationale for this limit. (What is the rationale?)
170 #. type: Plain text
171 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
172 #: opensuse-tumbleweed
173 #, fuzzy
174 #| msgid ""
175 #| "The kernel imposes (since version 3.11) a limit of 32 nested levels of "
176 #| "user namespaces. Calls to B<unshare>(2) or B<clone>(2) that would "
177 #| "cause this limit to be exceeded fail with the error B<EUSERS>."
178 msgid ""
179 "The kernel imposes (since Linux 3.11) a limit of 32 nested levels of user "
180 "namespaces. Calls to B<unshare>(2) or B<clone>(2) that would cause this "
181 "limit to be exceeded fail with the error B<EUSERS>."
182 msgstr ""
183 "Ядро ограничивает (начиная с версии 3.11) глубину вложенности "
184 "пользовательских пространств имён 32 уровнями. Вызовы B<unshare>(2) или "
185 "B<clone>(2), которые бы превысили это ограничение, завершаются с ошибкой "
186 "B<EUSERS>."
187
188 #. type: Plain text
189 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
190 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
191 msgid ""
192 "Each process is a member of exactly one user namespace. A process created "
193 "via B<fork>(2) or B<clone>(2) without the B<CLONE_NEWUSER> flag is a "
194 "member of the same user namespace as its parent. A single-threaded process "
195 "can join another user namespace with B<setns>(2) if it has the "
196 "B<CAP_SYS_ADMIN> in that namespace; upon doing so, it gains a full set of "
197 "capabilities in that namespace."
198 msgstr ""
199 "Каждый процесс является членом только одного пользовательского пространства "
200 "имён. Процесс, созданный с помощью B<fork>(2) или B<clone>(2) без флага "
201 "B<CLONE_NEWUSER>, является членом того же пользовательского пространства "
202 "имён что и его родитель. Однонитевой процесс может перейти в другое "
203 "пользовательское пространство имён с помощью B<setns>(2), если в этом "
204 "пространстве у него есть мандат B<CAP_SYS_ADMIN>; после перехода он получает "
205 "полный набор мандатов в этом пространстве имён."
206
207 #. type: Plain text
208 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
209 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
210 msgid ""
211 "A call to B<clone>(2) or B<unshare>(2) with the B<CLONE_NEWUSER> flag "
212 "makes the new child process (for B<clone>(2)) or the caller (for "
213 "B<unshare>(2)) a member of the new user namespace created by the call."
214 msgstr ""
215 "Вызов B<clone>(2) или B<unshare>(2) с флагом B<CLONE_NEWUSER> делает новый "
216 "дочерний (для B<clone>(2)) или вызвавший (для B<unshare>(2)) процесс членом "
217 "нового пользовательского пространства имён, создаваемого вызовом."
218
219 #. type: Plain text
220 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
221 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
222 #, fuzzy
223 #| msgid ""
224 #| "The B<NS_GET_PARENT> B<ioctl>(2) operation can be used to discover the "
225 #| "parental relationship between user namespaces; see B<ioctl_ns>(2)."
226 msgid ""
227 "The B<NS_GET_PARENT> B<ioctl>(2) operation can be used to discover the "
228 "parental relationship between user namespaces; see B<ioctl_nsfs>(2)."
229 msgstr ""
230 "Операцию B<NS_GET_PARENT> B<ioctl>(2) можно использовать для обнаружения "
231 "родительской связи между пространствами имён пользователя; смотрите "
232 "B<ioctl_ns>(2)."
233
234 #
235 #. ============================================================
236 #. type: Plain text
237 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
238 #: opensuse-tumbleweed
239 msgid ""
240 "A task that changes one of its effective IDs will have its dumpability reset "
241 "to the value in I</proc/sys/fs/suid_dumpable>. This may affect the "
242 "ownership of proc files of child processes and may thus cause the parent to "
243 "lack the permissions to write to mapping files of child processes running in "
244 "a new user namespace. In such cases, making the parent process dumpable, "
245 "using B<PR_SET_DUMPABLE> in a call to B<prctl>(2), before creating a child "
246 "process in a new user namespace may rectify this problem. See B<prctl>(2) "
247 "and B<proc>(5) for details on how ownership is affected."
248 msgstr ""
249
250 #. type: SS
251 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
252 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
253 #, no-wrap
254 msgid "Capabilities"
255 msgstr "Мандаты"
256
257 #. type: Plain text
258 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
259 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
260 msgid ""
261 "The child process created by B<clone>(2) with the B<CLONE_NEWUSER> flag "
262 "starts out with a complete set of capabilities in the new user namespace. "
263 "Likewise, a process that creates a new user namespace using B<unshare>(2) "
264 "or joins an existing user namespace using B<setns>(2) gains a full set of "
265 "capabilities in that namespace. On the other hand, that process has no "
266 "capabilities in the parent (in the case of B<clone>(2)) or previous (in the "
267 "case of B<unshare>(2) and B<setns>(2)) user namespace, even if the new "
268 "namespace is created or joined by the root user (i.e., a process with user "
269 "ID 0 in the root namespace)."
270 msgstr ""
271 "Дочерний процесс, созданный B<clone>(2) с флагом B<CLONE_NEWUSER>, "
272 "запускается в новом пользовательском пространстве имён с полным набором "
273 "мандатов. Аналогично, процесс, создающий новое пользовательское пространство "
274 "имён с помощью B<unshare>(2) или переходящий в существующее пользовательское "
275 "пространство имён с помощью B<setns>(2), получает полный набор мандатов в "
276 "этом пространстве имён. С другой стороны, этот процесс не имеет мандатов в "
277 "родительском (в случае B<clone>(2)) или предыдущем (в случае B<unshare>(2) и "
278 "B<setns>(2)) пользовательском пространстве имён, даже если новое "
279 "пространство имён создано или переход осуществлялся суперпользователем (т. "
280 "е., процесс с ID пользователя 0 в корневом пространстве имён)."
281
282 #. type: Plain text
283 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
284 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
285 msgid ""
286 "Note that a call to B<execve>(2) will cause a process's capabilities to be "
287 "recalculated in the usual way (see B<capabilities>(7)). Consequently, "
288 "unless the process has a user ID of 0 within the namespace, or the "
289 "executable file has a nonempty inheritable capabilities mask, the process "
290 "will lose all capabilities. See the discussion of user and group ID "
291 "mappings, below."
292 msgstr ""
293 "Заметим, что вызов B<execve>(2) приводит к пересчёту мандатов процесса "
294 "обычным порядком (смотрите B<capabilities>(7)). Следовательно, если ID "
295 "пользователя процесс не равно 0 внутри пространства имён или исполняемый "
296 "файл имеет непустую маску наследования мандатов, то процесс теряет все "
297 "мандаты. Смотрите описание отображения пользовательских и групповых ID далее."
298
299 #. type: Plain text
300 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
301 #: opensuse-tumbleweed
302 #, fuzzy
303 #| msgid ""
304 #| "A call to B<clone>(2), B<unshare>(2), or B<setns>(2) using the "
305 #| "B<CLONE_NEWUSER> flag sets the \"securebits\" flags (see "
306 #| "B<capabilities>(7)) to their default values (all flags disabled) in the "
307 #| "child (for B<clone>(2)) or caller (for B<unshare>(2), or B<setns>(2)). "
308 #| "Note that because the caller no longer has capabilities in its original "
309 #| "user namespace after a call to B<setns>(2), it is not possible for a "
310 #| "process to reset its \"securebits\" flags while retaining its user "
311 #| "namespace membership by using a pair of B<setns>(2) calls to move to "
312 #| "another user namespace and then return to its original user namespace."
313 msgid ""
314 "A call to B<clone>(2) or B<unshare>(2) using the B<CLONE_NEWUSER> flag or "
315 "a call to B<setns>(2) that moves the caller into another user namespace "
316 "sets the \"securebits\" flags (see B<capabilities>(7)) to their default "
317 "values (all flags disabled) in the child (for B<clone>(2)) or caller (for "
318 "B<unshare>(2) or B<setns>(2)). Note that because the caller no longer has "
319 "capabilities in its original user namespace after a call to B<setns>(2), it "
320 "is not possible for a process to reset its \"securebits\" flags while "
321 "retaining its user namespace membership by using a pair of B<setns>(2) "
322 "calls to move to another user namespace and then return to its original user "
323 "namespace."
324 msgstr ""
325 "Вызов B<clone>(2), B<unshare>(2) или B<setns>(2) с флагом B<CLONE_NEWUSER> "
326 "устанавливает флаги «securebits» (смотрите B<capabilities>(7)) в их значения "
327 "по умолчанию (все флаги сброшены) в потомке (для B<clone>(2)) или вызывающем "
328 "(для B<unshare>(2) или B<setns>(2)). Заметим, что из-то того, что вызывающий "
329 "больше не имеет мандатов в своём первоначальном пользовательском "
330 "пространстве имён после вызова B<setns>(2), невозможно у процесса сбросить "
331 "его флаги «securebits», хотя удержать своё членство в пользовательском "
332 "пространстве имён можно с помощью пары вызовов B<setns>(2) — сначала "
333 "переместиться в другое пользовательское пространство имён и затем вернуться "
334 "в своё первоначальное пользовательское пространство имён."
335
336 #. type: Plain text
337 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
338 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
339 msgid ""
340 "The rules for determining whether or not a process has a capability in a "
341 "particular user namespace are as follows:"
342 msgstr ""
343 "Правила определения наличия мандата у процесса в определённом "
344 "пользовательском пространстве имён следующие:"
345
346 #. type: IP
347 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
348 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
349 #, no-wrap
350 msgid "\\[bu]"
351 msgstr "\\[bu]"
352
353 #. In the 3.8 sources, see security/commoncap.c::cap_capable():
354 #. type: Plain text
355 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
356 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
357 msgid ""
358 "A process has a capability inside a user namespace if it is a member of that "
359 "namespace and it has the capability in its effective capability set. A "
360 "process can gain capabilities in its effective capability set in various "
361 "ways. For example, it may execute a set-user-ID program or an executable "
362 "with associated file capabilities. In addition, a process may gain "
363 "capabilities via the effect of B<clone>(2), B<unshare>(2), or B<setns>(2), "
364 "as already described."
365 msgstr ""
366 "Процесс имеет мандат внутри пользовательского пространства имён, если он "
367 "является членом этого пространства имён и имеет мандат в своём наборе "
368 "эффективных мандатов. Процесс может получить мандаты в своём наборе "
369 "эффективных мандатов различными способами. Например, он может запустить "
370 "программу с битом set-user-ID или исполняемый файл, имеющий мандаты файла. "
371 "Также процесс может получить мандаты при выполнении B<clone>(2), "
372 "B<unshare>(2) или B<setns>(2), как описывалось ранее."
373
374 #. type: Plain text
375 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
376 #: opensuse-tumbleweed
377 #, fuzzy
378 #| msgid ""
379 #| "If a process has a capability in a user namespace, then it has that "
380 #| "capability in all child (and further removed descendant) namespaces as "
381 #| "well."
382 msgid ""
383 "If a process has a capability in a user namespace, then it has that "
384 "capability in all child (and further removed descendant) namespaces as well."
385 msgstr ""
386 "Если процесс имеет мандат в пользовательском пространстве имён, то он также "
387 "имеет этот мандат во всех дочерних (и позже удалённых потомках) "
388 "пространствах имён."
389
390 #. * The owner of the user namespace in the parent of the
391 #. * user namespace has all caps.
392 #. (and likewise associates the effective group ID of the creating process
393 #. with the namespace).
394 #. See kernel commit 520d9eabce18edfef76a60b7b839d54facafe1f9 for a fix
395 #. on this point
396 #. This includes the case where the process executes a set-user-ID
397 #. program that confers the effective UID of the creator of the namespace.
398 #. ============================================================
399 #. type: Plain text
400 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
401 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
402 #, fuzzy
403 #| msgid ""
404 #| "When a user namespace is created, the kernel records the effective user "
405 #| "ID of the creating process as being the \"owner\" of the namespace. A "
406 #| "process that resides in the parent of the user namespace and whose "
407 #| "effective user ID matches the owner of the namespace has all capabilities "
408 #| "in the namespace. By virtue of the previous rule, this means that the "
409 #| "process has all capabilities in all further removed descendant user "
410 #| "namespaces as well. The B<NS_GET_OWNER_UID> B<ioctl>(2) operation can "
411 #| "be used to discover the user ID of the owner of the namespace; see "
412 #| "B<ioctl_ns>(2)."
413 msgid ""
414 "When a user namespace is created, the kernel records the effective user ID "
415 "of the creating process as being the \"owner\" of the namespace. A process "
416 "that resides in the parent of the user namespace and whose effective user ID "
417 "matches the owner of the namespace has all capabilities in the namespace. "
418 "By virtue of the previous rule, this means that the process has all "
419 "capabilities in all further removed descendant user namespaces as well. The "
420 "B<NS_GET_OWNER_UID> B<ioctl>(2) operation can be used to discover the user "
421 "ID of the owner of the namespace; see B<ioctl_nsfs>(2)."
422 msgstr ""
423 "При создании пользовательского пространства имён ядро записывает эффективный "
424 "пользовательский ID создающего процесса как «владельца» пространства имён. "
425 "Процесс, располагающийся в родительском пространстве имён пользовательского "
426 "пространства имён и чей эффективный пользовательский ID совпадает с "
427 "владельцем пространства имён, имеет все мандаты в пространстве имён. "
428 "Предыдущее правило означает, что у процесса также есть все мандаты во всех в "
429 "последствии удалённых потомках пользовательских пространств имён. Для "
430 "обнаружения идентификатора пользователя-владельца пространства имён можно "
431 "использовать операцию B<NS_GET_OWNER_UID> вызова B<ioctl>(2); смотрите "
432 "B<ioctl_ns>(2)."
433
434 #. type: SS
435 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
436 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
437 #, no-wrap
438 msgid "Effect of capabilities within a user namespace"
439 msgstr "Влияние мандатов внутри пространства имён пользователя"
440
441 #. type: Plain text
442 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
443 #: opensuse-tumbleweed
444 #, fuzzy
445 #| msgid ""
446 #| "Having a capability inside a user namespace permits a process to perform "
447 #| "operations (that require privilege) only on resources governed by that "
448 #| "namespace. In other words, having a capability in a user namespace "
449 #| "permits a process to perform privileged operations on resources that are "
450 #| "governed by (nonuser) namespaces owned by (associated with) the user "
451 #| "namespace (see the next subsection)."
452 msgid ""
453 "Having a capability inside a user namespace permits a process to perform "
454 "operations (that require privilege) only on resources governed by that "
455 "namespace. In other words, having a capability in a user namespace permits "
456 "a process to perform privileged operations on resources that are governed by "
457 "(nonuser) namespaces owned by (associated with) the user namespace (see the "
458 "next subsection)."
459 msgstr ""
460 "Наличие мандата внутри пространства имён пользователя разрешает процессу "
461 "выполнять операции (требующие привилегий) с ресурсами, управляемыми только "
462 "этим пространством имён. Иначе говоря, наличие мандата в пользовательском "
463 "пространстве имён разрешает процессу выполнять привилегированные операции с "
464 "ресурсами, которые управляются (не пользовательскими) пространствами имён, "
465 "принадлежащими (связанными с) пространству имён пользователя (смотрите "
466 "следующий подраздел)."
467
468 #. type: Plain text
469 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
470 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
471 #, fuzzy
472 #| msgid ""
473 #| "On the other hand, there are many privileged operations that affect "
474 #| "resources that are not associated with any namespace type, for example, "
475 #| "changing the system time (governed by B<CAP_SYS_TIME>), loading a kernel "
476 #| "module (governed by B<CAP_SYS_MODULE>), and creating a device (governed "
477 #| "by B<CAP_MKNOD>). Only a process with privileges in the I<initial> user "
478 #| "namespace can perform such operations."
479 msgid ""
480 "On the other hand, there are many privileged operations that affect "
481 "resources that are not associated with any namespace type, for example, "
482 "changing the system (i.e., calendar) time (governed by B<CAP_SYS_TIME>), "
483 "loading a kernel module (governed by B<CAP_SYS_MODULE>), and creating a "
484 "device (governed by B<CAP_MKNOD>). Only a process with privileges in the "
485 "I<initial> user namespace can perform such operations."
486 msgstr ""
487 "С другой стороны, существует много привилегированных операций, которые "
488 "влияют на ресурсы не связанные с каким-либо типом пространства имён, "
489 "например, изменение системного времени (регулируется B<CAP_SYS_TIME>), "
490 "загрузка модуля ядра (регулируется B<CAP_SYS_MODULE>) и создание устройства "
491 "(регулируется B<CAP_MKNOD>). Такие операции может выполнять только процесс с "
492 "привилегиями в I<начальном> пользовательском пространстве имён."
493
494 #. fs_flags = FS_USERNS_MOUNT in kernel sources
495 #. type: Plain text
496 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
497 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
498 msgid ""
499 "Holding B<CAP_SYS_ADMIN> within the user namespace that owns a process's "
500 "mount namespace allows that process to create bind mounts and mount the "
501 "following types of filesystems:"
502 msgstr ""
503 "Наличие B<CAP_SYS_ADMIN> внутри пользовательского пространства имён, "
504 "принадлежащему пространству имён монтирования процесса, позволяет этому "
505 "процессу создавать привязки монтирования и монтировать следующие типы "
506 "файловых систем:"
507
508 #. type: Plain text
509 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
510 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
511 msgid "I</proc> (since Linux 3.8)"
512 msgstr "I</proc> (начиная с Linux 3.8)"
513
514 #. type: Plain text
515 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
516 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
517 msgid "I</sys> (since Linux 3.8)"
518 msgstr "I</sys> (начиная с Linux 3.8)"
519
520 #. type: Plain text
521 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
522 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
523 msgid "I<devpts> (since Linux 3.9)"
524 msgstr "I<devpts> (начиная с Linux 3.9)"
525
526 #. type: Plain text
527 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
528 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
529 msgid "B<tmpfs>(5) (since Linux 3.9)"
530 msgstr "B<tmpfs>(5) (начиная с Linux 3.9)"
531
532 #. type: Plain text
533 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
534 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
535 msgid "I<ramfs> (since Linux 3.9)"
536 msgstr "I<ramfs> (начиная с Linux 3.9)"
537
538 #. type: Plain text
539 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
540 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
541 msgid "I<mqueue> (since Linux 3.9)"
542 msgstr "I<mqueue> (начиная с Linux 3.9)"
543
544 #. commit b2197755b2633e164a439682fb05a9b5ea48f706
545 #. type: Plain text
546 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
547 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
548 msgid "I<bpf> (since Linux 4.4)"
549 msgstr "I<bpf> (начиная с Linux 4.4)"
550
551 #. commit 92dbc9dedccb9759c7f9f2f0ae6242396376988f
552 #. commit 4cb2c00c43b3fe88b32f29df4f76da1b92c33224
553 #. type: Plain text
554 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
555 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
556 msgid "I<overlayfs> (since Linux 5.11)"
557 msgstr "I<overlayfs> (начиная с Linux 5.11)"
558
559 #. type: Plain text
560 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
561 #: opensuse-leap-16-1 opensuse-tumbleweed
562 #, fuzzy
563 #| msgid ""
564 #| "Holding B<CAP_SYS_ADMIN> within the user namespace that owns a process's "
565 #| "cgroup namespace allows (since Linux 4.6) that process to the mount the "
566 #| "cgroup version 2 filesystem and cgroup version 1 named hierarchies (i.e., "
567 #| "cgroup filesystems mounted with the I<\"none,name=\"> option)."
568 msgid ""
569 "Holding B<CAP_SYS_ADMIN> within the user namespace that owns a process's "
570 "cgroup namespace allows (since Linux 4.6) that process to mount the cgroup "
571 "version 2 filesystem and cgroup version 1 named hierarchies (i.e., cgroup "
572 "filesystems mounted with the I<\\[dq]none,name=\\[dq]> option)."
573 msgstr ""
574 "Наличие B<CAP_SYS_ADMIN> внутри пользовательского пространства имён, "
575 "принадлежащему пространству имён cgroup процесса, позволяет (начиная с Linux "
576 "4.6) этому процессу монтировать именованные иерархии файловой системы cgroup "
577 "версии 2 и cgroup версии 1 (т. е., файловые системы cgroup, монтируемые с "
578 "параметром I<\"none,name=\">)."
579
580 #. type: Plain text
581 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
582 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
583 msgid ""
584 "Holding B<CAP_SYS_ADMIN> within the user namespace that owns a process's PID "
585 "namespace allows (since Linux 3.8) that process to mount I</proc> "
586 "filesystems."
587 msgstr ""
588 "Наличие B<CAP_SYS_ADMIN> внутри пользовательского пространства имён, "
589 "принадлежащему пространству имён PID процесса, позволяет (начиная с Linux "
590 "3.8) этому процессу монтировать файловые системы I</proc>."
591
592 #. ============================================================
593 #. type: Plain text
594 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
595 #: opensuse-tumbleweed
596 #, fuzzy
597 #| msgid ""
598 #| "Note, however, that mounting block-based filesystems can be done only by "
599 #| "a process that holds B<CAP_SYS_ADMIN> in the initial user namespace."
600 msgid ""
601 "However, mounting block-based filesystems can be done only by a process that "
602 "holds B<CAP_SYS_ADMIN> in the initial user namespace."
603 msgstr ""
604 "Однако заметим, что монтирование блочных файловых систем может производиться "
605 "только процессом, имеющим B<CAP_SYS_ADMIN> в начальном пространстве имён "
606 "пользователя."
607
608 #. type: SS
609 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
610 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
611 #, no-wrap
612 msgid "Interaction of user namespaces and other types of namespaces"
613 msgstr "Взаимодействие между пользовательскими и другими типами пространств имён"
614
615 #. type: Plain text
616 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
617 #: opensuse-leap-16-1 opensuse-tumbleweed
618 #, fuzzy
619 #| msgid ""
620 #| "Starting in Linux 3.8, unprivileged processes can create user namespaces, "
621 #| "and the other types of namespaces can be created with just the "
622 #| "B<CAP_SYS_ADMIN> capability in the caller's user namespace."
623 msgid ""
624 "Since Linux 3.8, unprivileged processes can create user namespaces, and the "
625 "other types of namespaces can be created with just the B<CAP_SYS_ADMIN> "
626 "capability in the caller's user namespace."
627 msgstr ""
628 "Начиная с Linux 3.8, непривилегированные процессы могут создавать "
629 "пользовательские пространства имён, а для создания пространств имён других "
630 "типов требуется мандат B<CAP_SYS_ADMIN> в пользовательском пространстве имён "
631 "вызывающего."
632
633 #. type: Plain text
634 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
635 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
636 msgid ""
637 "When a nonuser namespace is created, it is owned by the user namespace in "
638 "which the creating process was a member at the time of the creation of the "
639 "namespace. Privileged operations on resources governed by the nonuser "
640 "namespace require that the process has the necessary capabilities in the "
641 "user namespace that owns the nonuser namespace."
642 msgstr ""
643 "После создания не пользовательского пространства имён оно принадлежит "
644 "пользовательскому пространству имён, в котором на момент создания "
645 "пространства имён создающий процесс являлся членом. Для привилегированных "
646 "операций над ресурсами, управляемыми не пользовательским пространством имён, "
647 "от процесса требуется иметь мандаты в пользовательском пространстве имён, "
648 "которому принадлежит не пользовательское пространство имён."
649
650 #. type: Plain text
651 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
652 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
653 msgid ""
654 "If B<CLONE_NEWUSER> is specified along with other B<CLONE_NEW*> flags in a "
655 "single B<clone>(2) or B<unshare>(2) call, the user namespace is guaranteed "
656 "to be created first, giving the child (B<clone>(2)) or caller "
657 "(B<unshare>(2)) privileges over the remaining namespaces created by the "
658 "call. Thus, it is possible for an unprivileged caller to specify this "
659 "combination of flags."
660 msgstr ""
661 "Если вместе с флагами B<CLONE_NEW*> указан флаг B<CLONE_NEWUSER> в вызове "
662 "B<clone>(2) или B<unshare>(2), то пользовательское пространство имён "
663 "гарантированно создаётся первым, давая потомку (B<clone>(2)) или вызывающему "
664 "(B<unshare>(2)) права на остальные пространства имён, создаваемые вызовом. "
665 "Даже бесправный вызывающий может задать такую комбинацию флагов."
666
667 #. type: Plain text
668 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
669 #: opensuse-tumbleweed
670 #, fuzzy
671 #| msgid ""
672 #| "When a new namespace (other than a user namespace) is created via "
673 #| "B<clone>(2) or B<unshare>(2), the kernel records the user namespace of "
674 #| "the creating process as the owner of the new namespace. (This "
675 #| "association can't be changed.) When a process in the new namespace "
676 #| "subsequently performs privileged operations that operate on global "
677 #| "resources isolated by the namespace, the permission checks are performed "
678 #| "according to the process's capabilities in the user namespace that the "
679 #| "kernel associated with the new namespace. For example, suppose that a "
680 #| "process attempts to change the hostname (B<sethostname>(2)), a resource "
681 #| "governed by the UTS namespace. In this case, the kernel will determine "
682 #| "which user namespace owns the process's UTS namespace, and check whether "
683 #| "the process has the required capability (B<CAP_SYS_ADMIN>) in that user "
684 #| "namespace."
685 msgid ""
686 "When a new namespace (other than a user namespace) is created via "
687 "B<clone>(2) or B<unshare>(2), the kernel records the user namespace of the "
688 "creating process as the owner of the new namespace. (This association can't "
689 "be changed.) When a process in the new namespace subsequently performs "
690 "privileged operations that operate on global resources isolated by the "
691 "namespace, the permission checks are performed according to the process's "
692 "capabilities in the user namespace that the kernel associated with the new "
693 "namespace. For example, suppose that a process attempts to change the "
694 "hostname (B<sethostname>(2)), a resource governed by the UTS namespace. In "
695 "this case, the kernel will determine which user namespace owns the process's "
696 "UTS namespace, and check whether the process has the required capability "
697 "(B<CAP_SYS_ADMIN>) in that user namespace."
698 msgstr ""
699 "При создании нового пространства имён (не пользовательского пространства "
700 "имён) посредством B<clone>(2) или B<unshare>(2), ядро записывает "
701 "пользовательское пространство имён создающего процесса как владельца нового "
702 "пространства имён (эту связь нельзя изменить). Когда процесс в новом "
703 "пространстве имён в дальнейшем выполняет привилегированные операции, которые "
704 "работают с глобальными ресурсами, изолированными пространством имён, "
705 "выполняется проверка прав согласно мандатам процесса в пользовательском "
706 "пространстве имён, которое ядро связало с новым пространством имён. "
707 "Например, предположим, что процесс пытается изменить имя узла "
708 "(B<sethostname>(2)) — ресурс, управляемый пространство имён UTS. В этом "
709 "случае, ядро будет искать пространство имён пользователя, принадлежащее "
710 "пространству имён UTS процесса, и проверять что процесс имеет необходимый "
711 "мандат (B<CAP_SYS_ADMIN>) в этом пространстве имён пользователя."
712
713 #. ============================================================
714 #. type: Plain text
715 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
716 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
717 #, fuzzy
718 #| msgid ""
719 #| "The B<NS_GET_USERNS> B<ioctl>(2) operation can be used to discover the "
720 #| "user namespace that owns a nonuser namespace; see B<ioctl_ns>(2)."
721 msgid ""
722 "The B<NS_GET_USERNS> B<ioctl>(2) operation can be used to discover the user "
723 "namespace that owns a nonuser namespace; see B<ioctl_nsfs>(2)."
724 msgstr ""
725 "Операцию B<NS_GET_USERNS> B<ioctl>(2) можно использовать для обнаружения "
726 "пространства имён пользователя, которое владеет не пользовательским "
727 "пространством имён; смотрите B<ioctl_ns>(2)."
728
729 #. type: SS
730 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
731 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
732 #, no-wrap
733 msgid "User and group ID mappings: uid_map and gid_map"
734 msgstr "Отображение идентификаторов пользователей и групп: uid_map и gid_map"
735
736 #. commit 22d917d80e842829d0ca0a561967d728eb1d6303
737 #. type: Plain text
738 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
739 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
740 msgid ""
741 "When a user namespace is created, it starts out without a mapping of user "
742 "IDs (group IDs) to the parent user namespace. The I</proc/>pidI</uid_map> "
743 "and I</proc/>pidI</gid_map> files (available since Linux 3.5) expose the "
744 "mappings for user and group IDs inside the user namespace for the process "
745 "I<pid>. These files can be read to view the mappings in a user namespace "
746 "and written to (once) to define the mappings."
747 msgstr ""
748 "В новом созданном пользовательском пространстве имён отсутствует отображение "
749 "пользовательских ID (ID групп) в родительское пользовательское пространство. "
750 "Файл I</proc/>pidI</uid_map> и I</proc/>pidI</gid_map> (доступны начиная с "
751 "Linux 3.5) предоставляют отображения пользовательских и групповых ID внутри "
752 "пользовательского пространства имён для процесса I<pid>. Эти файлы можно "
753 "читать для просмотра отображений в пользовательском пространстве имён и "
754 "писать (однократно) для определения отображений."
755
756 #. type: Plain text
757 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
758 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
759 msgid ""
760 "The description in the following paragraphs explains the details for "
761 "I<uid_map>; I<gid_map> is exactly the same, but each instance of \"user ID\" "
762 "is replaced by \"group ID\"."
763 msgstr ""
764 "В следующих параграфах объясняется формат I<uid_map>; I<gid_map> имеет тот "
765 "же формат, но каждый экземпляр «ID пользователя» заменяется на «ID группы»."
766
767 #. type: Plain text
768 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
769 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
770 msgid ""
771 "The I<uid_map> file exposes the mapping of user IDs from the user namespace "
772 "of the process I<pid> to the user namespace of the process that opened "
773 "I<uid_map> (but see a qualification to this point below). In other words, "
774 "processes that are in different user namespaces will potentially see "
775 "different values when reading from a particular I<uid_map> file, depending "
776 "on the user ID mappings for the user namespaces of the reading processes."
777 msgstr ""
778 "Файл I<uid_map> предоставляет отображение пользовательских ID из "
779 "пользовательского пространства имён процесса I<pid> в пользовательское "
780 "пространство имён процесса, который открыл I<uid_map> (но смотрите уточнение "
781 "далее). Другими словами, процессы, которые находятся в разных "
782 "пользовательских пространствах имён, возможно будут видеть разные значения "
783 "при чтении соответствующего файла I<uid_map>, в зависимости от отображений "
784 "пользовательских ID у пользовательских пространств имён читающего процесса."
785
786 #. type: Plain text
787 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
788 #: opensuse-leap-16-1 opensuse-tumbleweed
789 #, fuzzy
790 #| msgid ""
791 #| "Each line in the I<uid_map> file specifies a 1-to-1 mapping of a range of "
792 #| "contiguous user IDs between two user namespaces. (When a user namespace "
793 #| "is first created, this file is empty.) The specification in each line "
794 #| "takes the form of three numbers delimited by white space. The first two "
795 #| "numbers specify the starting user ID in each of the two user namespaces. "
796 #| "The third number specifies the length of the mapped range. In detail, "
797 #| "the fields are interpreted as follows:"
798 msgid ""
799 "Each line in the I<uid_map> file specifies a 1-to-1 mapping of a range of "
800 "contiguous user IDs between two user namespaces. (When a user namespace is "
801 "first created, this file is empty.) The specification in each line takes "
802 "the form of three numbers delimited by white space. The first two numbers "
803 "specify the starting user ID in each of the two user namespaces. The third "
804 "number specifies the size of the mapped range. In detail, the fields are "
805 "interpreted as follows:"
806 msgstr ""
807 "Каждая строка в файле I<uid_map> определяет отображение 1-в-1 непрерывного "
808 "диапазона пользовательских ID между двумя пользовательскими пространствами "
809 "имён (при создании пользовательского пространства имён этот файл пуст). В "
810 "каждой строке содержится три числа через пробел. Первые два числа определяют "
811 "начальный пользовательский ID в каждом из двух пользовательских пространств "
812 "имён. Третье число определяет длину отображаемого диапазона. Эти поля "
813 "рассматриваются так:"
814
815 #. type: IP
816 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
817 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
818 #, no-wrap
819 msgid "(1)"
820 msgstr "(1)"
821
822 #. type: Plain text
823 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
824 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
825 msgid ""
826 "The start of the range of user IDs in the user namespace of the process "
827 "I<pid>."
828 msgstr ""
829 "Начало диапазона пользовательских ID в пользовательском пространстве имён "
830 "процесса I<pid>."
831
832 #. type: IP
833 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
834 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
835 #, no-wrap
836 msgid "(2)"
837 msgstr "(2)"
838
839 #. type: Plain text
840 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
841 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
842 msgid ""
843 "The start of the range of user IDs to which the user IDs specified by field "
844 "one map. How field two is interpreted depends on whether the process that "
845 "opened I<uid_map> and the process I<pid> are in the same user namespace, as "
846 "follows:"
847 msgstr ""
848 "Начало диапазона пользовательских ID, на который отображаются "
849 "пользовательские ID, указанные в первом поле. Интерпретация второго поля "
850 "зависит от того, находится ли процесс, открывший I<uid_map>, и процесс "
851 "I<pid>, в одном пользовательском пространстве имён:"
852
853 #. type: IP
854 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
855 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
856 #, no-wrap
857 msgid "(a)"
858 msgstr "(а)"
859
860 #. type: Plain text
861 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
862 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
863 msgid ""
864 "If the two processes are in different user namespaces: field two is the "
865 "start of a range of user IDs in the user namespace of the process that "
866 "opened I<uid_map>."
867 msgstr ""
868 "Если два процесса находятся в разных пользовательских пространствах имён: "
869 "поле два — начало диапазона пользовательских ID в пользовательском "
870 "пространстве имён процесса, который открыл I<uid_map>."
871
872 #. type: IP
873 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
874 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
875 #, no-wrap
876 msgid "(b)"
877 msgstr "(б)"
878
879 #. type: Plain text
880 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
881 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
882 msgid ""
883 "If the two processes are in the same user namespace: field two is the start "
884 "of the range of user IDs in the parent user namespace of the process "
885 "I<pid>. This case enables the opener of I<uid_map> (the common case here is "
886 "opening I</proc/self/uid_map>) to see the mapping of user IDs into the user "
887 "namespace of the process that created this user namespace."
888 msgstr ""
889 "Если два процесса находятся в одном пользовательском пространстве имён: поле "
890 "два — начало диапазона пользовательских ID в родительском пользовательском "
891 "пространстве имён процесса I<pid>. Это позволяет открывшему I<uid_map> "
892 "(обычно открывают I</proc/self/uid_map>) видеть отображение пользовательских "
893 "ID в пользовательском пространстве имён процесса, создавшего это "
894 "пользовательское пространство имён."
895
896 #. type: IP
897 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
898 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
899 #, no-wrap
900 msgid "(3)"
901 msgstr "(3)"
902
903 #. type: Plain text
904 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
905 #: opensuse-leap-16-1 opensuse-tumbleweed
906 #, fuzzy
907 #| msgid ""
908 #| "The length of the range of user IDs that is mapped between the two user "
909 #| "namespaces."
910 msgid ""
911 "The size of the range of user IDs that is mapped between the two user "
912 "namespaces."
913 msgstr ""
914 "Длина диапазона пользовательских ID, выполняющего отображение между двумя "
915 "пользовательскими пространствами имён."
916
917 #. type: Plain text
918 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
919 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
920 #, fuzzy
921 #| msgid ""
922 #| "System calls that return user IDs (group IDs)\\(emfor example, "
923 #| "B<getuid>(2), B<getgid>(2), and the credential fields in the structure "
924 #| "returned by B<stat>(2)\\(emreturn the user ID (group ID) mapped into the "
925 #| "caller's user namespace."
926 msgid ""
927 "System calls that return user IDs (group IDs)\\[em]for example, "
928 "B<getuid>(2), B<getgid>(2), and the credential fields in the structure "
929 "returned by B<stat>(2)\\[em]return the user ID (group ID) mapped into the "
930 "caller's user namespace."
931 msgstr ""
932 "Системные вызовы, возвращающие пользовательские ID (ID групп), например, "
933 "B<getuid>(2), B<getgid>(2), и мандатные поля в структуре, возвращаемой "
934 "B<stat>(2), возвращают пользовательский ID (ID группы), отображённый в "
935 "пользовательском пространстве имён вызывающего."
936
937 #. type: Plain text
938 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
939 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
940 msgid ""
941 "When a process accesses a file, its user and group IDs are mapped into the "
942 "initial user namespace for the purpose of permission checking and assigning "
943 "IDs when creating a file. When a process retrieves file user and group IDs "
944 "via B<stat>(2), the IDs are mapped in the opposite direction, to produce "
945 "values relative to the process user and group ID mappings."
946 msgstr ""
947 "Когда процесс обращается к файлу, его ID пользователя и группы отображаются "
948 "в начальном пользовательском пространстве имён с целью проверки прав доступа "
949 "и назначенного ID при создании файла. Когда процесс получает ID пользователя "
950 "и группы файла через B<stat>(2), то ID отображаются в обратном направлении, "
951 "для создания значений, относительно отображений ID пользователя и группы "
952 "процесса."
953
954 #. type: Plain text
955 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
956 #: opensuse-tumbleweed
957 #, fuzzy
958 #| msgid ""
959 #| "The initial user namespace has no parent namespace, but, for consistency, "
960 #| "the kernel provides dummy user and group ID mapping files for this "
961 #| "namespace. Looking at the I<uid_map> file (I<gid_map> is the same) from "
962 #| "a shell in the initial namespace shows:"
963 msgid ""
964 "The initial user namespace has no parent namespace, but, for consistency, "
965 "the kernel provides dummy user and group ID mapping files for this "
966 "namespace. Looking at the I<uid_map> file (I<gid_map> is the same) from a "
967 "shell in the initial namespace shows:"
968 msgstr ""
969 "Начальное пользовательское пространство имён не имеет родительского "
970 "пространства имён, но для однородности, для него ядро предоставляет "
971 "фиктивные файлы отображения ID пользователей и групп. Посмотрим на файл "
972 "I<uid_map> (в I<gid_map> тоже самое) из оболочки в начальном пространстве "
973 "имён:"
974
975 #. type: Plain text
976 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
977 #: opensuse-tumbleweed
978 #, fuzzy, no-wrap
979 #| msgid ""
980 #| "$ B<cat /proc/$$/uid_map>\n"
981 #| " 0 0 4294967295\n"
982 msgid ""
983 "$B< cat /proc/$$/uid_map>;\n"
984 " 0 0 4294967295\n"
985 msgstr ""
986 "$ B<cat /proc/$$/uid_map>\n"
987 " 0 0 4294967295\n"
988
989 #. ============================================================
990 #. type: Plain text
991 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
992 #: opensuse-leap-16-1 opensuse-tumbleweed
993 #, fuzzy
994 #| msgid ""
995 #| "This mapping tells us that the range starting at user ID 0 in this "
996 #| "namespace maps to a range starting at 0 in the (nonexistent) parent "
997 #| "namespace, and the length of the range is the largest 32-bit unsigned "
998 #| "integer. This leaves 4294967295 (the 32-bit signed -1 value) unmapped. "
999 #| "This is deliberate: I<(uid_t)\\~-1> is used in several interfaces (e.g., "
1000 #| "B<setreuid>(2)) as a way to specify \"no user ID\". Leaving I<(uid_t)"
1001 #| "\\~-1> unmapped and unusable guarantees that there will be no confusion "
1002 #| "when using these interfaces."
1003 msgid ""
1004 "This mapping tells us that the range starting at user ID 0 in this namespace "
1005 "maps to a range starting at 0 in the (nonexistent) parent namespace, and the "
1006 "size of the range is the largest 32-bit unsigned integer. This leaves "
1007 "4294967295 (the 32-bit signed -1 value) unmapped. This is deliberate: "
1008 "I<(uid_t)\\ -1> is used in several interfaces (e.g., B<setreuid>(2)) as a "
1009 "way to specify \"no user ID\". Leaving I<(uid_t)\\ -1> unmapped and "
1010 "unusable guarantees that there will be no confusion when using these "
1011 "interfaces."
1012 msgstr ""
1013 "Данное отображение показывает, что диапазон начинающийся с пользовательского "
1014 "ID 0 в этом пространстве имён, отображается в диапазон, начинающийся, с 0, в "
1015 "(несуществующее) родительское пространство имён, и длина диапазона равна "
1016 "самому большому 32-битному беззнаковому целому. Значение 4294967295 (32-"
1017 "битное знаковое значение -1) оставлено без отображения. Предназначение: "
1018 "I<(uid_t)\\~-\\1> используется в некоторых интерфейсах (например, "
1019 "B<setreuid>(2)) для указания «отсутствия ID пользователя». Оставление "
1020 "I<(uid_t)\\~-\\1> без отображения и его не использование гарантирует, что "
1021 "при использовании этих интерфейсов не будет проблем)."
1022
1023 #. type: SS
1024 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1025 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1026 #, no-wrap
1027 msgid "Defining user and group ID mappings: writing to uid_map and gid_map"
1028 msgstr "Отображение идентификаторов пользователей и групп: запись в uid_map и gid_map"
1029
1030 #. type: Plain text
1031 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1032 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1033 msgid ""
1034 "After the creation of a new user namespace, the I<uid_map> file of I<one> of "
1035 "the processes in the namespace may be written to I<once> to define the "
1036 "mapping of user IDs in the new user namespace. An attempt to write more "
1037 "than once to a I<uid_map> file in a user namespace fails with the error "
1038 "B<EPERM>. Similar rules apply for I<gid_map> files."
1039 msgstr ""
1040 "После создания нового пользовательского пространства имён в файл I<uid_map> "
1041 "I<один> из процессов в пространстве имён может выполнить I<однократную> "
1042 "запись для определения отображения пользовательских ID в новом "
1043 "пользовательском пространстве имён. Повторная попытка записи в файл "
1044 "I<uid_map> в пользовательском пространстве имён завершится с ошибкой "
1045 "B<EPERM>. Эти же правила применимы к файлам I<gid_map>."
1046
1047 #. type: Plain text
1048 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1049 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1050 #, fuzzy
1051 #| msgid ""
1052 #| "The lines written to I<uid_map> (I<gid_map>) must conform to the "
1053 #| "following rules:"
1054 msgid ""
1055 "The lines written to I<uid_map> (I<gid_map>) must conform to the following "
1056 "validity rules:"
1057 msgstr ""
1058 "Записываемые в I<uid_map> (I<gid_map>) строки должны соответствовать "
1059 "следующим правилам:"
1060
1061 #. type: Plain text
1062 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1063 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1064 msgid ""
1065 "The three fields must be valid numbers, and the last field must be greater "
1066 "than 0."
1067 msgstr ""
1068 "В трёх полях должны быть корректные числа и последнее поле должно быть "
1069 "больше 0."
1070
1071 #. type: Plain text
1072 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1073 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1074 msgid "Lines are terminated by newline characters."
1075 msgstr "Строки заканчиваются символами новой строки."
1076
1077 #. 5*12-byte records could fit in a 64B cache line
1078 #. commit 6397fac4915ab3002dc15aae751455da1a852f25
1079 #. type: Plain text
1080 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1081 #: opensuse-tumbleweed
1082 #, fuzzy
1083 #| msgid ""
1084 #| "There is a limit on the number of lines in the file. In Linux 4.14 and "
1085 #| "earlier, this limit was (arbitrarily) set at 5 lines. Since Linux 4.15, "
1086 #| "the limit is 340 lines. In addition, the number of bytes written to the "
1087 #| "file must be less than the system page size, and the write must be "
1088 #| "performed at the start of the file (i.e., B<lseek>(2) and B<pwrite>(2) "
1089 #| "can't be used to write to nonzero offsets in the file)."
1090 msgid ""
1091 "There is a limit on the number of lines in the file. Up to Linux 4.14, this "
1092 "limit was (arbitrarily) set at 5 lines. Since Linux 4.16, the limit is 340 "
1093 "lines. In addition, the number of bytes written to the file must be less "
1094 "than the system page size, and the write must be performed at the start of "
1095 "the file (i.e., B<lseek>(2) and B<pwrite>(2) can't be used to write to "
1096 "nonzero offsets in the file)."
1097 msgstr ""
1098 "Существует ограничение на количество строк в файле. В Linux 4.14 и старее "
1099 "оно установлено (произвольно) равным пятью строкам. Начиная с Linux 4.14 его "
1100 "значение равно 340 строкам. Также, количество байт, записываемых в файл, "
1101 "должно быть меньше размера системной страницы, и запись должна выполняться в "
1102 "начало файла (т. е., нельзя использовать B<lseek>(2) и B<pwrite>(2) для "
1103 "записи в файл при ненулевом смещении)."
1104
1105 #. commit 0bd14b4fd72afd5df41e9fd59f356740f22fceba
1106 #. type: Plain text
1107 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1108 #: opensuse-tumbleweed
1109 #, fuzzy
1110 #| msgid ""
1111 #| "The range of user IDs (group IDs) specified in each line cannot overlap "
1112 #| "with the ranges in any other lines. In the initial implementation (Linux "
1113 #| "3.8), this requirement was satisfied by a simplistic implementation that "
1114 #| "imposed the further requirement that the values in both field 1 and field "
1115 #| "2 of successive lines must be in ascending numerical order, which "
1116 #| "prevented some otherwise valid maps from being created. Linux 3.9 and "
1117 #| "later fix this limitation, allowing any valid set of nonoverlapping maps."
1118 msgid ""
1119 "The range of user IDs (group IDs) specified in each line cannot overlap "
1120 "with the ranges in any other lines. In the initial implementation (Linux "
1121 "3.8), this requirement was satisfied by a simplistic implementation that "
1122 "imposed the further requirement that the values in both field 1 and field 2 "
1123 "of successive lines must be in ascending numerical order, which prevented "
1124 "some otherwise valid maps from being created. Since Linux 3.9, this "
1125 "limitation has been removed, allowing any valid set of nonoverlapping maps."
1126 msgstr ""
1127 "Диапазон пользовательских ID (групповых ID), указанный в каждой строке, не "
1128 "должен перекрываться с диапазонами в других строках. В первой реализации "
1129 "(Linux 3.8) это требование удовлетворялось простейшим способом, который "
1130 "задавал другое требование: значения в полях 1 и 2 следующих одна за одной "
1131 "строк, должны увеличиваться, что не давало создавать некоторые корректные "
1132 "отображения. В Linux 3.9 и новее это ограничение было снято, и допустим "
1133 "любой набор не перекрывающихся отображений."
1134
1135 #. type: Plain text
1136 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1137 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1138 msgid "At least one line must be written to the file."
1139 msgstr "В файл должна быть записана, как минимум, одна строка."
1140
1141 #. type: Plain text
1142 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1143 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1144 msgid "Writes that violate the above rules fail with the error B<EINVAL>."
1145 msgstr ""
1146 "Попытки записи, нарушающие перечисленные выше правила, завершаются с ошибкой "
1147 "B<EINVAL>."
1148
1149 #. type: Plain text
1150 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1151 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1152 #, fuzzy
1153 #| msgid ""
1154 #| "In order for a process to write to the I</proc/[pid]/uid_map> (I</proc/"
1155 #| "[pid]/gid_map>) file, all of the following requirements must be met:"
1156 msgid ""
1157 "In order for a process to write to the I</proc/>pidI</uid_map> (I</proc/"
1158 ">pidI</gid_map>) file, all of the following permission requirements must be "
1159 "met:"
1160 msgstr ""
1161 "Чтобы процесс мог записывать в файл I</proc/[pid]/uid_map> (I</proc/[pid]/"
1162 "gid_map>) должны быть удовлетворены все условия:"
1163
1164 #. type: Plain text
1165 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1166 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1167 msgid ""
1168 "The writing process must have the B<CAP_SETUID> (B<CAP_SETGID>) capability "
1169 "in the user namespace of the process I<pid>."
1170 msgstr ""
1171 "Записывающий процесс должен иметь мандат B<CAP_SETUID> (B<CAP_SETGID>) в "
1172 "пользовательском пространстве имён процесса I<pid>."
1173
1174 #. type: Plain text
1175 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1176 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1177 msgid ""
1178 "The writing process must either be in the user namespace of the process "
1179 "I<pid> or be in the parent user namespace of the process I<pid>."
1180 msgstr ""
1181 "Записывающий процесс должен находиться в пользовательском пространстве имён "
1182 "процесса I<pid> или быть родительским пользовательским пространством имён "
1183 "процесса I<pid>."
1184
1185 #. type: Plain text
1186 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1187 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1188 msgid ""
1189 "The mapped user IDs (group IDs) must in turn have a mapping in the parent "
1190 "user namespace."
1191 msgstr ""
1192 "Отображаемые пользовательские ID (групповые ID) должны иметь соответствующее "
1193 "отображение в родительском пользовательском пространстве имён."
1194
1195 #. type: Plain text
1196 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1197 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1198 msgid ""
1199 "If updating I</proc/>pidI</uid_map> to create a mapping that maps UID 0 in "
1200 "the parent namespace, then one of the following must be true:"
1201 msgstr ""
1202
1203 #. type: Plain text
1204 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1205 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1206 #, fuzzy
1207 #| msgid ""
1208 #| "The writing process must have the B<CAP_SETUID> (B<CAP_SETGID>) "
1209 #| "capability in the user namespace of the process I<pid>."
1210 msgid ""
1211 "if writing process is in the parent user namespace, then it must have the "
1212 "B<CAP_SETFCAP> capability in that user namespace; or"
1213 msgstr ""
1214 "Записывающий процесс должен иметь мандат B<CAP_SETUID> (B<CAP_SETGID>) в "
1215 "пользовательском пространстве имён процесса I<pid>."
1216
1217 #. type: Plain text
1218 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1219 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1220 msgid ""
1221 "if the writing process is in the child user namespace, then the process that "
1222 "created the user namespace must have had the B<CAP_SETFCAP> capability when "
1223 "the namespace was created."
1224 msgstr ""
1225
1226 #. commit db2e718a47984b9d71ed890eb2ea36ecf150de18
1227 #. type: Plain text
1228 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1229 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1230 msgid ""
1231 "This rule has been in place since Linux 5.12. It eliminates an earlier "
1232 "security bug whereby a UID 0 process that lacks the B<CAP_SETFCAP> "
1233 "capability, which is needed to create a binary with namespaced file "
1234 "capabilities (as described in B<capabilities>(7)), could nevertheless create "
1235 "such a binary, by the following steps:"
1236 msgstr ""
1237
1238 #. type: Plain text
1239 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1240 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1241 msgid ""
1242 "Create a new user namespace with the identity mapping (i.e., UID 0 in the "
1243 "new user namespace maps to UID 0 in the parent namespace), so that UID 0 in "
1244 "both namespaces is equivalent to the same root user ID."
1245 msgstr ""
1246
1247 #. type: Plain text
1248 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1249 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1250 msgid ""
1251 "Since the child process has the B<CAP_SETFCAP> capability, it could create a "
1252 "binary with namespaced file capabilities that would then be effective in the "
1253 "parent user namespace (because the root user IDs are the same in the two "
1254 "namespaces)."
1255 msgstr ""
1256
1257 #. type: Plain text
1258 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1259 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1260 msgid "One of the following two cases applies:"
1261 msgstr "Применимо к одному из двух случаев:"
1262
1263 #. type: Plain text
1264 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1265 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1266 msgid ""
1267 "I<Either> the writing process has the B<CAP_SETUID> (B<CAP_SETGID>) "
1268 "capability in the I<parent> user namespace."
1269 msgstr ""
1270 "I<Или> записывающий процесс имеет мандат B<CAP_SETUID> (B<CAP_SETGID>) в "
1271 "I<родительском> пользовательском пространстве имён."
1272
1273 #. type: Plain text
1274 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1275 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1276 msgid ""
1277 "No further restrictions apply: the process can make mappings to arbitrary "
1278 "user IDs (group IDs) in the parent user namespace."
1279 msgstr ""
1280 "В дальнейшем ограничения не применяются: процесс может создавать отображения "
1281 "в произвольные пользовательские ID (групповые ID) в родительском "
1282 "пользовательском пространстве имён."
1283
1284 #. type: Plain text
1285 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1286 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1287 msgid "I<Or> otherwise all of the following restrictions apply:"
1288 msgstr "I<Или> в противном случае накладываются следующие (все) ограничения:"
1289
1290 #. type: Plain text
1291 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1292 #: opensuse-tumbleweed
1293 #, fuzzy
1294 #| msgid ""
1295 #| "The data written to I<uid_map> (I<gid_map>) must consist of a single "
1296 #| "line that maps the writing process's effective user ID (group ID) in the "
1297 #| "parent user namespace to a user ID (group ID) in the user namespace."
1298 msgid ""
1299 "The data written to I<uid_map> (I<gid_map>) must consist of a single line "
1300 "that maps the writing process's effective user ID (group ID) in the parent "
1301 "user namespace to a user ID (group ID) in the user namespace."
1302 msgstr ""
1303 "Данные, записываемые в I<uid_map> (I<gid_map>), должны состоять из одной "
1304 "строки, которая отображает эффективный пользовательский ID (групповой ID) "
1305 "записывающего процесса в родительском пользовательском пространстве имён в "
1306 "пользовательский ID (групповой ID) в пользовательском пространстве имён."
1307
1308 #. type: Plain text
1309 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1310 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1311 msgid ""
1312 "The writing process must have the same effective user ID as the process that "
1313 "created the user namespace."
1314 msgstr ""
1315 "Записывающий процесс должен иметь мандат тот же эффективный пользовательский "
1316 "ID что и процесс, который создал пользовательское пространство имён."
1317
1318 #. type: Plain text
1319 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1320 #: opensuse-tumbleweed
1321 #, fuzzy
1322 #| msgid ""
1323 #| "In the case of I<gid_map>, use of the B<setgroups>(2) system call must "
1324 #| "first be denied by writing \"I<deny>\" to the I</proc/>pidI</setgroups> "
1325 #| "file (see below) before writing to I<gid_map>."
1326 msgid ""
1327 "In the case of I<gid_map>, use of the B<setgroups>(2) system call must "
1328 "first be denied by writing \\[dq]I<deny>\\[dq] to the I</proc/>pidI</"
1329 "setgroups> file (see below) before writing to I<gid_map>."
1330 msgstr ""
1331 "В случае I<gid_map>, перед записью в I<gid_map> сначала нужно использовать "
1332 "системный B<setgroups>(2) для записи \"I<deny>\" в файл I</proc/>pidI</"
1333 "setgroups> (смотрите ниже)."
1334
1335 #. ============================================================
1336 #. type: Plain text
1337 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1338 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1339 msgid "Writes that violate the above rules fail with the error B<EPERM>."
1340 msgstr ""
1341 "Попытки записи, нарушающие перечисленные выше правила, завершаются с ошибкой "
1342 "B<EPERM>."
1343
1344 #. type: SS
1345 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1346 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1347 #, no-wrap
1348 msgid "Project ID mappings: projid_map"
1349 msgstr ""
1350
1351 #. type: Plain text
1352 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1353 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1354 msgid ""
1355 "Similarly to user and group ID mappings, it is possible to create project ID "
1356 "mappings for a user namespace. (Project IDs are used for disk quotas; see "
1357 "B<setquota>(8) and B<quotactl>(2).)"
1358 msgstr ""
1359
1360 #. commit f76d207a66c3a53defea67e7d36c3eb1b7d6d61d
1361 #. type: Plain text
1362 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1363 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1364 msgid ""
1365 "Project ID mappings are defined by writing to the I</proc/>pidI</projid_map> "
1366 "file (present since Linux 3.7)."
1367 msgstr ""
1368
1369 #. type: Plain text
1370 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1371 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1372 msgid ""
1373 "The validity rules for writing to the I</proc/>pidI</projid_map> file are as "
1374 "for writing to the I<uid_map> file; violation of these rules causes "
1375 "B<write>(2) to fail with the error B<EINVAL>."
1376 msgstr ""
1377
1378 #. type: Plain text
1379 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1380 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1381 msgid ""
1382 "The permission rules for writing to the I</proc/>pidI</projid_map> file are "
1383 "as follows:"
1384 msgstr ""
1385
1386 #. type: Plain text
1387 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1388 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1389 #, fuzzy
1390 #| msgid ""
1391 #| "The mapped user IDs (group IDs) must in turn have a mapping in the parent "
1392 #| "user namespace."
1393 msgid ""
1394 "The mapped project IDs must in turn have a mapping in the parent user "
1395 "namespace."
1396 msgstr ""
1397 "Отображаемые пользовательские ID (групповые ID) должны иметь соответствующее "
1398 "отображение в родительском пользовательском пространстве имён."
1399
1400 #. ============================================================
1401 #. type: Plain text
1402 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1403 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1404 #, fuzzy
1405 #| msgid "Writes that violate the above rules fail with the error B<EPERM>."
1406 msgid ""
1407 "Violation of these rules causes B<write>(2) to fail with the error B<EPERM>."
1408 msgstr ""
1409 "Попытки записи, нарушающие перечисленные выше правила, завершаются с ошибкой "
1410 "B<EPERM>."
1411
1412 #. type: SS
1413 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1414 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1415 #, no-wrap
1416 msgid "Interaction with system calls that change process UIDs or GIDs"
1417 msgstr "Взаимодействие с системными вызовами, которые изменяют UID или GID процесса."
1418
1419 #. type: Plain text
1420 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1421 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1422 msgid ""
1423 "In a user namespace where the I<uid_map> file has not been written, the "
1424 "system calls that change user IDs will fail. Similarly, if the I<gid_map> "
1425 "file has not been written, the system calls that change group IDs will "
1426 "fail. After the I<uid_map> and I<gid_map> files have been written, only the "
1427 "mapped values may be used in system calls that change user and group IDs."
1428 msgstr ""
1429 "В пользовательском пространстве имён, в котором не выполнялась запись в файл "
1430 "I<uid_map>, системные вызовы, изменяющие ID пользователя, будут завершаться "
1431 "с ошибкой. Подобными образом, если не выполнялась запись в файл I<gid_map>, "
1432 "то системные вызовы, изменяющие ID группы, будут завершаться с ошибкой. "
1433 "После записи в файл I<uid_map> и I<gid_map> только отображённые значения "
1434 "могут использоваться в системных вызовах, изменяющих ID пользователя или "
1435 "группы."
1436
1437 #. type: Plain text
1438 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1439 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1440 msgid ""
1441 "For user IDs, the relevant system calls include B<setuid>(2), "
1442 "B<setfsuid>(2), B<setreuid>(2), and B<setresuid>(2). For group IDs, the "
1443 "relevant system calls include B<setgid>(2), B<setfsgid>(2), B<setregid>(2), "
1444 "B<setresgid>(2), and B<setgroups>(2)."
1445 msgstr ""
1446 "Для ID пользователя, это относится к следующим системным вызовам: "
1447 "B<setuid>(2), B<setfsuid>(2), B<setreuid>(2) и B<setresuid>(2). Для ID "
1448 "группы, это относится к следующим системным вызовам: B<setgid>(2), "
1449 "B<setfsgid>(2), B<setregid>(2), B<setresgid>(2) и B<setgroups>(2)."
1450
1451 #. Things changed in Linux 3.19
1452 #. commit 9cc46516ddf497ea16e8d7cb986ae03a0f6b92f8
1453 #. commit 66d2f338ee4c449396b6f99f5e75cd18eb6df272
1454 #. http://lwn.net/Articles/626665/
1455 #. ============================================================
1456 #. type: Plain text
1457 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1458 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1459 #, fuzzy
1460 #| msgid ""
1461 #| "Writing \"I<deny>\" to the I</proc/ pid /setgroups> file before writing "
1462 #| "to I</proc/ pid /gid_map> will permanently disable B<setgroups>(2) in a "
1463 #| "user namespace and allow writing to I</proc/ pid /gid_map> without having "
1464 #| "the B<CAP_SETGID> capability in the parent user namespace."
1465 msgid ""
1466 "Writing \\[dq]I<deny>\\[dq] to the I</proc/>pidI</setgroups> file before "
1467 "writing to I</proc/>pidI</gid_map> will permanently disable B<setgroups>(2) "
1468 "in a user namespace and allow writing to I</proc/>pidI</gid_map> without "
1469 "having the B<CAP_SETGID> capability in the parent user namespace."
1470 msgstr ""
1471 "Запись \"I<deny>\" в файле I</proc/ pid /setgroups> перед записью в I</proc/ "
1472 "pid /gid_map> насовсем отключает B<setgroups>(2) в пользовательском "
1473 "пространстве имён, а также разрешает запись в I</proc/ pid /gid_map> без "
1474 "мандата B<CAP_SETGID> в родительском пользовательском пространстве имён."
1475
1476 #. type: SS
1477 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1478 #: opensuse-tumbleweed
1479 #, fuzzy, no-wrap
1480 #| msgid "The /proc/[pid]/setgroups file"
1481 msgid "The \\f[I]/proc/\\fBpid\\f[I]/setgroups\\fB file"
1482 msgstr "Файл /proc/[pid]/setgroups"
1483
1484 #. commit 9cc46516ddf497ea16e8d7cb986ae03a0f6b92f8
1485 #. commit 66d2f338ee4c449396b6f99f5e75cd18eb6df272
1486 #. http://lwn.net/Articles/626665/
1487 #. http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2014-8989
1488 #. type: Plain text
1489 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1490 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1491 #, fuzzy
1492 #| msgid ""
1493 #| "The I</proc/>pidI</setgroups> file displays the string \"I<allow>\" if "
1494 #| "processes in the user namespace that contains the process I<pid> are "
1495 #| "permitted to employ the B<setgroups>(2) system call; it displays "
1496 #| "\"I<deny>\" if B<setgroups>(2) is not permitted in that user namespace. "
1497 #| "Note that regardless of the value in the I</proc/>pidI</setgroups> file "
1498 #| "(and regardless of the process's capabilities), calls to B<setgroups>(2) "
1499 #| "are also not permitted if I</proc/>pidI</gid_map> has not yet been set."
1500 msgid ""
1501 "The I</proc/>pidI</setgroups> file displays the string \\[dq]I<allow>\\[dq] "
1502 "if processes in the user namespace that contains the process I<pid> are "
1503 "permitted to employ the B<setgroups>(2) system call; it displays \\"
1504 "[dq]I<deny>\\[dq] if B<setgroups>(2) is not permitted in that user "
1505 "namespace. Note that regardless of the value in the I</proc/>pidI</"
1506 "setgroups> file (and regardless of the process's capabilities), calls to "
1507 "B<setgroups>(2) are also not permitted if I</proc/>pidI</gid_map> has not "
1508 "yet been set."
1509 msgstr ""
1510 "Файл I</proc/>pidI</setgroups> содержит строку \"I<allow>\", если процессам "
1511 "в пользовательском пространстве имён, которые содержат процесс с I<pid>, "
1512 "разрешено выполнять системный вызов B<setgroups>(2); в файл содержится "
1513 "строка \"I<deny>\", если B<setgroups>(2) запрещён в этом пользовательском "
1514 "пространстве имён. Заметим, что независимо от значения в файле I</proc/"
1515 ">pidI</setgroups> (и независимо от мандатов процесса) вызовы B<setgroups>(2) "
1516 "также запрещены, если I</proc/>pidI</gid_map> до этого не был настроен."
1517
1518 #. type: Plain text
1519 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1520 #: opensuse-tumbleweed
1521 #, fuzzy
1522 #| msgid ""
1523 #| "A privileged process (one with the B<CAP_SYS_ADMIN> capability in the "
1524 #| "namespace) may write either of the strings \"I<allow>\" or \"I<deny>\" to "
1525 #| "this file I<before> writing a group ID mapping for this user namespace to "
1526 #| "the file I</proc/>pidI</gid_map>. Writing the string \"I<deny>\" "
1527 #| "prevents any process in the user namespace from employing B<setgroups>(2)."
1528 msgid ""
1529 "A privileged process (one with the B<CAP_SYS_ADMIN> capability in the "
1530 "namespace) may write either of the strings \\[dq]I<allow>\\[dq] or \\"
1531 "[dq]I<deny>\\[dq] to this file I<before> writing a group ID mapping for this "
1532 "user namespace to the file I</proc/>pidI</gid_map>. Writing the string \\"
1533 "[dq]I<deny>\\[dq] prevents any process in the user namespace from employing "
1534 "B<setgroups>(2)."
1535 msgstr ""
1536 "Привилегированный процесс (с мандатом B<CAP_SYS_ADMIN> в пространстве имён) "
1537 "может записать строку \"I<allow>\" или \"I<deny>\" в этот файл I<до> записи "
1538 "отображения ID групп для этого пользовательского пространства имён в файл I</"
1539 "proc/>pidI</gid_map>. Запись строки \"I<deny>\" запрещает любому процессу в "
1540 "пользовательском пространстве имён выполнять B<setgroups>(2)."
1541
1542 #. type: Plain text
1543 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1544 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1545 msgid ""
1546 "The essence of the restrictions described in the preceding paragraph is that "
1547 "it is permitted to write to I</proc/>pidI</setgroups> only so long as "
1548 "calling B<setgroups>(2) is disallowed because I</proc/>pidI</gid_map> has "
1549 "not been set. This ensures that a process cannot transition from a state "
1550 "where B<setgroups>(2) is allowed to a state where B<setgroups>(2) is "
1551 "denied; a process can transition only from B<setgroups>(2) being disallowed "
1552 "to B<setgroups>(2) being allowed."
1553 msgstr ""
1554 "Сущность ограничений, описанных в предыдущем абзаце в том, чтобы разрешить "
1555 "запись в I</proc/>pidI</setgroups> только когда запрещено вызывать "
1556 "B<setgroups>(2), так как I</proc/>pidI</gid_map> не настроен. Это "
1557 "гарантирует, что процесс не сможет перейти из состояния, в котором "
1558 "B<setgroups>(2) разрешён, в состояние, в котором B<setgroups>(2) запрещён; "
1559 "процесс может переходить только из состояния, когда B<setgroups>(2) "
1560 "запрещён, в состояние, когда B<setgroups>(2) разрешён."
1561
1562 #. type: Plain text
1563 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1564 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1565 #, fuzzy
1566 #| msgid ""
1567 #| "The default value of this file in the initial user namespace is "
1568 #| "\"I<allow>\"."
1569 msgid ""
1570 "The default value of this file in the initial user namespace is \\"
1571 "[dq]I<allow>\\[dq]."
1572 msgstr ""
1573 "Значение по умолчанию в этом файле для начального состояния "
1574 "пользовательского пространства имён равно \"I<allow>\"."
1575
1576 #. type: Plain text
1577 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1578 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1579 #, fuzzy
1580 #| msgid ""
1581 #| "Once I</proc/>pidI</gid_map> has been written to (which has the effect of "
1582 #| "enabling B<setgroups>(2) in the user namespace), it is no longer "
1583 #| "possible to disallow B<setgroups>(2) by writing \"I<deny>\" to I</proc/"
1584 #| ">pidI</setgroups> (the write fails with the error B<EPERM>)."
1585 msgid ""
1586 "Once I</proc/>pidI</gid_map> has been written to (which has the effect of "
1587 "enabling B<setgroups>(2) in the user namespace), it is no longer possible "
1588 "to disallow B<setgroups>(2) by writing \\[dq]I<deny>\\[dq] to I</proc/"
1589 ">pidI</setgroups> (the write fails with the error B<EPERM>)."
1590 msgstr ""
1591 "После записи в I</proc/>pidI</gid_map> (что действует как разрешение работы "
1592 "B<setgroups>(2) в пользовательском пространстве имён), больше невозможно "
1593 "запретить B<setgroups>(2) записью \"I<deny>\" в I</proc/>pidI</setgroups> "
1594 "(запись завершается ошибкой B<EPERM>)."
1595
1596 #. type: Plain text
1597 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1598 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1599 msgid ""
1600 "A child user namespace inherits the I</proc/>pidI</setgroups> setting from "
1601 "its parent."
1602 msgstr ""
1603 "Дочернее пользовательское пространство имён наследует значение I</proc/"
1604 ">pidI</setgroups> своего родителя."
1605
1606 #. type: Plain text
1607 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1608 #: opensuse-tumbleweed
1609 #, fuzzy
1610 #| msgid ""
1611 #| "If the I<setgroups> file has the value \"I<deny>\", then the "
1612 #| "B<setgroups>(2) system call can't subsequently be reenabled (by writing "
1613 #| "\"I<allow>\" to the file) in this user namespace. (Attempts to do so "
1614 #| "fail with the error B<EPERM>.) This restriction also propagates down to "
1615 #| "all child user namespaces of this user namespace."
1616 msgid ""
1617 "If the I<setgroups> file has the value \\[dq]I<deny>\\[dq], then the "
1618 "B<setgroups>(2) system call can't subsequently be reenabled (by writing \\"
1619 "[dq]I<allow>\\[dq] to the file) in this user namespace. (Attempts to do so "
1620 "fail with the error B<EPERM>.) This restriction also propagates down to all "
1621 "child user namespaces of this user namespace."
1622 msgstr ""
1623 "Если файл I<setgroups> содержит значение \"I<deny>\", то системный вызов "
1624 "B<setgroups>(2) не может быть повторно включён в дальнейшем (записью "
1625 "\"I<allow>\" в файл) в этом пользовательском пространстве имён (попытка это "
1626 "сделать завершается ошибкой B<EPERM>). Это ограничение также "
1627 "распространяется на всех потомков пользовательского пространства имён этого "
1628 "пользовательского пространства имён."
1629
1630 #. /proc/PID/setgroups
1631 #. [allow == setgroups() is allowed, "deny" == setgroups() is disallowed]
1632 #. * Can write if have CAP_SYS_ADMIN in NS
1633 #. * Must write BEFORE writing to /proc/PID/gid_map
1634 #. setgroups()
1635 #. * Must already have written to gid_map
1636 #. * /proc/PID/setgroups must be "allow"
1637 #. /proc/PID/gid_map -- writing
1638 #. * Must already have written "deny" to /proc/PID/setgroups
1639 #. ============================================================
1640 #. type: Plain text
1641 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1642 #: opensuse-tumbleweed
1643 #, fuzzy
1644 #| msgid ""
1645 #| "The I</proc/ pid /setgroups> file was added in Linux 3.19, but was "
1646 #| "backported to many earlier stable kernel series, because it addresses a "
1647 #| "security issue. The issue concerned files with permissions such as "
1648 #| "\"rwx---rwx\". Such files give fewer permissions to \"group\" than they "
1649 #| "do to \"other\". This means that dropping groups using B<setgroups>(2) "
1650 #| "might allow a process file access that it did not formerly have. Before "
1651 #| "the existence of user namespaces this was not a concern, since only a "
1652 #| "privileged process (one with the B<CAP_SETGID> capability) could call "
1653 #| "B<setgroups>(2). However, with the introduction of user namespaces, it "
1654 #| "became possible for an unprivileged process to create a new namespace in "
1655 #| "which the user had all privileges. This then allowed formerly "
1656 #| "unprivileged users to drop groups and thus gain file access that they did "
1657 #| "not previously have. The I</proc/>pidI</setgroups> file was added to "
1658 #| "address this security issue, by denying any pathway for an unprivileged "
1659 #| "process to drop groups with B<setgroups>(2)."
1660 msgid ""
1661 "The I</proc/>pidI</setgroups> file was added in Linux 3.19, but was "
1662 "backported to many earlier stable kernel series, because it addresses a "
1663 "security issue. The issue concerned files with permissions such as \"rwx---"
1664 "rwx\". Such files give fewer permissions to \"group\" than they do to "
1665 "\"other\". This means that dropping groups using B<setgroups>(2) might "
1666 "allow a process file access that it did not formerly have. Before the "
1667 "existence of user namespaces this was not a concern, since only a privileged "
1668 "process (one with the B<CAP_SETGID> capability) could call "
1669 "B<setgroups>(2). However, with the introduction of user namespaces, it "
1670 "became possible for an unprivileged process to create a new namespace in "
1671 "which the user had all privileges. This then allowed formerly unprivileged "
1672 "users to drop groups and thus gain file access that they did not previously "
1673 "have. The I</proc/>pidI</setgroups> file was added to address this security "
1674 "issue, by denying any pathway for an unprivileged process to drop groups "
1675 "with B<setgroups>(2)."
1676 msgstr ""
1677 "Файл I</proc/ pid /setgroups> был добавлен в Linux 3.19, но перенесён и в "
1678 "старшие серии ядра, так как служит для обеспечения безопасности. В "
1679 "частности, это влияет на файлы с правами доступа «rwx---rwx». Эти файлы "
1680 "меньшие права «группе» по сравнению с группой «остальные». Это означает, что "
1681 "удаление группы с помощью B<setgroups>(2) может открыть доступ к файлу, тем "
1682 "которые не имели его. До существования пользовательских пространств имён это "
1683 "не было проблемой, так как только привилегированный процесс (с мандатом "
1684 "B<CAP_SETGID>) мог вызывать B<setgroups>(2). Однако с введение "
1685 "пользовательских пространств имён стало возможным и непривилегированному "
1686 "процессу создавать новое пространство имён, в котором пользователь имеет все "
1687 "права. После этого ранее непривилегированный пользователь может удалить "
1688 "группы и таким образом получить доступ к файлу, которого раньше не имел. "
1689 "Файл I</proc/>pidI</setgroups> был добавлен для решения этой проблемы "
1690 "безопасности; он запрещает непривилегированному процессу удалять группы с "
1691 "помощью B<setgroups>(2)."
1692
1693 #. type: SS
1694 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1695 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1696 #, no-wrap
1697 msgid "Unmapped user and group IDs"
1698 msgstr "Неотображённые пользовательские и групповые ID"
1699
1700 #. from_kuid_munged(), from_kgid_munged()
1701 #. type: Plain text
1702 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1703 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1704 msgid ""
1705 "There are various places where an unmapped user ID (group ID) may be "
1706 "exposed to user space. For example, the first process in a new user "
1707 "namespace may call B<getuid>(2) before a user ID mapping has been defined "
1708 "for the namespace. In most such cases, an unmapped user ID is converted to "
1709 "the overflow user ID (group ID); the default value for the overflow user ID "
1710 "(group ID) is 65534. See the descriptions of I</proc/sys/kernel/"
1711 "overflowuid> and I</proc/sys/kernel/overflowgid> in B<proc>(5)."
1712 msgstr ""
1713 "Есть несколько мест, где в пользовательском пространстве могут появиться "
1714 "неотображённые пользовательские ID (групповые ID). Например, первый процесс "
1715 "в новом пользовательском пространстве имён может вызвать B<getuid>(2) до "
1716 "определения отображения пользовательских ID для пространства имён. В "
1717 "большинстве случаев, неотображённый пользовательский ID преобразуется в "
1718 "пользовательский ID (групповой ID) переполнения (overflow); значение по "
1719 "умолчанию для пользовательского ID (группового ID) переполнения равно 65534. "
1720 "Смотрите описание I</proc/sys/kernel/overflowuid> и I</proc/sys/kernel/"
1721 "overflowgid> в B<proc>(5)."
1722
1723 #. also SO_PEERCRED
1724 #. type: Plain text
1725 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1726 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1727 msgid ""
1728 "The cases where unmapped IDs are mapped in this fashion include system calls "
1729 "that return user IDs (B<getuid>(2), B<getgid>(2), and similar), credentials "
1730 "passed over a UNIX domain socket, credentials returned by B<stat>(2), "
1731 "B<waitid>(2), and the System V IPC \"ctl\" B<IPC_STAT> operations, "
1732 "credentials exposed by I</proc/>pidI</status> and the files in I</proc/"
1733 "sysvipc/*>, credentials returned via the I<si_uid> field in the I<siginfo_t> "
1734 "received with a signal (see B<sigaction>(2)), credentials written to the "
1735 "process accounting file (see B<acct>(5)), and credentials returned with "
1736 "POSIX message queue notifications (see B<mq_notify>(3))."
1737 msgstr ""
1738 "Случаи, где неотображённые ID отображаются в таком виде, относятся к "
1739 "системным вызовам, которые возвращают пользовательские ID (B<getuid>(2), "
1740 "B<getgid>(2) и подобные), мандаты, передаваемые через доменный сокет UNIX, "
1741 "мандаты, возвращаемые B<stat>(2), B<waitid>(2) и System V IPC «ctl»-"
1742 "операциями B<IPC_STAT>, мандаты, показываемые в I</proc/>pidI</status> и "
1743 "файлах в I</proc/sysvipc/*>, мандаты, возвращаемые в поле I<si_uid> "
1744 "структуры I<siginfo_t>, полученной по сигналу (смотрите B<sigaction>(2)), "
1745 "мандаты, записываемые в файл учёта процесса (смотрите B<acct>(5)), и "
1746 "мандаты, возвращаемые с уведомлениями очереди сообщений POSIX (смотрите "
1747 "B<mq_notify>(3))."
1748
1749 #. from_kuid(), from_kgid()
1750 #. Also F_GETOWNER_UIDS is an exception
1751 #. ============================================================
1752 #. type: Plain text
1753 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1754 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1755 msgid ""
1756 "There is one notable case where unmapped user and group IDs are I<not> "
1757 "converted to the corresponding overflow ID value. When viewing a I<uid_map> "
1758 "or I<gid_map> file in which there is no mapping for the second field, that "
1759 "field is displayed as 4294967295 (-1 as an unsigned integer)."
1760 msgstr ""
1761 "Есть один известный случай, где неотображённый пользовательский и групповой "
1762 "ID I<не> преобразуется в соответствующее значение ID переполнения. Если при "
1763 "просмотре файла I<uid_map> или I<gid_map> обнаруживается, что для второго "
1764 "поля нет отображения, то поле отображается как 4294967295 (-1 для "
1765 "беззнакового целого)."
1766
1767 #. type: SS
1768 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1769 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1770 #, no-wrap
1771 msgid "Accessing files"
1772 msgstr "Доступ к файлам"
1773
1774 #. ============================================================
1775 #. type: Plain text
1776 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1777 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1778 #, fuzzy
1779 #| msgid ""
1780 #| "In order to determine permissions when an unprivileged process accesses a "
1781 #| "file, the process credentials (UID, GID) and the file credentials are in "
1782 #| "effect mapped back to what they would be in the initial user namespace "
1783 #| "and then compared to determine the permissions that the process has on "
1784 #| "the file. The same is also of other objects that employ the credentials "
1785 #| "plus permissions mask accessibility model, such as System V IPC objects"
1786 msgid ""
1787 "In order to determine permissions when an unprivileged process accesses a "
1788 "file, the process credentials (UID, GID) and the file credentials are in "
1789 "effect mapped back to what they would be in the initial user namespace and "
1790 "then compared to determine the permissions that the process has on the "
1791 "file. The same is also true of other objects that employ the credentials "
1792 "plus permissions mask accessibility model, such as System V IPC objects."
1793 msgstr ""
1794 "Чтобы определить права, с которыми непривилегированный процесс обращается к "
1795 "файлу, берутся идентификаторы процесса (UID, GID) и идентификаторы файла, "
1796 "отображаемые в те, которые были бы в исходном пространстве имён "
1797 "пользователя, и затем сравниваются для определения прав, которые процесс "
1798 "имеет на файл. Это также выполняется и для других объектов, использующих "
1799 "идентификаторы плюс модель маски прав доступа, например для объектов System "
1800 "V IPC."
1801
1802 #. type: SS
1803 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1804 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1805 #, no-wrap
1806 msgid "Operation of file-related capabilities"
1807 msgstr "Операции с файловыми мандатами"
1808
1809 #. type: Plain text
1810 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1811 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1812 msgid ""
1813 "Certain capabilities allow a process to bypass various kernel-enforced "
1814 "restrictions when performing operations on files owned by other users or "
1815 "groups. These capabilities are: B<CAP_CHOWN>, B<CAP_DAC_OVERRIDE>, "
1816 "B<CAP_DAC_READ_SEARCH>, B<CAP_FOWNER>, and B<CAP_FSETID>."
1817 msgstr ""
1818 "Некоторые мандаты позволяют процессу обходить различные ограничения, "
1819 "налагаемые ядром на выполнение операций над файлами, принадлежащими другим "
1820 "пользователям или группам. Список мандатов: B<CAP_CHOWN>, "
1821 "B<CAP_DAC_OVERRIDE>, B<CAP_DAC_READ_SEARCH>, B<CAP_FOWNER> и B<CAP_FSETID>."
1822
1823 #. type: Plain text
1824 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1825 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1826 msgid ""
1827 "Within a user namespace, these capabilities allow a process to bypass the "
1828 "rules if the process has the relevant capability over the file, meaning that:"
1829 msgstr ""
1830 "Внутри пользовательского пространства имён эти мандаты позволяют процессу "
1831 "обходить правила, если процесс имеет соответствующий мандат на файле, "
1832 "подразумевающий что:"
1833
1834 #. type: Plain text
1835 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1836 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1837 msgid ""
1838 "the process has the relevant effective capability in its user namespace; and"
1839 msgstr ""
1840 "процесс имеет соответствующий эффективный мандат в своём пространстве имён "
1841 "пользователя; и"
1842
1843 #. type: Plain text
1844 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1845 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1846 msgid ""
1847 "the file's user ID and group ID both have valid mappings in the user "
1848 "namespace."
1849 msgstr ""
1850 "файловые ID пользователя и группы корректно отображаются в "
1851 "пользовательскомпространстве имён."
1852
1853 #. #-#-#-#-# archlinux: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
1854 #. These are the checks performed by the kernel function
1855 #. inode_owner_or_capable(). There is one exception to the exception:
1856 #. overriding the directory sticky permission bit requires that
1857 #. the file has a valid mapping for both its UID and GID.
1858 #. ============================================================
1859 #. type: Plain text
1860 #. #-#-#-#-# debian-trixie: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
1861 #. These are the checks performed by the kernel function
1862 #. inode_owner_or_capable(). There is one exception to the exception:
1863 #. overriding the directory sticky permission bit requires that
1864 #. the file has a valid mapping for both its UID and GID.
1865 #. ============================================================
1866 #. type: Plain text
1867 #. #-#-#-#-# debian-unstable: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
1868 #. These are the checks performed by the kernel function
1869 #. inode_owner_or_capable(). There is one exception to the exception:
1870 #. overriding the directory sticky permission bit requires that
1871 #. the file has a valid mapping for both its UID and GID.
1872 #. ============================================================
1873 #. type: Plain text
1874 #. #-#-#-#-# fedora-44: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
1875 #. These are the checks performed by the kernel function
1876 #. inode_owner_or_capable(). There is one exception to the exception:
1877 #. overriding the directory sticky permission bit requires that
1878 #. the file has a valid mapping for both its UID and GID.
1879 #. ============================================================
1880 #. type: Plain text
1881 #. #-#-#-#-# fedora-rawhide: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
1882 #. These are the checks performed by the kernel function
1883 #. inode_owner_or_capable(). There is one exception to the exception:
1884 #. overriding the directory sticky permission bit requires that
1885 #. the file has a valid mapping for both its UID and GID.
1886 #. ============================================================
1887 #. type: Plain text
1888 #. #-#-#-#-# mageia-cauldron: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
1889 #. These are the checks performed by the kernel function
1890 #. inode_owner_or_capable(). There is one exception to the exception:
1891 #. overriding the directory sticky permission bit requires that
1892 #. the file has a valid mapping for both its UID and GID.
1893 #. ============================================================
1894 #. type: Plain text
1895 #. #-#-#-#-# opensuse-leap-16-1: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
1896 #. These are the checks performed by the kernel function
1897 #. inode_owner_or_capable(). There is one exception to the exception:
1898 #. overriding the directory sticky permission bit requires that
1899 #. the file has a valid mapping for both its UID and GID.
1900 #. ============================================================
1901 #. type: Plain text
1902 #. #-#-#-#-# opensuse-tumbleweed: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
1903 #. These are the checks performed by the kernel function
1904 #. inode_owner_or_capable(). There is one exception to the exception:
1905 #. overriding the directory sticky permission bit requires that
1906 #. the file has a valid mapping for both its UID and GID.
1907 #. ============================================================
1908 #. type: Plain text
1909 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1910 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1911 msgid ""
1912 "The B<CAP_FOWNER> capability is treated somewhat exceptionally: it allows a "
1913 "process to bypass the corresponding rules so long as at least the file's "
1914 "user ID has a mapping in the user namespace (i.e., the file's group ID does "
1915 "not need to have a valid mapping)."
1916 msgstr ""
1917 "Мандат B<CAP_FOWNER> учитывается по-другому: it allows a process to bypass "
1918 "the corresponding rules so long as at least the file's user ID has a mapping "
1919 "in the user namespace (т. е., файловый ID группы может не иметь корректного "
1920 "отображения)."
1921
1922 #. type: SS
1923 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1924 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1925 #, no-wrap
1926 msgid "Set-user-ID and set-group-ID programs"
1927 msgstr "Программы с установленными битами set-user-ID и set-group-ID"
1928
1929 #. ============================================================
1930 #. type: Plain text
1931 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1932 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1933 msgid ""
1934 "When a process inside a user namespace executes a set-user-ID (set-group-ID) "
1935 "program, the process's effective user (group) ID inside the namespace is "
1936 "changed to whatever value is mapped for the user (group) ID of the file. "
1937 "However, if either the user I<or> the group ID of the file has no mapping "
1938 "inside the namespace, the set-user-ID (set-group-ID) bit is silently "
1939 "ignored: the new program is executed, but the process's effective user "
1940 "(group) ID is left unchanged. (This mirrors the semantics of executing a "
1941 "set-user-ID or set-group-ID program that resides on a filesystem that was "
1942 "mounted with the B<MS_NOSUID> flag, as described in B<mount>(2).)"
1943 msgstr ""
1944 "Когда процесс внутри пользовательского пространства имён выполняет программу "
1945 "с установленным битом set-user-ID (set-group-ID), то эффективный ID "
1946 "пользователя (группы) внутри пространства имён изменяется на значение, "
1947 "отображённое для ID пользователя (группы) файла. Однако, если ID "
1948 "пользователя I<или> группы файла не имеет отображения внутри пространства "
1949 "имён, то бит set-user-ID (set-group-ID) просто игнорируется: выполняется "
1950 "новая программа, но эффективный ID пользователя (группы) остаётся не "
1951 "изменённым (такое поведение зеркально семантике выполнения программы с set-"
1952 "user-ID или set-group-ID, располагающейся в файловой системе, которая была "
1953 "смонтирована с флагом B<MS_NOSUID>, как описано в B<mount>(2))."
1954
1955 #. type: SS
1956 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1957 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1958 #, no-wrap
1959 msgid "Miscellaneous"
1960 msgstr "Разное"
1961
1962 #. type: Plain text
1963 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1964 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1965 msgid ""
1966 "When a process's user and group IDs are passed over a UNIX domain socket to "
1967 "a process in a different user namespace (see the description of "
1968 "B<SCM_CREDENTIALS> in B<unix>(7)), they are translated into the "
1969 "corresponding values as per the receiving process's user and group ID "
1970 "mappings."
1971 msgstr ""
1972 "Когда ID пользователя и группы процесса передаются через доменный сокет UNIX "
1973 "в процесс в другом пользовательском пространстве имён (смотрите описание "
1974 "B<SCM_CREDENTIALS> в B<unix>(7)), то они транслируются в соответствующие "
1975 "значения согласно отображению ID пользователя и группы принимающего процесса."
1976
1977 #. type: SH
1978 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1979 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1980 #, no-wrap
1981 msgid "STANDARDS"
1982 msgstr "СТАНДАРТЫ"
1983
1984 #. type: Plain text
1985 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1986 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1987 msgid "Linux."
1988 msgstr "Linux."
1989
1990 #. type: SH
1991 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1992 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1993 #, no-wrap
1994 msgid "NOTES"
1995 msgstr "ПРИМЕЧАНИЯ"
1996
1997 #. ============================================================
1998 #. type: Plain text
1999 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2000 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2001 msgid ""
2002 "Over the years, there have been a lot of features that have been added to "
2003 "the Linux kernel that have been made available only to privileged users "
2004 "because of their potential to confuse set-user-ID-root applications. In "
2005 "general, it becomes safe to allow the root user in a user namespace to use "
2006 "those features because it is impossible, while in a user namespace, to gain "
2007 "more privilege than the root user of a user namespace has."
2008 msgstr ""
2009 "За эти годы в ядро Linux добавлено много свойств, которые были доступны "
2010 "только привилегированным пользователям, так как их возможности слишком "
2011 "велики, чтобы наделять ими приложения с set-user-ID. В целом, становится "
2012 "безопасно разрешать пользователю root в пользовательском пространстве имён "
2013 "использовать эти свойства, так как будучи в пользовательском пространстве "
2014 "имён, он не может получить больше прав, чем имеет root в пользовательском "
2015 "пространстве имён."
2016
2017 #. type: SS
2018 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2019 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2020 #, no-wrap
2021 msgid "Global root"
2022 msgstr ""
2023
2024 #
2025 #. ============================================================
2026 #. type: Plain text
2027 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2028 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2029 msgid ""
2030 "The term \"global root\" is sometimes used as a shorthand for user ID 0 in "
2031 "the initial user namespace."
2032 msgstr ""
2033
2034 #. type: SS
2035 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2036 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2037 #, no-wrap
2038 msgid "Availability"
2039 msgstr "Доступность"
2040
2041 #. type: Plain text
2042 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2043 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2044 msgid ""
2045 "Use of user namespaces requires a kernel that is configured with the "
2046 "B<CONFIG_USER_NS> option. User namespaces require support in a range of "
2047 "subsystems across the kernel. When an unsupported subsystem is configured "
2048 "into the kernel, it is not possible to configure user namespaces support."
2049 msgstr ""
2050 "Для использования пользовательских пространств имён ядро должно быть собрано "
2051 "с параметром B<CONFIG_USER_NS>. Пользовательские пространства имён требуют "
2052 "поддержки во многих подсистемах ядра. Если в ядре задействована "
2053 "неподдерживаемая подсистема, то включить поддержку пользовательских "
2054 "пространств имён невозможно."
2055
2056 #. commit d6970d4b726cea6d7a9bc4120814f95c09571fc3
2057 #. type: Plain text
2058 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2059 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2060 msgid ""
2061 "As at Linux 3.8, most relevant subsystems supported user namespaces, but a "
2062 "number of filesystems did not have the infrastructure needed to map user and "
2063 "group IDs between user namespaces. Linux 3.9 added the required "
2064 "infrastructure support for many of the remaining unsupported filesystems "
2065 "(Plan 9 (9P), Andrew File System (AFS), Ceph, CIFS, CODA, NFS, and OCFS2). "
2066 "Linux 3.12 added support for the last of the unsupported major filesystems, "
2067 "XFS."
2068 msgstr ""
2069 "В Linux 3.8 самые важные подсистемы поддерживают пользовательские "
2070 "пространства имён, но значительное количество файловых систем не имеют "
2071 "инфраструктуры для отображения пользовательских и групповых ID между "
2072 "пользовательскими пространствами имён. В Linux 3.9 добавлена требуемая "
2073 "поддержка инфраструктуры во многие неподдерживаемые файловые системы (Plan 9 "
2074 "(9P), Andrew File System (AFS), Ceph, CIFS, CODA, NFS и OCFS2). В Linux 3.12 "
2075 "добавлена поддержка в последние основные файловые системы (XFS)."
2076
2077 #. type: SH
2078 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2079 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2080 #, no-wrap
2081 msgid "EXAMPLES"
2082 msgstr "ПРИМЕРЫ"
2083
2084 #. type: Plain text
2085 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2086 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2087 #, fuzzy
2088 #| msgid ""
2089 #| "The program below is designed to allow experimenting with user "
2090 #| "namespaces, as well as other types of namespaces. It creates namespaces "
2091 #| "as specified by command-line options and then executes a command inside "
2092 #| "those namespaces. The comments and I<usage()> function inside the "
2093 #| "program provide a full explanation of the program. The following shell "
2094 #| "session demonstrates its use."
2095 msgid ""
2096 "The program below is designed to allow experimenting with user namespaces, "
2097 "as well as other types of namespaces. It creates namespaces as specified by "
2098 "command-line options and then executes a command inside those namespaces. "
2099 "The comments and I<usage>() function inside the program provide a full "
2100 "explanation of the program. The following shell session demonstrates its "
2101 "use."
2102 msgstr ""
2103 "Представленная далее программа разработана для экспериментов с "
2104 "пользовательскими пространствами имён. Она создаёт пространства имён "
2105 "согласно параметрам командной строки и затем выполняет команду внутри этих "
2106 "пространств имён. В комментариях и функции I<usage()> предоставлено полное "
2107 "описание программы. Следующий сеанс оболочки показывает её работу."
2108
2109 #. type: Plain text
2110 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2111 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2112 msgid "First, we look at the run-time environment:"
2113 msgstr "Сначала, посмотрим на окружение выполнения:"
2114
2115 #. type: Plain text
2116 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
2117 #: opensuse-tumbleweed
2118 #, fuzzy, no-wrap
2119 #| msgid ""
2120 #| "$ B<uname -rs> # Need Linux 3.8 or later\n"
2121 #| "Linux 3.8.0\n"
2122 #| "$ B<id -u> # Running as unprivileged user\n"
2123 #| "1000\n"
2124 #| "$ B<id -g>\n"
2125 #| "1000\n"
2126 msgid ""
2127 "$B< uname -rs>; # Need Linux 3.8 or later\n"
2128 "Linux 3.8.0\n"
2129 "$B< id -u>; # Running as unprivileged user\n"
2130 "1000\n"
2131 "$B< id -g>;\n"
2132 "1000\n"
2133 msgstr ""
2134 "$ B<uname -rs> # требуется Linux 3.8 или новее\n"
2135 "Linux 3.8.0\n"
2136 "$ B<id -u> # работа от непривилегированного пользователя\n"
2137 "1000\n"
2138 "$ B<id -g>\n"
2139 "1000\n"
2140
2141 #. type: Plain text
2142 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2143 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2144 msgid ""
2145 "Now start a new shell in new user (I<-U>), mount (I<-m>), and PID (I<-p>) "
2146 "namespaces, with user ID (I<-M>) and group ID (I<-G>) 1000 mapped to 0 "
2147 "inside the user namespace:"
2148 msgstr ""
2149 "Теперь запустим новую оболочку в новых пользовательском (I<-U>), "
2150 "монтирования (I<-m>) и PID (I<-p>) пространствах имён с пользовательским (I<-"
2151 "M>) и групповым ID (I<-G>) 1000, отображающимся в 0 внутри "
2152 "пользовательского пространства имён:"
2153
2154 #. type: Plain text
2155 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
2156 #: opensuse-tumbleweed
2157 #, fuzzy, no-wrap
2158 #| msgid "$ B<./userns_child_exec -p -m -U -M \\(aq0 1000 1\\(aq -G \\(aq0 1000 1\\(aq bash>\n"
2159 msgid "$B< ./userns_child_exec -p -m -U -M \\[aq]0 1000 1\\[aq] -G \\[aq]0 1000 1\\[aq] bash>;\n"
2160 msgstr "$ B<./userns_child_exec -p -m -U -M \\(aq0 1000 1\\(aq -G \\(aq0 1000 1\\(aq bash>\n"
2161
2162 #. type: Plain text
2163 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2164 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2165 msgid ""
2166 "The shell has PID 1, because it is the first process in the new PID "
2167 "namespace:"
2168 msgstr ""
2169 "У оболочки PID равен 1, так как это первый процесс в новом пространстве имён "
2170 "PID:"
2171
2172 #. type: Plain text
2173 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
2174 #: opensuse-tumbleweed
2175 #, fuzzy, no-wrap
2176 #| msgid ""
2177 #| "bash$ B<echo $$>\n"
2178 #| "1\n"
2179 msgid ""
2180 "bash$B< echo $$>;\n"
2181 "1\n"
2182 msgstr ""
2183 "bash$ B<echo $$>\n"
2184 "1\n"
2185
2186 #. type: Plain text
2187 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2188 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2189 msgid ""
2190 "Mounting a new I</proc> filesystem and listing all of the processes visible "
2191 "in the new PID namespace shows that the shell can't see any processes "
2192 "outside the PID namespace:"
2193 msgstr ""
2194 "Смонтируем новую файловую систему I</proc> и просмотрим все процессы, "
2195 "видимые в новом пространстве имён PID; убедимся, что оболочка не видит ни "
2196 "одного процесса вне своего пространства имён PID:"
2197
2198 #. type: Plain text
2199 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
2200 #: opensuse-tumbleweed
2201 #, fuzzy, no-wrap
2202 #| msgid ""
2203 #| "bash$ B<mount -t proc proc /proc>\n"
2204 #| "bash$ B<ps ax>\n"
2205 #| " PID TTY STAT TIME COMMAND\n"
2206 #| " 1 pts/3 S 0:00 bash\n"
2207 #| " 22 pts/3 R+ 0:00 ps ax\n"
2208 msgid ""
2209 "bash$B< mount -t proc proc /proc>;\n"
2210 "bash$B< ps ax>;\n"
2211 " PID TTY STAT TIME COMMAND\n"
2212 " 1 pts/3 S 0:00 bash\n"
2213 " 22 pts/3 R+ 0:00 ps ax\n"
2214 msgstr ""
2215 "bash$ B<mount -t proc proc /proc>\n"
2216 "bash$ B<ps ax>\n"
2217 " PID TTY STAT TIME COMMAND\n"
2218 " 1 pts/3 S 0:00 bash\n"
2219 " 22 pts/3 R+ 0:00 ps ax\n"
2220
2221 #. type: Plain text
2222 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2223 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2224 msgid ""
2225 "Inside the user namespace, the shell has user and group ID 0, and a full set "
2226 "of permitted and effective capabilities:"
2227 msgstr ""
2228 "Внутри пользовательского пространства имён идентификаторы пользователя и "
2229 "группы оболочки равны 0, и она имеет полный набор разрешённых и эффективных "
2230 "мандатов:"
2231
2232 #. type: Plain text
2233 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
2234 #: opensuse-tumbleweed
2235 #, fuzzy, no-wrap
2236 #| msgid ""
2237 #| "bash$ B<cat /proc/$$/status | egrep \\(aq\\(ha[UG]id\\(aq>\n"
2238 #| "Uid:\t0\t0\t0\t0\n"
2239 #| "Gid:\t0\t0\t0\t0\n"
2240 #| "bash$ B<cat /proc/$$/status | egrep \\(aq\\(haCap(Prm|Inh|Eff)\\(aq>\n"
2241 #| "CapInh:\t0000000000000000\n"
2242 #| "CapPrm:\t0000001fffffffff\n"
2243 #| "CapEff:\t0000001fffffffff\n"
2244 msgid ""
2245 "bash$B< cat /proc/$$/status | egrep \\[aq]\\[ha][UG]id\\[aq]>;\n"
2246 "Uid:\t0\t0\t0\t0\n"
2247 "Gid:\t0\t0\t0\t0\n"
2248 "bash$B< cat /proc/$$/status | egrep \\[aq]\\[ha]Cap(Prm|Inh|Eff)\\[aq]>;\n"
2249 "CapInh:\t0000000000000000\n"
2250 "CapPrm:\t0000001fffffffff\n"
2251 "CapEff:\t0000001fffffffff\n"
2252 msgstr ""
2253 "bash$ B<cat /proc/$$/status | egrep \\(aq\\(ha[UG]id\\(aq>\n"
2254 "Uid:\t0\t0\t0\t0\n"
2255 "Gid:\t0\t0\t0\t0\n"
2256 "bash$ B<cat /proc/$$/status | egrep \\(aq\\(haCap(Prm|Inh|Eff)\\(aq>\n"
2257 "CapInh:\t0000000000000000\n"
2258 "CapPrm:\t0000001fffffffff\n"
2259 "CapEff:\t0000001fffffffff\n"
2260
2261 #. type: SS
2262 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2263 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2264 #, no-wrap
2265 msgid "Program source"
2266 msgstr "Исходный код программы"
2267
2268 #. type: Plain text
2269 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
2270 #: opensuse-tumbleweed
2271 #, no-wrap
2272 msgid ""
2273 "/* userns_child_exec.c\n"
2274 "\\&\n"
2275 " Licensed under GNU General Public License v2 or later\n"
2276 "\\&\n"
2277 " Create a child process that executes a shell command in new\n"
2278 " namespace(s); allow UID and GID mappings to be specified when\n"
2279 " creating a user namespace.\n"
2280 "*/\n"
2281 "#define _GNU_SOURCE\n"
2282 "#include E<lt>err.hE<gt>\n"
2283 "#include E<lt>sched.hE<gt>\n"
2284 "#include E<lt>unistd.hE<gt>\n"
2285 "#include E<lt>stdint.hE<gt>\n"
2286 "#include E<lt>stdlib.hE<gt>\n"
2287 "#include E<lt>sys/wait.hE<gt>\n"
2288 "#include E<lt>signal.hE<gt>\n"
2289 "#include E<lt>fcntl.hE<gt>\n"
2290 "#include E<lt>stdio.hE<gt>\n"
2291 "#include E<lt>string.hE<gt>\n"
2292 "#include E<lt>limits.hE<gt>\n"
2293 "#include E<lt>errno.hE<gt>\n"
2294 "\\&\n"
2295 "struct child_args {\n"
2296 " char **argv; /* Command to be executed by child, with args */\n"
2297 " int pipe_fd[2]; /* Pipe used to synchronize parent and child */\n"
2298 "};\n"
2299 "\\&\n"
2300 "static int verbose;\n"
2301 "\\&\n"
2302 "static void\n"
2303 "usage(char *pname)\n"
2304 "{\n"
2305 " fprintf(stderr, \"Usage: %s [options] cmd [arg...]\\[rs]n\\[rs]n\", pname);\n"
2306 " fprintf(stderr, \"Create a child process that executes a shell \"\n"
2307 " \"command in a new user namespace,\\[rs]n\"\n"
2308 " \"and possibly also other new namespace(s).\\[rs]n\\[rs]n\");\n"
2309 " fprintf(stderr, \"Options can be:\\[rs]n\\[rs]n\");\n"
2310 "#define fpe(str) fprintf(stderr, \" %s\", str);\n"
2311 " fpe(\"-i New IPC namespace\\[rs]n\");\n"
2312 " fpe(\"-m New mount namespace\\[rs]n\");\n"
2313 " fpe(\"-n New network namespace\\[rs]n\");\n"
2314 " fpe(\"-p New PID namespace\\[rs]n\");\n"
2315 " fpe(\"-u New UTS namespace\\[rs]n\");\n"
2316 " fpe(\"-U New user namespace\\[rs]n\");\n"
2317 " fpe(\"-M uid_map Specify UID map for user namespace\\[rs]n\");\n"
2318 " fpe(\"-G gid_map Specify GID map for user namespace\\[rs]n\");\n"
2319 " fpe(\"-z Map user\\[aq]s UID and GID to 0 in user namespace\\[rs]n\");\n"
2320 " fpe(\" (equivalent to: -M \\[aq]0 E<lt>uidE<gt> 1\\[aq] -G \\[aq]0 E<lt>gidE<gt> 1\\[aq])\\[rs]n\");\n"
2321 " fpe(\"-v Display verbose messages\\[rs]n\");\n"
2322 " fpe(\"\\[rs]n\");\n"
2323 " fpe(\"If -z, -M, or -G is specified, -U is required.\\[rs]n\");\n"
2324 " fpe(\"It is not permitted to specify both -z and either -M or -G.\\[rs]n\");\n"
2325 " fpe(\"\\[rs]n\");\n"
2326 " fpe(\"Map strings for -M and -G consist of records of the form:\\[rs]n\");\n"
2327 " fpe(\"\\[rs]n\");\n"
2328 " fpe(\" ID-inside-ns ID-outside-ns size\\[rs]n\");\n"
2329 " fpe(\"\\[rs]n\");\n"
2330 " fpe(\"A map string can contain multiple records, separated\"\n"
2331 " \" by commas;\\[rs]n\");\n"
2332 " fpe(\"the commas are replaced by newlines before writing\"\n"
2333 " \" to map files.\\[rs]n\");\n"
2334 "\\&\n"
2335 " exit(EXIT_FAILURE);\n"
2336 "}\n"
2337 "\\&\n"
2338 "/* Update the mapping file \\[aq]map_file\\[aq], with the value provided in\n"
2339 " \\[aq]mapping\\[aq], a string that defines a UID or GID mapping. A UID or\n"
2340 " GID mapping consists of one or more newline-delimited records\n"
2341 " of the form:\n"
2342 "\\&\n"
2343 " ID_inside-ns ID-outside-ns size\n"
2344 "\\&\n"
2345 " Requiring the user to supply a string that contains newlines is\n"
2346 " of course inconvenient for command-line use. Thus, we permit the\n"
2347 " use of commas to delimit records in this string, and replace them\n"
2348 " with newlines before writing the string to the file. */\n"
2349 "\\&\n"
2350 "static void\n"
2351 "update_map(char *mapping, char *map_file)\n"
2352 "{\n"
2353 " int fd;\n"
2354 " size_t map_len; /* Length of \\[aq]mapping\\[aq] */\n"
2355 "\\&\n"
2356 " /* Replace commas in mapping string with newlines. */\n"
2357 "\\&\n"
2358 " map_len = strlen(mapping);\n"
2359 " for (size_t j = 0; j E<lt> map_len; j++)\n"
2360 " if (mapping[j] == \\[aq],\\[aq])\n"
2361 " mapping[j] = \\[aq]\\[rs]n\\[aq];\n"
2362 "\\&\n"
2363 " fd = open(map_file, O_RDWR);\n"
2364 " if (fd == -1) {\n"
2365 " fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", map_file,\n"
2366 " strerror(errno));\n"
2367 " exit(EXIT_FAILURE);\n"
2368 " }\n"
2369 "\\&\n"
2370 " if (write(fd, mapping, map_len) != map_len) {\n"
2371 " fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", map_file,\n"
2372 " strerror(errno));\n"
2373 " exit(EXIT_FAILURE);\n"
2374 " }\n"
2375 "\\&\n"
2376 " close(fd);\n"
2377 "}\n"
2378 "\\&\n"
2379 "/* Linux 3.19 made a change in the handling of setgroups(2) and\n"
2380 " the \\[aq]gid_map\\[aq] file to address a security issue. The issue\n"
2381 " allowed *unprivileged* users to employ user namespaces in\n"
2382 " order to drop groups. The upshot of the 3.19 changes is that\n"
2383 " in order to update the \\[aq]gid_maps\\[aq] file, use of the setgroups()\n"
2384 " system call in this user namespace must first be disabled by\n"
2385 " writing \"deny\" to one of the /proc/PID/setgroups files for\n"
2386 " this namespace. That is the purpose of the following function. */\n"
2387 "\\&\n"
2388 "static void\n"
2389 "proc_setgroups_write(pid_t child_pid, char *str)\n"
2390 "{\n"
2391 " char setgroups_path[PATH_MAX];\n"
2392 " int fd;\n"
2393 "\\&\n"
2394 " snprintf(setgroups_path, PATH_MAX, \"/proc/%jd/setgroups\",\n"
2395 " (intmax_t) child_pid);\n"
2396 "\\&\n"
2397 " fd = open(setgroups_path, O_RDWR);\n"
2398 " if (fd == -1) {\n"
2399 "\\&\n"
2400 " /* We may be on a system that doesn\\[aq]t support\n"
2401 " /proc/PID/setgroups. In that case, the file won\\[aq]t exist,\n"
2402 " and the system won\\[aq]t impose the restrictions that Linux 3.19\n"
2403 " added. That\\[aq]s fine: we don\\[aq]t need to do anything in order\n"
2404 " to permit \\[aq]gid_map\\[aq] to be updated.\n"
2405 "\\&\n"
2406 " However, if the error from open() was something other than\n"
2407 " the ENOENT error that is expected for that case, let the\n"
2408 " user know. */\n"
2409 "\\&\n"
2410 " if (errno != ENOENT)\n"
2411 " fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", setgroups_path,\n"
2412 " strerror(errno));\n"
2413 " return;\n"
2414 " }\n"
2415 "\\&\n"
2416 " if (write(fd, str, strlen(str)) == -1)\n"
2417 " fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", setgroups_path,\n"
2418 " strerror(errno));\n"
2419 "\\&\n"
2420 " close(fd);\n"
2421 "}\n"
2422 "\\&\n"
2423 "static int /* Start function for cloned child */\n"
2424 "childFunc(void *arg)\n"
2425 "{\n"
2426 " struct child_args *args = arg;\n"
2427 " char ch;\n"
2428 "\\&\n"
2429 " /* Wait until the parent has updated the UID and GID mappings.\n"
2430 " See the comment in main(). We wait for end of file on a\n"
2431 " pipe that will be closed by the parent process once it has\n"
2432 " updated the mappings. */\n"
2433 "\\&\n"
2434 " close(args-E<gt>pipe_fd[1]); /* Close our descriptor for the write\n"
2435 " end of the pipe so that we see EOF\n"
2436 " when parent closes its descriptor. */\n"
2437 " if (read(args-E<gt>pipe_fd[0], &ch, 1) != 0) {\n"
2438 " fprintf(stderr,\n"
2439 " \"Failure in child: read from pipe returned != 0\\[rs]n\");\n"
2440 " exit(EXIT_FAILURE);\n"
2441 " }\n"
2442 "\\&\n"
2443 " close(args-E<gt>pipe_fd[0]);\n"
2444 "\\&\n"
2445 " /* Execute a shell command. */\n"
2446 "\\&\n"
2447 " printf(\"About to exec %s\\[rs]n\", args-E<gt>argv[0]);\n"
2448 " execvp(args-E<gt>argv[0], args-E<gt>argv);\n"
2449 " err(EXIT_FAILURE, \"execvp\");\n"
2450 "}\n"
2451 "\\&\n"
2452 "#define STACK_SIZE (1024 * 1024)\n"
2453 "\\&\n"
2454 "static char child_stack[STACK_SIZE]; /* Space for child\\[aq]s stack */\n"
2455 "\\&\n"
2456 "int\n"
2457 "main(int argc, char *argv[])\n"
2458 "{\n"
2459 " int flags, opt, map_zero;\n"
2460 " pid_t child_pid;\n"
2461 " struct child_args args;\n"
2462 " char *uid_map, *gid_map;\n"
2463 " const int MAP_BUF_SIZE = 100;\n"
2464 " char map_buf[MAP_BUF_SIZE];\n"
2465 " char map_path[PATH_MAX];\n"
2466 "\\&\n"
2467 " /* Parse command-line options. The initial \\[aq]+\\[aq] character in\n"
2468 " the final getopt() argument prevents GNU-style permutation\n"
2469 " of command-line options. That\\[aq]s useful, since sometimes\n"
2470 " the \\[aq]command\\[aq] to be executed by this program itself\n"
2471 " has command-line options. We don\\[aq]t want getopt() to treat\n"
2472 " those as options to this program. */\n"
2473 "\\&\n"
2474 " flags = 0;\n"
2475 " verbose = 0;\n"
2476 " gid_map = NULL;\n"
2477 " uid_map = NULL;\n"
2478 " map_zero = 0;\n"
2479 " while ((opt = getopt(argc, argv, \"+imnpuUM:G:zv\")) != -1) {\n"
2480 " switch (opt) {\n"
2481 " case \\[aq]i\\[aq]: flags |= CLONE_NEWIPC; break;\n"
2482 " case \\[aq]m\\[aq]: flags |= CLONE_NEWNS; break;\n"
2483 " case \\[aq]n\\[aq]: flags |= CLONE_NEWNET; break;\n"
2484 " case \\[aq]p\\[aq]: flags |= CLONE_NEWPID; break;\n"
2485 " case \\[aq]u\\[aq]: flags |= CLONE_NEWUTS; break;\n"
2486 " case \\[aq]v\\[aq]: verbose = 1; break;\n"
2487 " case \\[aq]z\\[aq]: map_zero = 1; break;\n"
2488 " case \\[aq]M\\[aq]: uid_map = optarg; break;\n"
2489 " case \\[aq]G\\[aq]: gid_map = optarg; break;\n"
2490 " case \\[aq]U\\[aq]: flags |= CLONE_NEWUSER; break;\n"
2491 " default: usage(argv[0]);\n"
2492 " }\n"
2493 " }\n"
2494 "\\&\n"
2495 " /* -M or -G without -U is nonsensical */\n"
2496 "\\&\n"
2497 " if (((uid_map != NULL || gid_map != NULL || map_zero) &&\n"
2498 " !(flags & CLONE_NEWUSER)) ||\n"
2499 " (map_zero && (uid_map != NULL || gid_map != NULL)))\n"
2500 " usage(argv[0]);\n"
2501 "\\&\n"
2502 " args.argv = &argv[optind];\n"
2503 "\\&\n"
2504 " /* We use a pipe to synchronize the parent and child, in order to\n"
2505 " ensure that the parent sets the UID and GID maps before the child\n"
2506 " calls execve(). This ensures that the child maintains its\n"
2507 " capabilities during the execve() in the common case where we\n"
2508 " want to map the child\\[aq]s effective user ID to 0 in the new user\n"
2509 " namespace. Without this synchronization, the child would lose\n"
2510 " its capabilities if it performed an execve() with nonzero\n"
2511 " user IDs (see the capabilities(7) man page for details of the\n"
2512 " transformation of a process\\[aq]s capabilities during execve()). */\n"
2513 "\\&\n"
2514 " if (pipe(args.pipe_fd) == -1)\n"
2515 " err(EXIT_FAILURE, \"pipe\");\n"
2516 "\\&\n"
2517 " /* Create the child in new namespace(s). */\n"
2518 "\\&\n"
2519 " child_pid = clone(childFunc, child_stack + STACK_SIZE,\n"
2520 " flags | SIGCHLD, &args);\n"
2521 " if (child_pid == -1)\n"
2522 " err(EXIT_FAILURE, \"clone\");\n"
2523 "\\&\n"
2524 " /* Parent falls through to here. */\n"
2525 "\\&\n"
2526 " if (verbose)\n"
2527 " printf(\"%s: PID of child created by clone() is %jd\\[rs]n\",\n"
2528 " argv[0], (intmax_t) child_pid);\n"
2529 "\\&\n"
2530 " /* Update the UID and GID maps in the child. */\n"
2531 "\\&\n"
2532 " if (uid_map != NULL || map_zero) {\n"
2533 " snprintf(map_path, PATH_MAX, \"/proc/%jd/uid_map\",\n"
2534 " (intmax_t) child_pid);\n"
2535 " if (map_zero) {\n"
2536 " snprintf(map_buf, MAP_BUF_SIZE, \"0 %jd 1\",\n"
2537 " (intmax_t) getuid());\n"
2538 " uid_map = map_buf;\n"
2539 " }\n"
2540 " update_map(uid_map, map_path);\n"
2541 " }\n"
2542 "\\&\n"
2543 " if (gid_map != NULL || map_zero) {\n"
2544 " proc_setgroups_write(child_pid, \"deny\");\n"
2545 "\\&\n"
2546 " snprintf(map_path, PATH_MAX, \"/proc/%jd/gid_map\",\n"
2547 " (intmax_t) child_pid);\n"
2548 " if (map_zero) {\n"
2549 " snprintf(map_buf, MAP_BUF_SIZE, \"0 %ld 1\",\n"
2550 " (intmax_t) getgid());\n"
2551 " gid_map = map_buf;\n"
2552 " }\n"
2553 " update_map(gid_map, map_path);\n"
2554 " }\n"
2555 "\\&\n"
2556 " /* Close the write end of the pipe, to signal to the child that we\n"
2557 " have updated the UID and GID maps. */\n"
2558 "\\&\n"
2559 " close(args.pipe_fd[1]);\n"
2560 "\\&\n"
2561 " if (waitpid(child_pid, NULL, 0) == -1) /* Wait for child */\n"
2562 " err(EXIT_FAILURE, \"waitpid\");\n"
2563 "\\&\n"
2564 " if (verbose)\n"
2565 " printf(\"%s: terminating\\[rs]n\", argv[0]);\n"
2566 "\\&\n"
2567 " exit(EXIT_SUCCESS);\n"
2568 "}\n"
2569 msgstr ""
2570
2571 #. type: SH
2572 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2573 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2574 #, no-wrap
2575 msgid "SEE ALSO"
2576 msgstr "СМОТРИТЕ ТАКЖЕ"
2577
2578 #. From the shadow package
2579 #. From the shadow package
2580 #. From the shadow package
2581 #. From the shadow package
2582 #. type: Plain text
2583 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2584 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2585 msgid ""
2586 "B<newgidmap>(1), B<newuidmap>(1), B<clone>(2), B<ptrace>(2), B<setns>(2), "
2587 "B<unshare>(2), B<proc>(5), B<subgid>(5), B<subuid>(5), B<capabilities>(7), "
2588 "B<cgroup_namespaces>(7), B<credentials>(7), B<namespaces>(7), "
2589 "B<pid_namespaces>(7)"
2590 msgstr ""
2591 "B<newgidmap>(1), B<newuidmap>(1), B<clone>(2), B<ptrace>(2), B<setns>(2), "
2592 "B<unshare>(2), B<proc>(5), B<subgid>(5), B<subuid>(5), B<capabilities>(7), "
2593 "B<cgroup_namespaces>(7), B<credentials>(7), B<namespaces>(7), "
2594 "B<pid_namespaces>(7)"
2595
2596 #. type: Plain text
2597 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2598 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2599 msgid ""
2600 "The kernel source file I<Documentation/admin-guide/namespaces/resource-"
2601 "control.rst>."
2602 msgstr ""
2603 "Файл из дерева исходного кода ядра I<Documentation/admin-guide/namespaces/"
2604 "resource-control.rst>."
2605
2606 #. type: TH
2607 #: debian-trixie
2608 #, no-wrap
2609 msgid "2024-06-15"
2610 msgstr "15 июня 2024 г."
2611
2612 #. type: TH
2613 #: debian-trixie
2614 #, no-wrap
2615 msgid "Linux man-pages 6.9.1"
2616 msgstr "Страницы руководства Linux 6.9.1"
2617
2618 #. type: Plain text
2619 #: debian-trixie fedora-44 fedora-rawhide
2620 #, fuzzy
2621 #| msgid ""
2622 #| "User namespaces can be nested; that is, each user namespace\\(emexcept "
2623 #| "the initial (\"root\") namespace\\(emhas a parent user namespace, and "
2624 #| "can have zero or more child user namespaces. The parent user namespace "
2625 #| "is the user namespace of the process that creates the user namespace via "
2626 #| "a call to B<unshare>(2) or B<clone>(2) with the B<CLONE_NEWUSER> flag."
2627 msgid ""
2628 "User namespaces can be nested; that is, each user namespace\\[em]except the "
2629 "initial (\"root\") namespace\\[em]has a parent user namespace, and can have "
2630 "zero or more child user namespaces. The parent user namespace is the user "
2631 "namespace of the process that creates the user namespace via a call to "
2632 "B<unshare>(2) or B<clone>(2) with the B<CLONE_NEWUSER> flag."
2633 msgstr ""
2634 "Пользовательские пространства имён могут быть вложенными, то есть каждое "
2635 "пользовательское пространство имён — за исключением первого («корневого») — "
2636 "имеет родительское пространство имён и может иметь ноль или более дочерних "
2637 "пространств имён. Родительское пространство имён — это пользовательское "
2638 "пространство имён процесса, которое создаётся с помощью вызова B<unshare>(2) "
2639 "или B<clone>(2) с флагом B<CLONE_NEWUSER>."
2640
2641 #. commit 8742f229b635bf1c1c84a3dfe5e47c814c20b5c8
2642 #. FIXME Explain the rationale for this limit. (What is the rationale?)
2643 #. type: Plain text
2644 #: debian-trixie fedora-44 fedora-rawhide
2645 #, fuzzy
2646 #| msgid ""
2647 #| "The kernel imposes (since version 3.11) a limit of 32 nested levels of "
2648 #| "user namespaces. Calls to B<unshare>(2) or B<clone>(2) that would "
2649 #| "cause this limit to be exceeded fail with the error B<EUSERS>."
2650 msgid ""
2651 "The kernel imposes (since Linux 3.11) a limit of 32 nested levels of user "
2652 "namespaces. Calls to B<unshare>(2) or B<clone>(2) that would cause this "
2653 "limit to be exceeded fail with the error B<EUSERS>."
2654 msgstr ""
2655 "Ядро ограничивает (начиная с версии 3.11) глубину вложенности "
2656 "пользовательских пространств имён 32 уровнями. Вызовы B<unshare>(2) или "
2657 "B<clone>(2), которые бы превысили это ограничение, завершаются с ошибкой "
2658 "B<EUSERS>."
2659
2660 #
2661 #. ============================================================
2662 #. type: Plain text
2663 #: debian-trixie fedora-44 fedora-rawhide
2664 msgid ""
2665 "A task that changes one of its effective IDs will have its dumpability reset "
2666 "to the value in I</proc/sys/fs/suid_dumpable>. This may affect the "
2667 "ownership of proc files of child processes and may thus cause the parent to "
2668 "lack the permissions to write to mapping files of child processes running in "
2669 "a new user namespace. In such cases making the parent process dumpable, "
2670 "using B<PR_SET_DUMPABLE> in a call to B<prctl>(2), before creating a child "
2671 "process in a new user namespace may rectify this problem. See B<prctl>(2) "
2672 "and B<proc>(5) for details on how ownership is affected."
2673 msgstr ""
2674
2675 #. type: Plain text
2676 #: debian-trixie fedora-44 fedora-rawhide
2677 #, fuzzy
2678 #| msgid ""
2679 #| "A call to B<clone>(2), B<unshare>(2), or B<setns>(2) using the "
2680 #| "B<CLONE_NEWUSER> flag sets the \"securebits\" flags (see "
2681 #| "B<capabilities>(7)) to their default values (all flags disabled) in the "
2682 #| "child (for B<clone>(2)) or caller (for B<unshare>(2), or B<setns>(2)). "
2683 #| "Note that because the caller no longer has capabilities in its original "
2684 #| "user namespace after a call to B<setns>(2), it is not possible for a "
2685 #| "process to reset its \"securebits\" flags while retaining its user "
2686 #| "namespace membership by using a pair of B<setns>(2) calls to move to "
2687 #| "another user namespace and then return to its original user namespace."
2688 msgid ""
2689 "A call to B<clone>(2) or B<unshare>(2) using the B<CLONE_NEWUSER> flag or "
2690 "a call to B<setns>(2) that moves the caller into another user namespace "
2691 "sets the \"securebits\" flags (see B<capabilities>(7)) to their default "
2692 "values (all flags disabled) in the child (for B<clone>(2)) or caller (for "
2693 "B<unshare>(2) or B<setns>(2)). Note that because the caller no longer has "
2694 "capabilities in its original user namespace after a call to B<setns>(2), it "
2695 "is not possible for a process to reset its \"securebits\" flags while "
2696 "retaining its user namespace membership by using a pair of B<setns>(2) "
2697 "calls to move to another user namespace and then return to its original user "
2698 "namespace."
2699 msgstr ""
2700 "Вызов B<clone>(2), B<unshare>(2) или B<setns>(2) с флагом B<CLONE_NEWUSER> "
2701 "устанавливает флаги «securebits» (смотрите B<capabilities>(7)) в их значения "
2702 "по умолчанию (все флаги сброшены) в потомке (для B<clone>(2)) или вызывающем "
2703 "(для B<unshare>(2) или B<setns>(2)). Заметим, что из-то того, что вызывающий "
2704 "больше не имеет мандатов в своём первоначальном пользовательском "
2705 "пространстве имён после вызова B<setns>(2), невозможно у процесса сбросить "
2706 "его флаги «securebits», хотя удержать своё членство в пользовательском "
2707 "пространстве имён можно с помощью пары вызовов B<setns>(2) — сначала "
2708 "переместиться в другое пользовательское пространство имён и затем вернуться "
2709 "в своё первоначальное пользовательское пространство имён."
2710
2711 #. type: Plain text
2712 #: debian-trixie fedora-44 fedora-rawhide
2713 msgid ""
2714 "If a process has a capability in a user namespace, then it has that "
2715 "capability in all child (and further removed descendant) namespaces as well."
2716 msgstr ""
2717 "Если процесс имеет мандат в пользовательском пространстве имён, то он также "
2718 "имеет этот мандат во всех дочерних (и позже удалённых потомках) "
2719 "пространствах имён."
2720
2721 #. type: Plain text
2722 #: debian-trixie fedora-44 fedora-rawhide
2723 msgid ""
2724 "Having a capability inside a user namespace permits a process to perform "
2725 "operations (that require privilege) only on resources governed by that "
2726 "namespace. In other words, having a capability in a user namespace permits "
2727 "a process to perform privileged operations on resources that are governed by "
2728 "(nonuser) namespaces owned by (associated with) the user namespace (see the "
2729 "next subsection)."
2730 msgstr ""
2731 "Наличие мандата внутри пространства имён пользователя разрешает процессу "
2732 "выполнять операции (требующие привилегий) с ресурсами, управляемыми только "
2733 "этим пространством имён. Иначе говоря, наличие мандата в пользовательском "
2734 "пространстве имён разрешает процессу выполнять привилегированные операции с "
2735 "ресурсами, которые управляются (не пользовательскими) пространствами имён, "
2736 "принадлежащими (связанными с) пространству имён пользователя (смотрите "
2737 "следующий подраздел)."
2738
2739 #. type: Plain text
2740 #: debian-trixie
2741 #, fuzzy
2742 #| msgid ""
2743 #| "Holding B<CAP_SYS_ADMIN> within the user namespace that owns a process's "
2744 #| "cgroup namespace allows (since Linux 4.6) that process to the mount the "
2745 #| "cgroup version 2 filesystem and cgroup version 1 named hierarchies (i.e., "
2746 #| "cgroup filesystems mounted with the I<\"none,name=\"> option)."
2747 msgid ""
2748 "Holding B<CAP_SYS_ADMIN> within the user namespace that owns a process's "
2749 "cgroup namespace allows (since Linux 4.6) that process to the mount the "
2750 "cgroup version 2 filesystem and cgroup version 1 named hierarchies (i.e., "
2751 "cgroup filesystems mounted with the I<\\[dq]none,name=\\[dq]> option)."
2752 msgstr ""
2753 "Наличие B<CAP_SYS_ADMIN> внутри пользовательского пространства имён, "
2754 "принадлежащему пространству имён cgroup процесса, позволяет (начиная с Linux "
2755 "4.6) этому процессу монтировать именованные иерархии файловой системы cgroup "
2756 "версии 2 и cgroup версии 1 (т. е., файловые системы cgroup, монтируемые с "
2757 "параметром I<\"none,name=\">)."
2758
2759 #. ============================================================
2760 #. type: Plain text
2761 #: debian-trixie fedora-44 fedora-rawhide
2762 msgid ""
2763 "Note, however, that mounting block-based filesystems can be done only by a "
2764 "process that holds B<CAP_SYS_ADMIN> in the initial user namespace."
2765 msgstr ""
2766 "Однако заметим, что монтирование блочных файловых систем может производиться "
2767 "только процессом, имеющим B<CAP_SYS_ADMIN> в начальном пространстве имён "
2768 "пользователя."
2769
2770 #. type: Plain text
2771 #: debian-trixie
2772 msgid ""
2773 "Starting in Linux 3.8, unprivileged processes can create user namespaces, "
2774 "and the other types of namespaces can be created with just the "
2775 "B<CAP_SYS_ADMIN> capability in the caller's user namespace."
2776 msgstr ""
2777 "Начиная с Linux 3.8, непривилегированные процессы могут создавать "
2778 "пользовательские пространства имён, а для создания пространств имён других "
2779 "типов требуется мандат B<CAP_SYS_ADMIN> в пользовательском пространстве имён "
2780 "вызывающего."
2781
2782 #. type: Plain text
2783 #: debian-trixie fedora-44 fedora-rawhide
2784 msgid ""
2785 "When a new namespace (other than a user namespace) is created via "
2786 "B<clone>(2) or B<unshare>(2), the kernel records the user namespace of the "
2787 "creating process as the owner of the new namespace. (This association can't "
2788 "be changed.) When a process in the new namespace subsequently performs "
2789 "privileged operations that operate on global resources isolated by the "
2790 "namespace, the permission checks are performed according to the process's "
2791 "capabilities in the user namespace that the kernel associated with the new "
2792 "namespace. For example, suppose that a process attempts to change the "
2793 "hostname (B<sethostname>(2)), a resource governed by the UTS namespace. In "
2794 "this case, the kernel will determine which user namespace owns the process's "
2795 "UTS namespace, and check whether the process has the required capability "
2796 "(B<CAP_SYS_ADMIN>) in that user namespace."
2797 msgstr ""
2798 "При создании нового пространства имён (не пользовательского пространства "
2799 "имён) посредством B<clone>(2) или B<unshare>(2), ядро записывает "
2800 "пользовательское пространство имён создающего процесса как владельца нового "
2801 "пространства имён (эту связь нельзя изменить). Когда процесс в новом "
2802 "пространстве имён в дальнейшем выполняет привилегированные операции, которые "
2803 "работают с глобальными ресурсами, изолированными пространством имён, "
2804 "выполняется проверка прав согласно мандатам процесса в пользовательском "
2805 "пространстве имён, которое ядро связало с новым пространством имён. "
2806 "Например, предположим, что процесс пытается изменить имя узла "
2807 "(B<sethostname>(2)) — ресурс, управляемый пространство имён UTS. В этом "
2808 "случае, ядро будет искать пространство имён пользователя, принадлежащее "
2809 "пространству имён UTS процесса, и проверять что процесс имеет необходимый "
2810 "мандат (B<CAP_SYS_ADMIN>) в этом пространстве имён пользователя."
2811
2812 #. type: Plain text
2813 #: debian-trixie
2814 msgid ""
2815 "Each line in the I<uid_map> file specifies a 1-to-1 mapping of a range of "
2816 "contiguous user IDs between two user namespaces. (When a user namespace is "
2817 "first created, this file is empty.) The specification in each line takes "
2818 "the form of three numbers delimited by white space. The first two numbers "
2819 "specify the starting user ID in each of the two user namespaces. The third "
2820 "number specifies the length of the mapped range. In detail, the fields are "
2821 "interpreted as follows:"
2822 msgstr ""
2823 "Каждая строка в файле I<uid_map> определяет отображение 1-в-1 непрерывного "
2824 "диапазона пользовательских ID между двумя пользовательскими пространствами "
2825 "имён (при создании пользовательского пространства имён этот файл пуст). В "
2826 "каждой строке содержится три числа через пробел. Первые два числа определяют "
2827 "начальный пользовательский ID в каждом из двух пользовательских пространств "
2828 "имён. Третье число определяет длину отображаемого диапазона. Эти поля "
2829 "рассматриваются так:"
2830
2831 #. type: Plain text
2832 #: debian-trixie
2833 msgid ""
2834 "The length of the range of user IDs that is mapped between the two user "
2835 "namespaces."
2836 msgstr ""
2837 "Длина диапазона пользовательских ID, выполняющего отображение между двумя "
2838 "пользовательскими пространствами имён."
2839
2840 #. type: Plain text
2841 #: debian-trixie fedora-44 fedora-rawhide
2842 msgid ""
2843 "The initial user namespace has no parent namespace, but, for consistency, "
2844 "the kernel provides dummy user and group ID mapping files for this "
2845 "namespace. Looking at the I<uid_map> file (I<gid_map> is the same) from a "
2846 "shell in the initial namespace shows:"
2847 msgstr ""
2848 "Начальное пользовательское пространство имён не имеет родительского "
2849 "пространства имён, но для однородности, для него ядро предоставляет "
2850 "фиктивные файлы отображения ID пользователей и групп. Посмотрим на файл "
2851 "I<uid_map> (в I<gid_map> тоже самое) из оболочки в начальном пространстве "
2852 "имён:"
2853
2854 #. type: Plain text
2855 #: debian-trixie fedora-44 fedora-rawhide
2856 #, no-wrap
2857 msgid ""
2858 "$ B<cat /proc/$$/uid_map>\n"
2859 " 0 0 4294967295\n"
2860 msgstr ""
2861 "$ B<cat /proc/$$/uid_map>\n"
2862 " 0 0 4294967295\n"
2863
2864 #. ============================================================
2865 #. type: Plain text
2866 #: debian-trixie
2867 #, fuzzy
2868 #| msgid ""
2869 #| "This mapping tells us that the range starting at user ID 0 in this "
2870 #| "namespace maps to a range starting at 0 in the (nonexistent) parent "
2871 #| "namespace, and the length of the range is the largest 32-bit unsigned "
2872 #| "integer. This leaves 4294967295 (the 32-bit signed -1 value) unmapped. "
2873 #| "This is deliberate: I<(uid_t)\\~-1> is used in several interfaces (e.g., "
2874 #| "B<setreuid>(2)) as a way to specify \"no user ID\". Leaving I<(uid_t)"
2875 #| "\\~-1> unmapped and unusable guarantees that there will be no confusion "
2876 #| "when using these interfaces."
2877 msgid ""
2878 "This mapping tells us that the range starting at user ID 0 in this namespace "
2879 "maps to a range starting at 0 in the (nonexistent) parent namespace, and the "
2880 "length of the range is the largest 32-bit unsigned integer. This leaves "
2881 "4294967295 (the 32-bit signed -1 value) unmapped. This is deliberate: "
2882 "I<(uid_t)\\ -1> is used in several interfaces (e.g., B<setreuid>(2)) as a "
2883 "way to specify \"no user ID\". Leaving I<(uid_t)\\ -1> unmapped and "
2884 "unusable guarantees that there will be no confusion when using these "
2885 "interfaces."
2886 msgstr ""
2887 "Данное отображение показывает, что диапазон начинающийся с пользовательского "
2888 "ID 0 в этом пространстве имён, отображается в диапазон, начинающийся, с 0, в "
2889 "(несуществующее) родительское пространство имён, и длина диапазона равна "
2890 "самому большому 32-битному беззнаковому целому. Значение 4294967295 (32-"
2891 "битное знаковое значение -1) оставлено без отображения. Предназначение: "
2892 "I<(uid_t)\\~-\\1> используется в некоторых интерфейсах (например, "
2893 "B<setreuid>(2)) для указания «отсутствия ID пользователя». Оставление "
2894 "I<(uid_t)\\~-\\1> без отображения и его не использование гарантирует, что "
2895 "при использовании этих интерфейсов не будет проблем)."
2896
2897 #. 5*12-byte records could fit in a 64B cache line
2898 #. commit 6397fac4915ab3002dc15aae751455da1a852f25
2899 #. type: Plain text
2900 #: debian-trixie fedora-44 fedora-rawhide
2901 msgid ""
2902 "There is a limit on the number of lines in the file. In Linux 4.14 and "
2903 "earlier, this limit was (arbitrarily) set at 5 lines. Since Linux 4.15, "
2904 "the limit is 340 lines. In addition, the number of bytes written to the "
2905 "file must be less than the system page size, and the write must be performed "
2906 "at the start of the file (i.e., B<lseek>(2) and B<pwrite>(2) can't be used "
2907 "to write to nonzero offsets in the file)."
2908 msgstr ""
2909 "Существует ограничение на количество строк в файле. В Linux 4.14 и старее "
2910 "оно установлено (произвольно) равным пятью строкам. Начиная с Linux 4.14 его "
2911 "значение равно 340 строкам. Также, количество байт, записываемых в файл, "
2912 "должно быть меньше размера системной страницы, и запись должна выполняться в "
2913 "начало файла (т. е., нельзя использовать B<lseek>(2) и B<pwrite>(2) для "
2914 "записи в файл при ненулевом смещении)."
2915
2916 #. commit 0bd14b4fd72afd5df41e9fd59f356740f22fceba
2917 #. type: Plain text
2918 #: debian-trixie fedora-44 fedora-rawhide
2919 msgid ""
2920 "The range of user IDs (group IDs) specified in each line cannot overlap "
2921 "with the ranges in any other lines. In the initial implementation (Linux "
2922 "3.8), this requirement was satisfied by a simplistic implementation that "
2923 "imposed the further requirement that the values in both field 1 and field 2 "
2924 "of successive lines must be in ascending numerical order, which prevented "
2925 "some otherwise valid maps from being created. Linux 3.9 and later fix this "
2926 "limitation, allowing any valid set of nonoverlapping maps."
2927 msgstr ""
2928 "Диапазон пользовательских ID (групповых ID), указанный в каждой строке, не "
2929 "должен перекрываться с диапазонами в других строках. В первой реализации "
2930 "(Linux 3.8) это требование удовлетворялось простейшим способом, который "
2931 "задавал другое требование: значения в полях 1 и 2 следующих одна за одной "
2932 "строк, должны увеличиваться, что не давало создавать некоторые корректные "
2933 "отображения. В Linux 3.9 и новее это ограничение было снято, и допустим "
2934 "любой набор не перекрывающихся отображений."
2935
2936 #. type: Plain text
2937 #: debian-trixie fedora-44 fedora-rawhide
2938 msgid ""
2939 "The data written to I<uid_map> (I<gid_map>) must consist of a single line "
2940 "that maps the writing process's effective user ID (group ID) in the parent "
2941 "user namespace to a user ID (group ID) in the user namespace."
2942 msgstr ""
2943 "Данные, записываемые в I<uid_map> (I<gid_map>), должны состоять из одной "
2944 "строки, которая отображает эффективный пользовательский ID (групповой ID) "
2945 "записывающего процесса в родительском пользовательском пространстве имён в "
2946 "пользовательский ID (групповой ID) в пользовательском пространстве имён."
2947
2948 #. type: Plain text
2949 #: debian-trixie fedora-44 fedora-rawhide
2950 #, fuzzy
2951 #| msgid ""
2952 #| "In the case of I<gid_map>, use of the B<setgroups>(2) system call must "
2953 #| "first be denied by writing \"I<deny>\" to the I</proc/>pidI</setgroups> "
2954 #| "file (see below) before writing to I<gid_map>."
2955 msgid ""
2956 "In the case of I<gid_map>, use of the B<setgroups>(2) system call must "
2957 "first be denied by writing \\[dq]I<deny>\\[dq] to the I</proc/>pidI</"
2958 "setgroups> file (see below) before writing to I<gid_map>."
2959 msgstr ""
2960 "В случае I<gid_map>, перед записью в I<gid_map> сначала нужно использовать "
2961 "системный B<setgroups>(2) для записи \"I<deny>\" в файл I</proc/>pidI</"
2962 "setgroups> (смотрите ниже)."
2963
2964 #. type: SS
2965 #: debian-trixie fedora-44 fedora-rawhide
2966 #, fuzzy, no-wrap
2967 #| msgid "The /proc/[pid]/setgroups file"
2968 msgid "The I</proc/>pidI</setgroups> file"
2969 msgstr "Файл /proc/[pid]/setgroups"
2970
2971 #. type: Plain text
2972 #: debian-trixie fedora-44 fedora-rawhide
2973 #, fuzzy
2974 #| msgid ""
2975 #| "A privileged process (one with the B<CAP_SYS_ADMIN> capability in the "
2976 #| "namespace) may write either of the strings \"I<allow>\" or \"I<deny>\" to "
2977 #| "this file I<before> writing a group ID mapping for this user namespace to "
2978 #| "the file I</proc/>pidI</gid_map>. Writing the string \"I<deny>\" "
2979 #| "prevents any process in the user namespace from employing B<setgroups>(2)."
2980 msgid ""
2981 "A privileged process (one with the B<CAP_SYS_ADMIN> capability in the "
2982 "namespace) may write either of the strings \\[dq]I<allow>\\[dq] or \\"
2983 "[dq]I<deny>\\[dq] to this file I<before> writing a group ID mapping for this "
2984 "user namespace to the file I</proc/>pidI</gid_map>. Writing the string \\"
2985 "[dq]I<deny>\\[dq] prevents any process in the user namespace from employing "
2986 "B<setgroups>(2)."
2987 msgstr ""
2988 "Привилегированный процесс (с мандатом B<CAP_SYS_ADMIN> в пространстве имён) "
2989 "может записать строку \"I<allow>\" или \"I<deny>\" в этот файл I<до> записи "
2990 "отображения ID групп для этого пользовательского пространства имён в файл I</"
2991 "proc/>pidI</gid_map>. Запись строки \"I<deny>\" запрещает любому процессу в "
2992 "пользовательском пространстве имён выполнять B<setgroups>(2)."
2993
2994 #. type: Plain text
2995 #: debian-trixie fedora-44 fedora-rawhide
2996 #, fuzzy
2997 #| msgid ""
2998 #| "If the I<setgroups> file has the value \"I<deny>\", then the "
2999 #| "B<setgroups>(2) system call can't subsequently be reenabled (by writing "
3000 #| "\"I<allow>\" to the file) in this user namespace. (Attempts to do so "
3001 #| "fail with the error B<EPERM>.) This restriction also propagates down to "
3002 #| "all child user namespaces of this user namespace."
3003 msgid ""
3004 "If the I<setgroups> file has the value \\[dq]I<deny>\\[dq], then the "
3005 "B<setgroups>(2) system call can't subsequently be reenabled (by writing \\"
3006 "[dq]I<allow>\\[dq] to the file) in this user namespace. (Attempts to do so "
3007 "fail with the error B<EPERM>.) This restriction also propagates down to all "
3008 "child user namespaces of this user namespace."
3009 msgstr ""
3010 "Если файл I<setgroups> содержит значение \"I<deny>\", то системный вызов "
3011 "B<setgroups>(2) не может быть повторно включён в дальнейшем (записью "
3012 "\"I<allow>\" в файл) в этом пользовательском пространстве имён (попытка это "
3013 "сделать завершается ошибкой B<EPERM>). Это ограничение также "
3014 "распространяется на всех потомков пользовательского пространства имён этого "
3015 "пользовательского пространства имён."
3016
3017 #. /proc/PID/setgroups
3018 #. [allow == setgroups() is allowed, "deny" == setgroups() is disallowed]
3019 #. * Can write if have CAP_SYS_ADMIN in NS
3020 #. * Must write BEFORE writing to /proc/PID/gid_map
3021 #. setgroups()
3022 #. * Must already have written to gid_map
3023 #. * /proc/PID/setgroups must be "allow"
3024 #. /proc/PID/gid_map -- writing
3025 #. * Must already have written "deny" to /proc/PID/setgroups
3026 #. ============================================================
3027 #. type: Plain text
3028 #: debian-trixie fedora-44 fedora-rawhide
3029 #, fuzzy
3030 #| msgid ""
3031 #| "The I</proc/ pid /setgroups> file was added in Linux 3.19, but was "
3032 #| "backported to many earlier stable kernel series, because it addresses a "
3033 #| "security issue. The issue concerned files with permissions such as "
3034 #| "\"rwx---rwx\". Such files give fewer permissions to \"group\" than they "
3035 #| "do to \"other\". This means that dropping groups using B<setgroups>(2) "
3036 #| "might allow a process file access that it did not formerly have. Before "
3037 #| "the existence of user namespaces this was not a concern, since only a "
3038 #| "privileged process (one with the B<CAP_SETGID> capability) could call "
3039 #| "B<setgroups>(2). However, with the introduction of user namespaces, it "
3040 #| "became possible for an unprivileged process to create a new namespace in "
3041 #| "which the user had all privileges. This then allowed formerly "
3042 #| "unprivileged users to drop groups and thus gain file access that they did "
3043 #| "not previously have. The I</proc/>pidI</setgroups> file was added to "
3044 #| "address this security issue, by denying any pathway for an unprivileged "
3045 #| "process to drop groups with B<setgroups>(2)."
3046 msgid ""
3047 "The I</proc/>pidI</setgroups> file was added in Linux 3.19, but was "
3048 "backported to many earlier stable kernel series, because it addresses a "
3049 "security issue. The issue concerned files with permissions such as \"rwx---"
3050 "rwx\". Such files give fewer permissions to \"group\" than they do to "
3051 "\"other\". This means that dropping groups using B<setgroups>(2) might "
3052 "allow a process file access that it did not formerly have. Before the "
3053 "existence of user namespaces this was not a concern, since only a privileged "
3054 "process (one with the B<CAP_SETGID> capability) could call B<setgroups>(2). "
3055 "However, with the introduction of user namespaces, it became possible for an "
3056 "unprivileged process to create a new namespace in which the user had all "
3057 "privileges. This then allowed formerly unprivileged users to drop groups "
3058 "and thus gain file access that they did not previously have. The I</proc/"
3059 ">pidI</setgroups> file was added to address this security issue, by denying "
3060 "any pathway for an unprivileged process to drop groups with B<setgroups>(2)."
3061 msgstr ""
3062 "Файл I</proc/ pid /setgroups> был добавлен в Linux 3.19, но перенесён и в "
3063 "старшие серии ядра, так как служит для обеспечения безопасности. В "
3064 "частности, это влияет на файлы с правами доступа «rwx---rwx». Эти файлы "
3065 "меньшие права «группе» по сравнению с группой «остальные». Это означает, что "
3066 "удаление группы с помощью B<setgroups>(2) может открыть доступ к файлу, тем "
3067 "которые не имели его. До существования пользовательских пространств имён это "
3068 "не было проблемой, так как только привилегированный процесс (с мандатом "
3069 "B<CAP_SETGID>) мог вызывать B<setgroups>(2). Однако с введение "
3070 "пользовательских пространств имён стало возможным и непривилегированному "
3071 "процессу создавать новое пространство имён, в котором пользователь имеет все "
3072 "права. После этого ранее непривилегированный пользователь может удалить "
3073 "группы и таким образом получить доступ к файлу, которого раньше не имел. "
3074 "Файл I</proc/>pidI</setgroups> был добавлен для решения этой проблемы "
3075 "безопасности; он запрещает непривилегированному процессу удалять группы с "
3076 "помощью B<setgroups>(2)."
3077
3078 #. type: Plain text
3079 #: debian-trixie fedora-44 fedora-rawhide
3080 #, no-wrap
3081 msgid ""
3082 "$ B<uname -rs> # Need Linux 3.8 or later\n"
3083 "Linux 3.8.0\n"
3084 "$ B<id -u> # Running as unprivileged user\n"
3085 "1000\n"
3086 "$ B<id -g>\n"
3087 "1000\n"
3088 msgstr ""
3089 "$ B<uname -rs> # требуется Linux 3.8 или новее\n"
3090 "Linux 3.8.0\n"
3091 "$ B<id -u> # работа от непривилегированного пользователя\n"
3092 "1000\n"
3093 "$ B<id -g>\n"
3094 "1000\n"
3095
3096 #. type: Plain text
3097 #: debian-trixie fedora-44 fedora-rawhide
3098 #, fuzzy, no-wrap
3099 #| msgid "$ B<./userns_child_exec -p -m -U -M \\(aq0 1000 1\\(aq -G \\(aq0 1000 1\\(aq bash>\n"
3100 msgid "$ B<./userns_child_exec -p -m -U -M \\[aq]0 1000 1\\[aq] -G \\[aq]0 1000 1\\[aq] bash>\n"
3101 msgstr "$ B<./userns_child_exec -p -m -U -M \\(aq0 1000 1\\(aq -G \\(aq0 1000 1\\(aq bash>\n"
3102
3103 #. type: Plain text
3104 #: debian-trixie fedora-44 fedora-rawhide
3105 #, no-wrap
3106 msgid ""
3107 "bash$ B<echo $$>\n"
3108 "1\n"
3109 msgstr ""
3110 "bash$ B<echo $$>\n"
3111 "1\n"
3112
3113 #. type: Plain text
3114 #: debian-trixie fedora-44 fedora-rawhide
3115 #, no-wrap
3116 msgid ""
3117 "bash$ B<mount -t proc proc /proc>\n"
3118 "bash$ B<ps ax>\n"
3119 " PID TTY STAT TIME COMMAND\n"
3120 " 1 pts/3 S 0:00 bash\n"
3121 " 22 pts/3 R+ 0:00 ps ax\n"
3122 msgstr ""
3123 "bash$ B<mount -t proc proc /proc>\n"
3124 "bash$ B<ps ax>\n"
3125 " PID TTY STAT TIME COMMAND\n"
3126 " 1 pts/3 S 0:00 bash\n"
3127 " 22 pts/3 R+ 0:00 ps ax\n"
3128
3129 #. type: Plain text
3130 #: debian-trixie fedora-44 fedora-rawhide
3131 #, fuzzy, no-wrap
3132 #| msgid ""
3133 #| "bash$ B<cat /proc/$$/status | egrep \\(aq\\(ha[UG]id\\(aq>\n"
3134 #| "Uid:\t0\t0\t0\t0\n"
3135 #| "Gid:\t0\t0\t0\t0\n"
3136 #| "bash$ B<cat /proc/$$/status | egrep \\(aq\\(haCap(Prm|Inh|Eff)\\(aq>\n"
3137 #| "CapInh:\t0000000000000000\n"
3138 #| "CapPrm:\t0000001fffffffff\n"
3139 #| "CapEff:\t0000001fffffffff\n"
3140 msgid ""
3141 "bash$ B<cat /proc/$$/status | egrep \\[aq]\\[ha][UG]id\\[aq]>\n"
3142 "Uid:\t0\t0\t0\t0\n"
3143 "Gid:\t0\t0\t0\t0\n"
3144 "bash$ B<cat /proc/$$/status | egrep \\[aq]\\[ha]Cap(Prm|Inh|Eff)\\[aq]>\n"
3145 "CapInh:\t0000000000000000\n"
3146 "CapPrm:\t0000001fffffffff\n"
3147 "CapEff:\t0000001fffffffff\n"
3148 msgstr ""
3149 "bash$ B<cat /proc/$$/status | egrep \\(aq\\(ha[UG]id\\(aq>\n"
3150 "Uid:\t0\t0\t0\t0\n"
3151 "Gid:\t0\t0\t0\t0\n"
3152 "bash$ B<cat /proc/$$/status | egrep \\(aq\\(haCap(Prm|Inh|Eff)\\(aq>\n"
3153 "CapInh:\t0000000000000000\n"
3154 "CapPrm:\t0000001fffffffff\n"
3155 "CapEff:\t0000001fffffffff\n"
3156
3157 #. type: Plain text
3158 #: debian-trixie
3159 #, no-wrap
3160 msgid ""
3161 "/* userns_child_exec.c\n"
3162 "\\&\n"
3163 " Licensed under GNU General Public License v2 or later\n"
3164 "\\&\n"
3165 " Create a child process that executes a shell command in new\n"
3166 " namespace(s); allow UID and GID mappings to be specified when\n"
3167 " creating a user namespace.\n"
3168 "*/\n"
3169 "#define _GNU_SOURCE\n"
3170 "#include E<lt>err.hE<gt>\n"
3171 "#include E<lt>sched.hE<gt>\n"
3172 "#include E<lt>unistd.hE<gt>\n"
3173 "#include E<lt>stdint.hE<gt>\n"
3174 "#include E<lt>stdlib.hE<gt>\n"
3175 "#include E<lt>sys/wait.hE<gt>\n"
3176 "#include E<lt>signal.hE<gt>\n"
3177 "#include E<lt>fcntl.hE<gt>\n"
3178 "#include E<lt>stdio.hE<gt>\n"
3179 "#include E<lt>string.hE<gt>\n"
3180 "#include E<lt>limits.hE<gt>\n"
3181 "#include E<lt>errno.hE<gt>\n"
3182 "\\&\n"
3183 "struct child_args {\n"
3184 " char **argv; /* Command to be executed by child, with args */\n"
3185 " int pipe_fd[2]; /* Pipe used to synchronize parent and child */\n"
3186 "};\n"
3187 "\\&\n"
3188 "static int verbose;\n"
3189 "\\&\n"
3190 "static void\n"
3191 "usage(char *pname)\n"
3192 "{\n"
3193 " fprintf(stderr, \"Usage: %s [options] cmd [arg...]\\[rs]n\\[rs]n\", pname);\n"
3194 " fprintf(stderr, \"Create a child process that executes a shell \"\n"
3195 " \"command in a new user namespace,\\[rs]n\"\n"
3196 " \"and possibly also other new namespace(s).\\[rs]n\\[rs]n\");\n"
3197 " fprintf(stderr, \"Options can be:\\[rs]n\\[rs]n\");\n"
3198 "#define fpe(str) fprintf(stderr, \" %s\", str);\n"
3199 " fpe(\"-i New IPC namespace\\[rs]n\");\n"
3200 " fpe(\"-m New mount namespace\\[rs]n\");\n"
3201 " fpe(\"-n New network namespace\\[rs]n\");\n"
3202 " fpe(\"-p New PID namespace\\[rs]n\");\n"
3203 " fpe(\"-u New UTS namespace\\[rs]n\");\n"
3204 " fpe(\"-U New user namespace\\[rs]n\");\n"
3205 " fpe(\"-M uid_map Specify UID map for user namespace\\[rs]n\");\n"
3206 " fpe(\"-G gid_map Specify GID map for user namespace\\[rs]n\");\n"
3207 " fpe(\"-z Map user\\[aq]s UID and GID to 0 in user namespace\\[rs]n\");\n"
3208 " fpe(\" (equivalent to: -M \\[aq]0 E<lt>uidE<gt> 1\\[aq] -G \\[aq]0 E<lt>gidE<gt> 1\\[aq])\\[rs]n\");\n"
3209 " fpe(\"-v Display verbose messages\\[rs]n\");\n"
3210 " fpe(\"\\[rs]n\");\n"
3211 " fpe(\"If -z, -M, or -G is specified, -U is required.\\[rs]n\");\n"
3212 " fpe(\"It is not permitted to specify both -z and either -M or -G.\\[rs]n\");\n"
3213 " fpe(\"\\[rs]n\");\n"
3214 " fpe(\"Map strings for -M and -G consist of records of the form:\\[rs]n\");\n"
3215 " fpe(\"\\[rs]n\");\n"
3216 " fpe(\" ID-inside-ns ID-outside-ns len\\[rs]n\");\n"
3217 " fpe(\"\\[rs]n\");\n"
3218 " fpe(\"A map string can contain multiple records, separated\"\n"
3219 " \" by commas;\\[rs]n\");\n"
3220 " fpe(\"the commas are replaced by newlines before writing\"\n"
3221 " \" to map files.\\[rs]n\");\n"
3222 "\\&\n"
3223 " exit(EXIT_FAILURE);\n"
3224 "}\n"
3225 "\\&\n"
3226 "/* Update the mapping file \\[aq]map_file\\[aq], with the value provided in\n"
3227 " \\[aq]mapping\\[aq], a string that defines a UID or GID mapping. A UID or\n"
3228 " GID mapping consists of one or more newline-delimited records\n"
3229 " of the form:\n"
3230 "\\&\n"
3231 " ID_inside-ns ID-outside-ns length\n"
3232 "\\&\n"
3233 " Requiring the user to supply a string that contains newlines is\n"
3234 " of course inconvenient for command-line use. Thus, we permit the\n"
3235 " use of commas to delimit records in this string, and replace them\n"
3236 " with newlines before writing the string to the file. */\n"
3237 "\\&\n"
3238 "static void\n"
3239 "update_map(char *mapping, char *map_file)\n"
3240 "{\n"
3241 " int fd;\n"
3242 " size_t map_len; /* Length of \\[aq]mapping\\[aq] */\n"
3243 "\\&\n"
3244 " /* Replace commas in mapping string with newlines. */\n"
3245 "\\&\n"
3246 " map_len = strlen(mapping);\n"
3247 " for (size_t j = 0; j E<lt> map_len; j++)\n"
3248 " if (mapping[j] == \\[aq],\\[aq])\n"
3249 " mapping[j] = \\[aq]\\[rs]n\\[aq];\n"
3250 "\\&\n"
3251 " fd = open(map_file, O_RDWR);\n"
3252 " if (fd == -1) {\n"
3253 " fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", map_file,\n"
3254 " strerror(errno));\n"
3255 " exit(EXIT_FAILURE);\n"
3256 " }\n"
3257 "\\&\n"
3258 " if (write(fd, mapping, map_len) != map_len) {\n"
3259 " fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", map_file,\n"
3260 " strerror(errno));\n"
3261 " exit(EXIT_FAILURE);\n"
3262 " }\n"
3263 "\\&\n"
3264 " close(fd);\n"
3265 "}\n"
3266 "\\&\n"
3267 "/* Linux 3.19 made a change in the handling of setgroups(2) and\n"
3268 " the \\[aq]gid_map\\[aq] file to address a security issue. The issue\n"
3269 " allowed *unprivileged* users to employ user namespaces in\n"
3270 " order to drop groups. The upshot of the 3.19 changes is that\n"
3271 " in order to update the \\[aq]gid_maps\\[aq] file, use of the setgroups()\n"
3272 " system call in this user namespace must first be disabled by\n"
3273 " writing \"deny\" to one of the /proc/PID/setgroups files for\n"
3274 " this namespace. That is the purpose of the following function. */\n"
3275 "\\&\n"
3276 "static void\n"
3277 "proc_setgroups_write(pid_t child_pid, char *str)\n"
3278 "{\n"
3279 " char setgroups_path[PATH_MAX];\n"
3280 " int fd;\n"
3281 "\\&\n"
3282 " snprintf(setgroups_path, PATH_MAX, \"/proc/%jd/setgroups\",\n"
3283 " (intmax_t) child_pid);\n"
3284 "\\&\n"
3285 " fd = open(setgroups_path, O_RDWR);\n"
3286 " if (fd == -1) {\n"
3287 "\\&\n"
3288 " /* We may be on a system that doesn\\[aq]t support\n"
3289 " /proc/PID/setgroups. In that case, the file won\\[aq]t exist,\n"
3290 " and the system won\\[aq]t impose the restrictions that Linux 3.19\n"
3291 " added. That\\[aq]s fine: we don\\[aq]t need to do anything in order\n"
3292 " to permit \\[aq]gid_map\\[aq] to be updated.\n"
3293 "\\&\n"
3294 " However, if the error from open() was something other than\n"
3295 " the ENOENT error that is expected for that case, let the\n"
3296 " user know. */\n"
3297 "\\&\n"
3298 " if (errno != ENOENT)\n"
3299 " fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", setgroups_path,\n"
3300 " strerror(errno));\n"
3301 " return;\n"
3302 " }\n"
3303 "\\&\n"
3304 " if (write(fd, str, strlen(str)) == -1)\n"
3305 " fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", setgroups_path,\n"
3306 " strerror(errno));\n"
3307 "\\&\n"
3308 " close(fd);\n"
3309 "}\n"
3310 "\\&\n"
3311 "static int /* Start function for cloned child */\n"
3312 "childFunc(void *arg)\n"
3313 "{\n"
3314 " struct child_args *args = arg;\n"
3315 " char ch;\n"
3316 "\\&\n"
3317 " /* Wait until the parent has updated the UID and GID mappings.\n"
3318 " See the comment in main(). We wait for end of file on a\n"
3319 " pipe that will be closed by the parent process once it has\n"
3320 " updated the mappings. */\n"
3321 "\\&\n"
3322 " close(args-E<gt>pipe_fd[1]); /* Close our descriptor for the write\n"
3323 " end of the pipe so that we see EOF\n"
3324 " when parent closes its descriptor. */\n"
3325 " if (read(args-E<gt>pipe_fd[0], &ch, 1) != 0) {\n"
3326 " fprintf(stderr,\n"
3327 " \"Failure in child: read from pipe returned != 0\\[rs]n\");\n"
3328 " exit(EXIT_FAILURE);\n"
3329 " }\n"
3330 "\\&\n"
3331 " close(args-E<gt>pipe_fd[0]);\n"
3332 "\\&\n"
3333 " /* Execute a shell command. */\n"
3334 "\\&\n"
3335 " printf(\"About to exec %s\\[rs]n\", args-E<gt>argv[0]);\n"
3336 " execvp(args-E<gt>argv[0], args-E<gt>argv);\n"
3337 " err(EXIT_FAILURE, \"execvp\");\n"
3338 "}\n"
3339 "\\&\n"
3340 "#define STACK_SIZE (1024 * 1024)\n"
3341 "\\&\n"
3342 "static char child_stack[STACK_SIZE]; /* Space for child\\[aq]s stack */\n"
3343 "\\&\n"
3344 "int\n"
3345 "main(int argc, char *argv[])\n"
3346 "{\n"
3347 " int flags, opt, map_zero;\n"
3348 " pid_t child_pid;\n"
3349 " struct child_args args;\n"
3350 " char *uid_map, *gid_map;\n"
3351 " const int MAP_BUF_SIZE = 100;\n"
3352 " char map_buf[MAP_BUF_SIZE];\n"
3353 " char map_path[PATH_MAX];\n"
3354 "\\&\n"
3355 " /* Parse command-line options. The initial \\[aq]+\\[aq] character in\n"
3356 " the final getopt() argument prevents GNU-style permutation\n"
3357 " of command-line options. That\\[aq]s useful, since sometimes\n"
3358 " the \\[aq]command\\[aq] to be executed by this program itself\n"
3359 " has command-line options. We don\\[aq]t want getopt() to treat\n"
3360 " those as options to this program. */\n"
3361 "\\&\n"
3362 " flags = 0;\n"
3363 " verbose = 0;\n"
3364 " gid_map = NULL;\n"
3365 " uid_map = NULL;\n"
3366 " map_zero = 0;\n"
3367 " while ((opt = getopt(argc, argv, \"+imnpuUM:G:zv\")) != -1) {\n"
3368 " switch (opt) {\n"
3369 " case \\[aq]i\\[aq]: flags |= CLONE_NEWIPC; break;\n"
3370 " case \\[aq]m\\[aq]: flags |= CLONE_NEWNS; break;\n"
3371 " case \\[aq]n\\[aq]: flags |= CLONE_NEWNET; break;\n"
3372 " case \\[aq]p\\[aq]: flags |= CLONE_NEWPID; break;\n"
3373 " case \\[aq]u\\[aq]: flags |= CLONE_NEWUTS; break;\n"
3374 " case \\[aq]v\\[aq]: verbose = 1; break;\n"
3375 " case \\[aq]z\\[aq]: map_zero = 1; break;\n"
3376 " case \\[aq]M\\[aq]: uid_map = optarg; break;\n"
3377 " case \\[aq]G\\[aq]: gid_map = optarg; break;\n"
3378 " case \\[aq]U\\[aq]: flags |= CLONE_NEWUSER; break;\n"
3379 " default: usage(argv[0]);\n"
3380 " }\n"
3381 " }\n"
3382 "\\&\n"
3383 " /* -M or -G without -U is nonsensical */\n"
3384 "\\&\n"
3385 " if (((uid_map != NULL || gid_map != NULL || map_zero) &&\n"
3386 " !(flags & CLONE_NEWUSER)) ||\n"
3387 " (map_zero && (uid_map != NULL || gid_map != NULL)))\n"
3388 " usage(argv[0]);\n"
3389 "\\&\n"
3390 " args.argv = &argv[optind];\n"
3391 "\\&\n"
3392 " /* We use a pipe to synchronize the parent and child, in order to\n"
3393 " ensure that the parent sets the UID and GID maps before the child\n"
3394 " calls execve(). This ensures that the child maintains its\n"
3395 " capabilities during the execve() in the common case where we\n"
3396 " want to map the child\\[aq]s effective user ID to 0 in the new user\n"
3397 " namespace. Without this synchronization, the child would lose\n"
3398 " its capabilities if it performed an execve() with nonzero\n"
3399 " user IDs (see the capabilities(7) man page for details of the\n"
3400 " transformation of a process\\[aq]s capabilities during execve()). */\n"
3401 "\\&\n"
3402 " if (pipe(args.pipe_fd) == -1)\n"
3403 " err(EXIT_FAILURE, \"pipe\");\n"
3404 "\\&\n"
3405 " /* Create the child in new namespace(s). */\n"
3406 "\\&\n"
3407 " child_pid = clone(childFunc, child_stack + STACK_SIZE,\n"
3408 " flags | SIGCHLD, &args);\n"
3409 " if (child_pid == -1)\n"
3410 " err(EXIT_FAILURE, \"clone\");\n"
3411 "\\&\n"
3412 " /* Parent falls through to here. */\n"
3413 "\\&\n"
3414 " if (verbose)\n"
3415 " printf(\"%s: PID of child created by clone() is %jd\\[rs]n\",\n"
3416 " argv[0], (intmax_t) child_pid);\n"
3417 "\\&\n"
3418 " /* Update the UID and GID maps in the child. */\n"
3419 "\\&\n"
3420 " if (uid_map != NULL || map_zero) {\n"
3421 " snprintf(map_path, PATH_MAX, \"/proc/%jd/uid_map\",\n"
3422 " (intmax_t) child_pid);\n"
3423 " if (map_zero) {\n"
3424 " snprintf(map_buf, MAP_BUF_SIZE, \"0 %jd 1\",\n"
3425 " (intmax_t) getuid());\n"
3426 " uid_map = map_buf;\n"
3427 " }\n"
3428 " update_map(uid_map, map_path);\n"
3429 " }\n"
3430 "\\&\n"
3431 " if (gid_map != NULL || map_zero) {\n"
3432 " proc_setgroups_write(child_pid, \"deny\");\n"
3433 "\\&\n"
3434 " snprintf(map_path, PATH_MAX, \"/proc/%jd/gid_map\",\n"
3435 " (intmax_t) child_pid);\n"
3436 " if (map_zero) {\n"
3437 " snprintf(map_buf, MAP_BUF_SIZE, \"0 %ld 1\",\n"
3438 " (intmax_t) getgid());\n"
3439 " gid_map = map_buf;\n"
3440 " }\n"
3441 " update_map(gid_map, map_path);\n"
3442 " }\n"
3443 "\\&\n"
3444 " /* Close the write end of the pipe, to signal to the child that we\n"
3445 " have updated the UID and GID maps. */\n"
3446 "\\&\n"
3447 " close(args.pipe_fd[1]);\n"
3448 "\\&\n"
3449 " if (waitpid(child_pid, NULL, 0) == -1) /* Wait for child */\n"
3450 " err(EXIT_FAILURE, \"waitpid\");\n"
3451 "\\&\n"
3452 " if (verbose)\n"
3453 " printf(\"%s: terminating\\[rs]n\", argv[0]);\n"
3454 "\\&\n"
3455 " exit(EXIT_SUCCESS);\n"
3456 "}\n"
3457 msgstr ""
3458
3459 #. type: TH
3460 #: fedora-44 fedora-rawhide
3461 #, no-wrap
3462 msgid "2025-01-11"
3463 msgstr "11 января 2025 г."
3464
3465 #. type: TH
3466 #: fedora-44 fedora-rawhide
3467 #, no-wrap
3468 msgid "Linux man-pages 6.13"
3469 msgstr "Страницы руководства Linux 6.13"
3470
3471 #. type: Plain text
3472 #: fedora-44 fedora-rawhide
3473 #, no-wrap
3474 msgid ""
3475 "/* userns_child_exec.c\n"
3476 "\\&\n"
3477 " Licensed under GNU General Public License v2 or later\n"
3478 "\\&\n"
3479 " Create a child process that executes a shell command in new\n"
3480 " namespace(s); allow UID and GID mappings to be specified when\n"
3481 " creating a user namespace.\n"
3482 "*/\n"
3483 "#define _GNU_SOURCE\n"
3484 "#include E<lt>err.hE<gt>\n"
3485 "#include E<lt>sched.hE<gt>\n"
3486 "#include E<lt>unistd.hE<gt>\n"
3487 "#include E<lt>stdint.hE<gt>\n"
3488 "#include E<lt>stdlib.hE<gt>\n"
3489 "#include E<lt>sys/wait.hE<gt>\n"
3490 "#include E<lt>signal.hE<gt>\n"
3491 "#include E<lt>fcntl.hE<gt>\n"
3492 "#include E<lt>stdio.hE<gt>\n"
3493 "#include E<lt>string.hE<gt>\n"
3494 "#include E<lt>limits.hE<gt>\n"
3495 "#include E<lt>errno.hE<gt>\n"
3496 "\\&\n"
3497 "struct child_args {\n"
3498 " char **argv; /* Command to be executed by child, with args */\n"
3499 " int pipe_fd[2]; /* Pipe used to synchronize parent and child */\n"
3500 "};\n"
3501 "\\&\n"
3502 "static int verbose;\n"
3503 "\\&\n"
3504 "static void\n"
3505 "usage(char *pname)\n"
3506 "{\n"
3507 " fprintf(stderr, \"Usage: %s [options] cmd [arg...]\\[rs]n\\[rs]n\", pname);\n"
3508 " fprintf(stderr, \"Create a child process that executes a shell \"\n"
3509 " \"command in a new user namespace,\\[rs]n\"\n"
3510 " \"and possibly also other new namespace(s).\\[rs]n\\[rs]n\");\n"
3511 " fprintf(stderr, \"Options can be:\\[rs]n\\[rs]n\");\n"
3512 "#define fpe(str) fprintf(stderr, \" %s\", str);\n"
3513 " fpe(\"-i New IPC namespace\\[rs]n\");\n"
3514 " fpe(\"-m New mount namespace\\[rs]n\");\n"
3515 " fpe(\"-n New network namespace\\[rs]n\");\n"
3516 " fpe(\"-p New PID namespace\\[rs]n\");\n"
3517 " fpe(\"-u New UTS namespace\\[rs]n\");\n"
3518 " fpe(\"-U New user namespace\\[rs]n\");\n"
3519 " fpe(\"-M uid_map Specify UID map for user namespace\\[rs]n\");\n"
3520 " fpe(\"-G gid_map Specify GID map for user namespace\\[rs]n\");\n"
3521 " fpe(\"-z Map user\\[aq]s UID and GID to 0 in user namespace\\[rs]n\");\n"
3522 " fpe(\" (equivalent to: -M \\[aq]0 E<lt>uidE<gt> 1\\[aq] -G \\[aq]0 E<lt>gidE<gt> 1\\[aq])\\[rs]n\");\n"
3523 " fpe(\"-v Display verbose messages\\[rs]n\");\n"
3524 " fpe(\"\\[rs]n\");\n"
3525 " fpe(\"If -z, -M, or -G is specified, -U is required.\\[rs]n\");\n"
3526 " fpe(\"It is not permitted to specify both -z and either -M or -G.\\[rs]n\");\n"
3527 " fpe(\"\\[rs]n\");\n"
3528 " fpe(\"Map strings for -M and -G consist of records of the form:\\[rs]n\");\n"
3529 " fpe(\"\\[rs]n\");\n"
3530 " fpe(\" ID-inside-ns ID-outside-ns size\\[rs]n\");\n"
3531 " fpe(\"\\[rs]n\");\n"
3532 " fpe(\"A map string can contain multiple records, separated\"\n"
3533 " \" by commas;\\[rs]n\");\n"
3534 " fpe(\"the commas are replaced by newlines before writing\"\n"
3535 " \" to map files.\\[rs]n\");\n"
3536 "\\&\n"
3537 " exit(EXIT_FAILURE);\n"
3538 "}\n"
3539 "\\&\n"
3540 "/* Update the mapping file \\[aq]map_file\\[aq], with the value provided in\n"
3541 " \\[aq]mapping\\[aq], a string that defines a UID or GID mapping. A UID or\n"
3542 " GID mapping consists of one or more newline-delimited records\n"
3543 " of the form:\n"
3544 "\\&\n"
3545 " ID_inside-ns ID-outside-ns size\n"
3546 "\\&\n"
3547 " Requiring the user to supply a string that contains newlines is\n"
3548 " of course inconvenient for command-line use. Thus, we permit the\n"
3549 " use of commas to delimit records in this string, and replace them\n"
3550 " with newlines before writing the string to the file. */\n"
3551 "\\&\n"
3552 "static void\n"
3553 "update_map(char *mapping, char *map_file)\n"
3554 "{\n"
3555 " int fd;\n"
3556 " size_t map_len; /* Length of \\[aq]mapping\\[aq] */\n"
3557 "\\&\n"
3558 " /* Replace commas in mapping string with newlines. */\n"
3559 "\\&\n"
3560 " map_len = strlen(mapping);\n"
3561 " for (size_t j = 0; j E<lt> map_len; j++)\n"
3562 " if (mapping[j] == \\[aq],\\[aq])\n"
3563 " mapping[j] = \\[aq]\\[rs]n\\[aq];\n"
3564 "\\&\n"
3565 " fd = open(map_file, O_RDWR);\n"
3566 " if (fd == -1) {\n"
3567 " fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", map_file,\n"
3568 " strerror(errno));\n"
3569 " exit(EXIT_FAILURE);\n"
3570 " }\n"
3571 "\\&\n"
3572 " if (write(fd, mapping, map_len) != map_len) {\n"
3573 " fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", map_file,\n"
3574 " strerror(errno));\n"
3575 " exit(EXIT_FAILURE);\n"
3576 " }\n"
3577 "\\&\n"
3578 " close(fd);\n"
3579 "}\n"
3580 "\\&\n"
3581 "/* Linux 3.19 made a change in the handling of setgroups(2) and\n"
3582 " the \\[aq]gid_map\\[aq] file to address a security issue. The issue\n"
3583 " allowed *unprivileged* users to employ user namespaces in\n"
3584 " order to drop groups. The upshot of the 3.19 changes is that\n"
3585 " in order to update the \\[aq]gid_maps\\[aq] file, use of the setgroups()\n"
3586 " system call in this user namespace must first be disabled by\n"
3587 " writing \"deny\" to one of the /proc/PID/setgroups files for\n"
3588 " this namespace. That is the purpose of the following function. */\n"
3589 "\\&\n"
3590 "static void\n"
3591 "proc_setgroups_write(pid_t child_pid, char *str)\n"
3592 "{\n"
3593 " char setgroups_path[PATH_MAX];\n"
3594 " int fd;\n"
3595 "\\&\n"
3596 " snprintf(setgroups_path, PATH_MAX, \"/proc/%jd/setgroups\",\n"
3597 " (intmax_t) child_pid);\n"
3598 "\\&\n"
3599 " fd = open(setgroups_path, O_RDWR);\n"
3600 " if (fd == -1) {\n"
3601 "\\&\n"
3602 " /* We may be on a system that doesn\\[aq]t support\n"
3603 " /proc/PID/setgroups. In that case, the file won\\[aq]t exist,\n"
3604 " and the system won\\[aq]t impose the restrictions that Linux 3.19\n"
3605 " added. That\\[aq]s fine: we don\\[aq]t need to do anything in order\n"
3606 " to permit \\[aq]gid_map\\[aq] to be updated.\n"
3607 "\\&\n"
3608 " However, if the error from open() was something other than\n"
3609 " the ENOENT error that is expected for that case, let the\n"
3610 " user know. */\n"
3611 "\\&\n"
3612 " if (errno != ENOENT)\n"
3613 " fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", setgroups_path,\n"
3614 " strerror(errno));\n"
3615 " return;\n"
3616 " }\n"
3617 "\\&\n"
3618 " if (write(fd, str, strlen(str)) == -1)\n"
3619 " fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", setgroups_path,\n"
3620 " strerror(errno));\n"
3621 "\\&\n"
3622 " close(fd);\n"
3623 "}\n"
3624 "\\&\n"
3625 "static int /* Start function for cloned child */\n"
3626 "childFunc(void *arg)\n"
3627 "{\n"
3628 " struct child_args *args = arg;\n"
3629 " char ch;\n"
3630 "\\&\n"
3631 " /* Wait until the parent has updated the UID and GID mappings.\n"
3632 " See the comment in main(). We wait for end of file on a\n"
3633 " pipe that will be closed by the parent process once it has\n"
3634 " updated the mappings. */\n"
3635 "\\&\n"
3636 " close(args-E<gt>pipe_fd[1]); /* Close our descriptor for the write\n"
3637 " end of the pipe so that we see EOF\n"
3638 " when parent closes its descriptor. */\n"
3639 " if (read(args-E<gt>pipe_fd[0], &ch, 1) != 0) {\n"
3640 " fprintf(stderr,\n"
3641 " \"Failure in child: read from pipe returned != 0\\[rs]n\");\n"
3642 " exit(EXIT_FAILURE);\n"
3643 " }\n"
3644 "\\&\n"
3645 " close(args-E<gt>pipe_fd[0]);\n"
3646 "\\&\n"
3647 " /* Execute a shell command. */\n"
3648 "\\&\n"
3649 " printf(\"About to exec %s\\[rs]n\", args-E<gt>argv[0]);\n"
3650 " execvp(args-E<gt>argv[0], args-E<gt>argv);\n"
3651 " err(EXIT_FAILURE, \"execvp\");\n"
3652 "}\n"
3653 "\\&\n"
3654 "#define STACK_SIZE (1024 * 1024)\n"
3655 "\\&\n"
3656 "static char child_stack[STACK_SIZE]; /* Space for child\\[aq]s stack */\n"
3657 "\\&\n"
3658 "int\n"
3659 "main(int argc, char *argv[])\n"
3660 "{\n"
3661 " int flags, opt, map_zero;\n"
3662 " pid_t child_pid;\n"
3663 " struct child_args args;\n"
3664 " char *uid_map, *gid_map;\n"
3665 " const int MAP_BUF_SIZE = 100;\n"
3666 " char map_buf[MAP_BUF_SIZE];\n"
3667 " char map_path[PATH_MAX];\n"
3668 "\\&\n"
3669 " /* Parse command-line options. The initial \\[aq]+\\[aq] character in\n"
3670 " the final getopt() argument prevents GNU-style permutation\n"
3671 " of command-line options. That\\[aq]s useful, since sometimes\n"
3672 " the \\[aq]command\\[aq] to be executed by this program itself\n"
3673 " has command-line options. We don\\[aq]t want getopt() to treat\n"
3674 " those as options to this program. */\n"
3675 "\\&\n"
3676 " flags = 0;\n"
3677 " verbose = 0;\n"
3678 " gid_map = NULL;\n"
3679 " uid_map = NULL;\n"
3680 " map_zero = 0;\n"
3681 " while ((opt = getopt(argc, argv, \"+imnpuUM:G:zv\")) != -1) {\n"
3682 " switch (opt) {\n"
3683 " case \\[aq]i\\[aq]: flags |= CLONE_NEWIPC; break;\n"
3684 " case \\[aq]m\\[aq]: flags |= CLONE_NEWNS; break;\n"
3685 " case \\[aq]n\\[aq]: flags |= CLONE_NEWNET; break;\n"
3686 " case \\[aq]p\\[aq]: flags |= CLONE_NEWPID; break;\n"
3687 " case \\[aq]u\\[aq]: flags |= CLONE_NEWUTS; break;\n"
3688 " case \\[aq]v\\[aq]: verbose = 1; break;\n"
3689 " case \\[aq]z\\[aq]: map_zero = 1; break;\n"
3690 " case \\[aq]M\\[aq]: uid_map = optarg; break;\n"
3691 " case \\[aq]G\\[aq]: gid_map = optarg; break;\n"
3692 " case \\[aq]U\\[aq]: flags |= CLONE_NEWUSER; break;\n"
3693 " default: usage(argv[0]);\n"
3694 " }\n"
3695 " }\n"
3696 "\\&\n"
3697 " /* -M or -G without -U is nonsensical */\n"
3698 "\\&\n"
3699 " if (((uid_map != NULL || gid_map != NULL || map_zero) &&\n"
3700 " !(flags & CLONE_NEWUSER)) ||\n"
3701 " (map_zero && (uid_map != NULL || gid_map != NULL)))\n"
3702 " usage(argv[0]);\n"
3703 "\\&\n"
3704 " args.argv = &argv[optind];\n"
3705 "\\&\n"
3706 " /* We use a pipe to synchronize the parent and child, in order to\n"
3707 " ensure that the parent sets the UID and GID maps before the child\n"
3708 " calls execve(). This ensures that the child maintains its\n"
3709 " capabilities during the execve() in the common case where we\n"
3710 " want to map the child\\[aq]s effective user ID to 0 in the new user\n"
3711 " namespace. Without this synchronization, the child would lose\n"
3712 " its capabilities if it performed an execve() with nonzero\n"
3713 " user IDs (see the capabilities(7) man page for details of the\n"
3714 " transformation of a process\\[aq]s capabilities during execve()). */\n"
3715 "\\&\n"
3716 " if (pipe(args.pipe_fd) == -1)\n"
3717 " err(EXIT_FAILURE, \"pipe\");\n"
3718 "\\&\n"
3719 " /* Create the child in new namespace(s). */\n"
3720 "\\&\n"
3721 " child_pid = clone(childFunc, child_stack + STACK_SIZE,\n"
3722 " flags | SIGCHLD, &args);\n"
3723 " if (child_pid == -1)\n"
3724 " err(EXIT_FAILURE, \"clone\");\n"
3725 "\\&\n"
3726 " /* Parent falls through to here. */\n"
3727 "\\&\n"
3728 " if (verbose)\n"
3729 " printf(\"%s: PID of child created by clone() is %jd\\[rs]n\",\n"
3730 " argv[0], (intmax_t) child_pid);\n"
3731 "\\&\n"
3732 " /* Update the UID and GID maps in the child. */\n"
3733 "\\&\n"
3734 " if (uid_map != NULL || map_zero) {\n"
3735 " snprintf(map_path, PATH_MAX, \"/proc/%jd/uid_map\",\n"
3736 " (intmax_t) child_pid);\n"
3737 " if (map_zero) {\n"
3738 " snprintf(map_buf, MAP_BUF_SIZE, \"0 %jd 1\",\n"
3739 " (intmax_t) getuid());\n"
3740 " uid_map = map_buf;\n"
3741 " }\n"
3742 " update_map(uid_map, map_path);\n"
3743 " }\n"
3744 "\\&\n"
3745 " if (gid_map != NULL || map_zero) {\n"
3746 " proc_setgroups_write(child_pid, \"deny\");\n"
3747 "\\&\n"
3748 " snprintf(map_path, PATH_MAX, \"/proc/%jd/gid_map\",\n"
3749 " (intmax_t) child_pid);\n"
3750 " if (map_zero) {\n"
3751 " snprintf(map_buf, MAP_BUF_SIZE, \"0 %ld 1\",\n"
3752 " (intmax_t) getgid());\n"
3753 " gid_map = map_buf;\n"
3754 " }\n"
3755 " update_map(gid_map, map_path);\n"
3756 " }\n"
3757 "\\&\n"
3758 " /* Close the write end of the pipe, to signal to the child that we\n"
3759 " have updated the UID and GID maps. */\n"
3760 "\\&\n"
3761 " close(args.pipe_fd[1]);\n"
3762 "\\&\n"
3763 " if (waitpid(child_pid, NULL, 0) == -1) /* Wait for child */\n"
3764 " err(EXIT_FAILURE, \"waitpid\");\n"
3765 "\\&\n"
3766 " if (verbose)\n"
3767 " printf(\"%s: terminating\\[rs]n\", argv[0]);\n"
3768 "\\&\n"
3769 " exit(EXIT_SUCCESS);\n"
3770 "}\n"
3771 msgstr ""
3772
3773 #. type: TH
3774 #: mageia-cauldron
3775 #, no-wrap
3776 msgid "Linux man-pages 6.17"
3777 msgstr "Страницы руководства Linux 6.17"
3778
3779 #. type: TH
3780 #: opensuse-leap-16-1 opensuse-tumbleweed
3781 #, no-wrap
3782 msgid "Linux man-pages (unreleased)"
3783 msgstr "Страницы руководства Linux (не выпущены)"