| 1 |
# Swedish translation of manpages |
| 2 |
# This file is distributed under the same license as the manpages-l10n package. |
| 3 |
# Copyright © of this file: |
| 4 |
# Göran Uddeborg <[email protected]>, 2023, 2024, 2025, 2026. |
| 5 |
msgid "" |
| 6 |
msgstr "" |
| 7 |
"Project-Id-Version: manpages-l10n 4.19.0\n" |
| 8 |
"POT-Creation-Date: 2026-06-05 06:50+0200\n" |
| 9 |
"PO-Revision-Date: 2026-05-21 22:40+0200\n" |
| 10 |
"Last-Translator: Göran Uddeborg <[email protected]>\n" |
| 11 |
"Language-Team: Swedish <[email protected]>\n" |
| 12 |
"Language: sv\n" |
| 13 |
"MIME-Version: 1.0\n" |
| 14 |
"Content-Type: text/plain; charset=UTF-8\n" |
| 15 |
"Content-Transfer-Encoding: 8bit\n" |
| 16 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n" |
| 17 |
|
| 18 |
#. type: TH |
| 19 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 20 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 21 |
#, no-wrap |
| 22 |
msgid "user_namespaces" |
| 23 |
msgstr "user_namespaces" |
| 24 |
|
| 25 |
#. type: TH |
| 26 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 27 |
#: opensuse-tumbleweed |
| 28 |
#, no-wrap |
| 29 |
msgid "2026-02-08" |
| 30 |
msgstr "8 februari 2026" |
| 31 |
|
| 32 |
#. type: TH |
| 33 |
#: archlinux debian-unstable |
| 34 |
#, no-wrap |
| 35 |
msgid "Linux man-pages 6.18" |
| 36 |
msgstr "Linux man-pages 6.18" |
| 37 |
|
| 38 |
#. type: SH |
| 39 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 40 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 41 |
#, no-wrap |
| 42 |
msgid "NAME" |
| 43 |
msgstr "NAMN" |
| 44 |
|
| 45 |
#. type: Plain text |
| 46 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 47 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 48 |
msgid "user_namespaces - overview of Linux user namespaces" |
| 49 |
msgstr "user_namespaces — översikt över Linux användarnamnrymder" |
| 50 |
|
| 51 |
#. type: SH |
| 52 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 53 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 54 |
#, no-wrap |
| 55 |
msgid "DESCRIPTION" |
| 56 |
msgstr "BESKRIVNING" |
| 57 |
|
| 58 |
#. type: Plain text |
| 59 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 60 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 61 |
msgid "For an overview of namespaces, see B<namespaces>(7)." |
| 62 |
msgstr "För en översikt över namnrymder, se B<namespaces>(7)." |
| 63 |
|
| 64 |
# |
| 65 |
#. #-#-#-#-# archlinux: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-# |
| 66 |
#. FIXME: This page says very little about the interaction |
| 67 |
#. of user namespaces and keys. Add something on this topic. |
| 68 |
#. ============================================================ |
| 69 |
#. type: Plain text |
| 70 |
#. #-#-#-#-# debian-trixie: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-# |
| 71 |
#. FIXME: This page says very little about the interaction |
| 72 |
#. of user namespaces and keys. Add something on this topic. |
| 73 |
#. ============================================================ |
| 74 |
#. type: Plain text |
| 75 |
#. #-#-#-#-# debian-unstable: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-# |
| 76 |
#. FIXME: This page says very little about the interaction |
| 77 |
#. of user namespaces and keys. Add something on this topic. |
| 78 |
#. ============================================================ |
| 79 |
#. type: Plain text |
| 80 |
#. #-#-#-#-# fedora-44: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-# |
| 81 |
#. FIXME: This page says very little about the interaction |
| 82 |
#. of user namespaces and keys. Add something on this topic. |
| 83 |
#. ============================================================ |
| 84 |
#. type: Plain text |
| 85 |
#. #-#-#-#-# fedora-rawhide: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-# |
| 86 |
#. FIXME: This page says very little about the interaction |
| 87 |
#. of user namespaces and keys. Add something on this topic. |
| 88 |
#. ============================================================ |
| 89 |
#. type: Plain text |
| 90 |
#. #-#-#-#-# mageia-cauldron: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-# |
| 91 |
#. FIXME: This page says very little about the interaction |
| 92 |
#. of user namespaces and keys. Add something on this topic. |
| 93 |
#. ============================================================ |
| 94 |
#. type: Plain text |
| 95 |
#. #-#-#-#-# opensuse-leap-16-1: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-# |
| 96 |
#. FIXME: This page says very little about the interaction |
| 97 |
#. of user namespaces and keys. Add something on this topic. |
| 98 |
#. ============================================================ |
| 99 |
#. type: Plain text |
| 100 |
#. #-#-#-#-# opensuse-tumbleweed: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-# |
| 101 |
#. FIXME: This page says very little about the interaction |
| 102 |
#. of user namespaces and keys. Add something on this topic. |
| 103 |
#. ============================================================ |
| 104 |
#. type: Plain text |
| 105 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 106 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 107 |
msgid "" |
| 108 |
"User namespaces isolate security-related identifiers and attributes, in " |
| 109 |
"particular, user IDs and group IDs (see B<credentials>(7)), the root " |
| 110 |
"directory, keys (see B<keyrings>(7)), and capabilities (see " |
| 111 |
"B<capabilities>(7)). A process's user and group IDs can be different inside " |
| 112 |
"and outside a user namespace. In particular, a process can have a normal " |
| 113 |
"unprivileged user ID outside a user namespace while at the same time having " |
| 114 |
"a user ID of 0 inside the namespace; in other words, the process has full " |
| 115 |
"privileges for operations inside the user namespace, but is unprivileged for " |
| 116 |
"operations outside the namespace." |
| 117 |
msgstr "" |
| 118 |
"Användarnamnrymder isolerar säkerhetsrelaterade identifierare och attribut, " |
| 119 |
"mer exakt, användar-ID:n och grupp-ID:n (se B<credentials>(7)), " |
| 120 |
"rotkatalogen, nycklar (se B<keyring>(7)) och förmågor (se " |
| 121 |
"B<capabilities>(7)). En process användar- och grupp-ID:n kan vara olika " |
| 122 |
"inuti och utanför en användarnamnrymd. I synnerhet kan en process ha ett " |
| 123 |
"normalt oprivilegierat användar-ID utanför en användarnamnrymd medan den på " |
| 124 |
"samma gång har användar-ID:t 0 inuti namnrymden; med andra ord, processen " |
| 125 |
"har fullständiga rättigheter vid åtgärder inuti användarnamnrymden, men är " |
| 126 |
"oprivilegierad vid åtgärder utanför namnrymden." |
| 127 |
|
| 128 |
#. type: SS |
| 129 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 130 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 131 |
#, no-wrap |
| 132 |
msgid "Nested namespaces, namespace membership" |
| 133 |
msgstr "Nästade namnrymder, medlemskap i namnrymder" |
| 134 |
|
| 135 |
#. type: Plain text |
| 136 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 137 |
#: opensuse-tumbleweed |
| 138 |
msgid "" |
| 139 |
"User namespaces can be nested; that is, each user namespace \\[em]except the " |
| 140 |
"initial (\"root\") namespace\\[em] has a parent user namespace, and can have " |
| 141 |
"zero or more child user namespaces. The parent user namespace is the user " |
| 142 |
"namespace of the process that creates the user namespace via a call to " |
| 143 |
"B<unshare>(2) or B<clone>(2) with the B<CLONE_NEWUSER> flag." |
| 144 |
msgstr "" |
| 145 |
"Användarnamnrymder kan nästas; det vill säga, varje användarnamnrymd \\[em] " |
| 146 |
"utom den initiala (”rot-”)namnrymden \\[em] har en föräldraanvändarnamnrymd, " |
| 147 |
"och kan ha noll eller flera barnanvändarnamnrymder. " |
| 148 |
"Föräldraanvändarnamnrymden är användarnamnrymden för processen som skapar " |
| 149 |
"användarnamnrymden via ett anrop av B<unshare>(2) eller B<clone>(2) med " |
| 150 |
"flaggan B<CLONE_NEWUSER>." |
| 151 |
|
| 152 |
#. commit 8742f229b635bf1c1c84a3dfe5e47c814c20b5c8 |
| 153 |
#. FIXME Explain the rationale for this limit. (What is the rationale?) |
| 154 |
#. type: Plain text |
| 155 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 156 |
#: opensuse-tumbleweed |
| 157 |
msgid "" |
| 158 |
"The kernel imposes (since Linux 3.11) a limit of 32 nested levels of user " |
| 159 |
"namespaces. Calls to B<unshare>(2) or B<clone>(2) that would cause this " |
| 160 |
"limit to be exceeded fail with the error B<EUSERS>." |
| 161 |
msgstr "" |
| 162 |
"Kärnan lägger (från Linux 3.11) en gräns på 32 nästade nivåer med " |
| 163 |
"användarnamnrymder. Anrop av B<unshare>(2) eller B<clone>(2) som annars " |
| 164 |
"skulle orsaka att denna gräns överskrids misslyckas med felet B<EUSERS>." |
| 165 |
|
| 166 |
#. type: Plain text |
| 167 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 168 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 169 |
msgid "" |
| 170 |
"Each process is a member of exactly one user namespace. A process created " |
| 171 |
"via B<fork>(2) or B<clone>(2) without the B<CLONE_NEWUSER> flag is a " |
| 172 |
"member of the same user namespace as its parent. A single-threaded process " |
| 173 |
"can join another user namespace with B<setns>(2) if it has the " |
| 174 |
"B<CAP_SYS_ADMIN> in that namespace; upon doing so, it gains a full set of " |
| 175 |
"capabilities in that namespace." |
| 176 |
msgstr "" |
| 177 |
"Varje process är medlem i exakt en användarnamnrymd. En process som skapas " |
| 178 |
"via B<fork>(2) eller B<clone>(2) utan flaggan B<CLONE_NEWUSER> är medlem av " |
| 179 |
"samma användarnamnrymd som sin förälder. En enkeltrådad process kan gå in i " |
| 180 |
"en annan användarnamnrymd med B<setns>(2) om den har B<CAP_SYS_ADMIN> i den " |
| 181 |
"namnrymden; när den gör det får den en fullständig uppsättning av förmågor i " |
| 182 |
"den namnrymden." |
| 183 |
|
| 184 |
#. type: Plain text |
| 185 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 186 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 187 |
msgid "" |
| 188 |
"A call to B<clone>(2) or B<unshare>(2) with the B<CLONE_NEWUSER> flag " |
| 189 |
"makes the new child process (for B<clone>(2)) or the caller (for " |
| 190 |
"B<unshare>(2)) a member of the new user namespace created by the call." |
| 191 |
msgstr "" |
| 192 |
"Ett anrop av B<clone>(2) eller B<unshare>(2) med flaggan B<CLONE_NEWUSER> " |
| 193 |
"gör den nya barnprocessen (för B<clone>(2)) eller anroparen (för " |
| 194 |
"B<unshare>(2)) medlem av den nya användarnamnrymden som skapas av anropet." |
| 195 |
|
| 196 |
# #-#-#-#-# debian-bullseye: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-# |
| 197 |
# |
| 198 |
# #-#-#-#-# debian-unstable: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-# |
| 199 |
# |
| 200 |
# #-#-#-#-# fedora-38: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-# |
| 201 |
# |
| 202 |
# #-#-#-#-# mageia-cauldron: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-# |
| 203 |
# |
| 204 |
# #-#-#-#-# opensuse-leap-15-5: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-# |
| 205 |
# |
| 206 |
#. type: Plain text |
| 207 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 208 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 209 |
msgid "" |
| 210 |
"The B<NS_GET_PARENT> B<ioctl>(2) operation can be used to discover the " |
| 211 |
"parental relationship between user namespaces; see B<ioctl_nsfs>(2)." |
| 212 |
msgstr "" |
| 213 |
"Åtgärden B<NS_GET_PARENT> till B<ioctl>(2) kan användas för att upptäcka " |
| 214 |
"föräldrarelationen mellan användarnamnrymder; se B<ioctl_nsfs>(2)." |
| 215 |
|
| 216 |
# |
| 217 |
#. ============================================================ |
| 218 |
#. type: Plain text |
| 219 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 220 |
#: opensuse-tumbleweed |
| 221 |
msgid "" |
| 222 |
"A task that changes one of its effective IDs will have its dumpability reset " |
| 223 |
"to the value in I</proc/sys/fs/suid_dumpable>. This may affect the " |
| 224 |
"ownership of proc files of child processes and may thus cause the parent to " |
| 225 |
"lack the permissions to write to mapping files of child processes running in " |
| 226 |
"a new user namespace. In such cases, making the parent process dumpable, " |
| 227 |
"using B<PR_SET_DUMPABLE> in a call to B<prctl>(2), before creating a child " |
| 228 |
"process in a new user namespace may rectify this problem. See B<prctl>(2) " |
| 229 |
"and B<proc>(5) for details on how ownership is affected." |
| 230 |
msgstr "" |
| 231 |
"En uppgift som ändrar ett av sina effektiva ID:n kommer ha sin dumpbarhet " |
| 232 |
"återställd till värdet i I</proc/sys/fs/suid_dumpable>. Detta kan påverka " |
| 233 |
"ägandet av proc-filer för barnprocesser och kan alltså orsaka att föräldern " |
| 234 |
"kommer att sakna rättigheter att skriva till avbildningsfiler för " |
| 235 |
"barnprocesser som kör i en ny användarnamnrymd. I dessa fall kan man genom " |
| 236 |
"att göra processen dumpbar med B<PR_SET_DUMPABLE> i ett anrop av B<prctl>(2) " |
| 237 |
"före en barnprocess skapas i en ny användarnamnrymd åtgärda detta problem. " |
| 238 |
"Se B<prctl>82) och B<proc>(5) för detaljer om hur ägarskap påverkas." |
| 239 |
|
| 240 |
#. type: SS |
| 241 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 242 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 243 |
#, no-wrap |
| 244 |
msgid "Capabilities" |
| 245 |
msgstr "Förmågor" |
| 246 |
|
| 247 |
#. type: Plain text |
| 248 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 249 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 250 |
msgid "" |
| 251 |
"The child process created by B<clone>(2) with the B<CLONE_NEWUSER> flag " |
| 252 |
"starts out with a complete set of capabilities in the new user namespace. " |
| 253 |
"Likewise, a process that creates a new user namespace using B<unshare>(2) " |
| 254 |
"or joins an existing user namespace using B<setns>(2) gains a full set of " |
| 255 |
"capabilities in that namespace. On the other hand, that process has no " |
| 256 |
"capabilities in the parent (in the case of B<clone>(2)) or previous (in the " |
| 257 |
"case of B<unshare>(2) and B<setns>(2)) user namespace, even if the new " |
| 258 |
"namespace is created or joined by the root user (i.e., a process with user " |
| 259 |
"ID 0 in the root namespace)." |
| 260 |
msgstr "" |
| 261 |
"Barnprocesserna som skapas med B<clone>(2) med flaggan B<CLONE_NEWUSER> " |
| 262 |
"börjar med en fullständig uppsättning av förmågor i den nya " |
| 263 |
"användarnamnrymden. Likadant får en process som skapar en ny " |
| 264 |
"användarnamnrymd med B<unshare>(2) eller går in i en befintlig " |
| 265 |
"användarnamnrymd med B<setns>(2) en fullständig uppsättning rättigheter i " |
| 266 |
"den namnrymden. Å andra sidan har den processen inga förmågor i förälderns " |
| 267 |
"(i fallet B<clone>(2)) eller tidigare (i fallet B<unshare>(2) och " |
| 268 |
"B<setns>(2)) användarnamnrymd, även om root-anvädaren skapade eller gick in " |
| 269 |
"i den nya namnrymden (d.v.s., en process med användar-ID 0 i rotnamnrymden)." |
| 270 |
|
| 271 |
#. type: Plain text |
| 272 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 273 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 274 |
msgid "" |
| 275 |
"Note that a call to B<execve>(2) will cause a process's capabilities to be " |
| 276 |
"recalculated in the usual way (see B<capabilities>(7)). Consequently, " |
| 277 |
"unless the process has a user ID of 0 within the namespace, or the " |
| 278 |
"executable file has a nonempty inheritable capabilities mask, the process " |
| 279 |
"will lose all capabilities. See the discussion of user and group ID " |
| 280 |
"mappings, below." |
| 281 |
msgstr "" |
| 282 |
"Observera att ett anrop av B<execve>(2) kommer göra att processens förmågor " |
| 283 |
"räknas om på det vanliga sättet (se B<capabilities>(7)). Alltså, om inte " |
| 284 |
"processen har användar-ID 0 inom namnrymden, eller den körbara filen har en " |
| 285 |
"ärvbar förmågemask som inte är tom, kommer processen förlora alla förmågor. " |
| 286 |
"Se diskussionen om användar- och grupp-ID-avbildningar nedan." |
| 287 |
|
| 288 |
#. type: Plain text |
| 289 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 290 |
#: opensuse-tumbleweed |
| 291 |
msgid "" |
| 292 |
"A call to B<clone>(2) or B<unshare>(2) using the B<CLONE_NEWUSER> flag or " |
| 293 |
"a call to B<setns>(2) that moves the caller into another user namespace " |
| 294 |
"sets the \"securebits\" flags (see B<capabilities>(7)) to their default " |
| 295 |
"values (all flags disabled) in the child (for B<clone>(2)) or caller (for " |
| 296 |
"B<unshare>(2) or B<setns>(2)). Note that because the caller no longer has " |
| 297 |
"capabilities in its original user namespace after a call to B<setns>(2), it " |
| 298 |
"is not possible for a process to reset its \"securebits\" flags while " |
| 299 |
"retaining its user namespace membership by using a pair of B<setns>(2) " |
| 300 |
"calls to move to another user namespace and then return to its original user " |
| 301 |
"namespace." |
| 302 |
msgstr "" |
| 303 |
"Ett anrop av B<clone>(2) eller B<unshare>(2) med flaggan B<CLONE_NEWUSER> " |
| 304 |
"eller ett anrop av B<setns>(2) som flyttar anroparen in i en annan " |
| 305 |
"användarnamnrymd sätter flaggorna ”securebits” (se B<capabilities>(7)) till " |
| 306 |
"sitt standardvärde (alla flaggor avslagna) i barnet (för B<clone>(2)) eller " |
| 307 |
"anroparen (för B<unshare>(2) eller B<setns>(2)). Observera att eftersom " |
| 308 |
"anroparen inte längre har förmågor i sin originalanvändarnamnrymd efter " |
| 309 |
"anropet av B<setns>(2) är det inte möjligt för en process att återställa " |
| 310 |
"sina flaggor ”securebits” medan den behåller sitt medlemskap i " |
| 311 |
"användarnamnrymden genom att använda ett par av anrop av B<setns>(2) för att " |
| 312 |
"flytta till en annan användarnamnrymd och sedan återvända till sin " |
| 313 |
"originalanvändarnamnrymd." |
| 314 |
|
| 315 |
#. type: Plain text |
| 316 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 317 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 318 |
msgid "" |
| 319 |
"The rules for determining whether or not a process has a capability in a " |
| 320 |
"particular user namespace are as follows:" |
| 321 |
msgstr "" |
| 322 |
"Reglerna för att avgöra huruvida en process har en förmåga eller inte i en " |
| 323 |
"viss användarnamnrymd är som följer:" |
| 324 |
|
| 325 |
#. type: IP |
| 326 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 327 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 328 |
#, no-wrap |
| 329 |
msgid "\\[bu]" |
| 330 |
msgstr "\\[bu]" |
| 331 |
|
| 332 |
#. In the 3.8 sources, see security/commoncap.c::cap_capable(): |
| 333 |
#. type: Plain text |
| 334 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 335 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 336 |
msgid "" |
| 337 |
"A process has a capability inside a user namespace if it is a member of that " |
| 338 |
"namespace and it has the capability in its effective capability set. A " |
| 339 |
"process can gain capabilities in its effective capability set in various " |
| 340 |
"ways. For example, it may execute a set-user-ID program or an executable " |
| 341 |
"with associated file capabilities. In addition, a process may gain " |
| 342 |
"capabilities via the effect of B<clone>(2), B<unshare>(2), or B<setns>(2), " |
| 343 |
"as already described." |
| 344 |
msgstr "" |
| 345 |
"En process har en förmåga inuti en användarnamnrymd om den är medlem av den " |
| 346 |
"namnrymden och den har förmågan i sin effektiva förmågemängd. En process kan " |
| 347 |
"få förmågor i sin effektiva förmågemängd på olika sätt. Till exempel kan den " |
| 348 |
"köra ett sätt-användar-ID-program eller en körbar fil associerad med " |
| 349 |
"filförmågor. Dessutom kan en process få förmågor via effekten av " |
| 350 |
"B<clone>(2), B<unshare>(2) eller B<setns>(2), som redan beskrivits." |
| 351 |
|
| 352 |
#. type: Plain text |
| 353 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 354 |
#: opensuse-tumbleweed |
| 355 |
msgid "" |
| 356 |
"If a process has a capability in a user namespace, then it has that " |
| 357 |
"capability in all child (and further removed descendant) namespaces as well." |
| 358 |
msgstr "" |
| 359 |
"Om en process har en förmåga i en användarnamnrymd, då har den den förmågan " |
| 360 |
"i alla barn- (och mer avlägsna avkomme-)namnrymder också." |
| 361 |
|
| 362 |
# |
| 363 |
#. * The owner of the user namespace in the parent of the |
| 364 |
#. * user namespace has all caps. |
| 365 |
#. (and likewise associates the effective group ID of the creating process |
| 366 |
#. with the namespace). |
| 367 |
#. See kernel commit 520d9eabce18edfef76a60b7b839d54facafe1f9 for a fix |
| 368 |
#. on this point |
| 369 |
#. This includes the case where the process executes a set-user-ID |
| 370 |
#. program that confers the effective UID of the creator of the namespace. |
| 371 |
#. ============================================================ |
| 372 |
#. type: Plain text |
| 373 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 374 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 375 |
msgid "" |
| 376 |
"When a user namespace is created, the kernel records the effective user ID " |
| 377 |
"of the creating process as being the \"owner\" of the namespace. A process " |
| 378 |
"that resides in the parent of the user namespace and whose effective user ID " |
| 379 |
"matches the owner of the namespace has all capabilities in the namespace. " |
| 380 |
"By virtue of the previous rule, this means that the process has all " |
| 381 |
"capabilities in all further removed descendant user namespaces as well. The " |
| 382 |
"B<NS_GET_OWNER_UID> B<ioctl>(2) operation can be used to discover the user " |
| 383 |
"ID of the owner of the namespace; see B<ioctl_nsfs>(2)." |
| 384 |
msgstr "" |
| 385 |
"När en användarnamnrymd skapas sparar kärnan det effektiva användar-ID:t för " |
| 386 |
"processen som skapar den som varandes ”ägaren” till namnrymden. En process " |
| 387 |
"som bor i föräldern till användarnamnrymden och vars effektiva användar-ID " |
| 388 |
"stämmer med ägaren till namnrymden har alla förmågor i namnrymden. Tack vare " |
| 389 |
"föregående regel har processen alla förmågor i alla mer avlägsna " |
| 390 |
"avkommeanvändarnamnrymder också. Åtgärden B<NS_GET_OWNER_UID> till " |
| 391 |
"B<ioctl>(2) kan användas för att upptäcka användar-ID för namnrymdens ägare; " |
| 392 |
"se B<ioctl_nsfs>(2)." |
| 393 |
|
| 394 |
#. type: SS |
| 395 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 396 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 397 |
#, no-wrap |
| 398 |
msgid "Effect of capabilities within a user namespace" |
| 399 |
msgstr "Effekten av förmågor inom en användarnamnrymd" |
| 400 |
|
| 401 |
#. type: Plain text |
| 402 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 403 |
#: opensuse-tumbleweed |
| 404 |
msgid "" |
| 405 |
"Having a capability inside a user namespace permits a process to perform " |
| 406 |
"operations (that require privilege) only on resources governed by that " |
| 407 |
"namespace. In other words, having a capability in a user namespace permits " |
| 408 |
"a process to perform privileged operations on resources that are governed by " |
| 409 |
"(nonuser) namespaces owned by (associated with) the user namespace (see the " |
| 410 |
"next subsection)." |
| 411 |
msgstr "" |
| 412 |
"Att ha en förmåga inuti en användarnamnrymd tillåter en process att utföra " |
| 413 |
"åtgärder (som kräver privilegier) endast på resurser som styrs av den " |
| 414 |
"namnrymden. Med andra ord, att ha en förmåga i en användarnamnrymd tillåter " |
| 415 |
"en process att utföra privilegierade åtgärder på resurser som styrs av (icke " |
| 416 |
"användar-)namnrymder som ägs av (är associerade med) användarnamnrymden (se " |
| 417 |
"nästa underavdelning)." |
| 418 |
|
| 419 |
#. type: Plain text |
| 420 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 421 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 422 |
msgid "" |
| 423 |
"On the other hand, there are many privileged operations that affect " |
| 424 |
"resources that are not associated with any namespace type, for example, " |
| 425 |
"changing the system (i.e., calendar) time (governed by B<CAP_SYS_TIME>), " |
| 426 |
"loading a kernel module (governed by B<CAP_SYS_MODULE>), and creating a " |
| 427 |
"device (governed by B<CAP_MKNOD>). Only a process with privileges in the " |
| 428 |
"I<initial> user namespace can perform such operations." |
| 429 |
msgstr "" |
| 430 |
"Däremot finns det många privilegierade åtgärder som påverkar resurser som " |
| 431 |
"inte är associerade med någon namnrymdstyp, till exempel, att ändra " |
| 432 |
"systemtiden (d.v.s., kalendertiden) (som styrs av B<CAP_SYS_TIME>), att " |
| 433 |
"ladda kärnmoduler (som styrs av B<CAP_SYS_MODULE>) och att skapa en enhet " |
| 434 |
"(som styrs av B<CAP_MKNOD>). Endast en process med privilegier i den " |
| 435 |
"I<initiala> användarnamnrymden kan utföra sådana åtgärder." |
| 436 |
|
| 437 |
#. fs_flags = FS_USERNS_MOUNT in kernel sources |
| 438 |
#. type: Plain text |
| 439 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 440 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 441 |
msgid "" |
| 442 |
"Holding B<CAP_SYS_ADMIN> within the user namespace that owns a process's " |
| 443 |
"mount namespace allows that process to create bind mounts and mount the " |
| 444 |
"following types of filesystems:" |
| 445 |
msgstr "" |
| 446 |
"Att hålla B<CAP_SYS_ADMIN> inom användarnamnrymden som äger en process " |
| 447 |
"monteringsnamnrymd gör att den processen kan skapa bindmonteringar och " |
| 448 |
"montera följande typer av filsystem:" |
| 449 |
|
| 450 |
#. type: Plain text |
| 451 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 452 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 453 |
msgid "I</proc> (since Linux 3.8)" |
| 454 |
msgstr "I</proc> (från Linux 3.8)" |
| 455 |
|
| 456 |
#. type: Plain text |
| 457 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 458 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 459 |
msgid "I</sys> (since Linux 3.8)" |
| 460 |
msgstr "I</sys> (från Linux 3.8)" |
| 461 |
|
| 462 |
#. type: Plain text |
| 463 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 464 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 465 |
msgid "I<devpts> (since Linux 3.9)" |
| 466 |
msgstr "I<devpts> (från Linux 3.9)" |
| 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 |
msgid "B<tmpfs>(5) (since Linux 3.9)" |
| 472 |
msgstr "B<tmpfs>(5) (från Linux 3.9)" |
| 473 |
|
| 474 |
#. type: Plain text |
| 475 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 476 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 477 |
msgid "I<ramfs> (since Linux 3.9)" |
| 478 |
msgstr "I<ramfs> (från Linux 3.9)" |
| 479 |
|
| 480 |
#. type: Plain text |
| 481 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 482 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 483 |
msgid "I<mqueue> (since Linux 3.9)" |
| 484 |
msgstr "I<mqueue> (från Linux 3.9)" |
| 485 |
|
| 486 |
#. commit b2197755b2633e164a439682fb05a9b5ea48f706 |
| 487 |
#. type: Plain text |
| 488 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 489 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 490 |
msgid "I<bpf> (since Linux 4.4)" |
| 491 |
msgstr "I<bpf> (från Linux 4.4)" |
| 492 |
|
| 493 |
#. commit 92dbc9dedccb9759c7f9f2f0ae6242396376988f |
| 494 |
#. commit 4cb2c00c43b3fe88b32f29df4f76da1b92c33224 |
| 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 "I<overlayfs> (since Linux 5.11)" |
| 499 |
msgstr "I<overlayfs> (från Linux 5.11)" |
| 500 |
|
| 501 |
#. type: Plain text |
| 502 |
#: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron |
| 503 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 504 |
msgid "" |
| 505 |
"Holding B<CAP_SYS_ADMIN> within the user namespace that owns a process's " |
| 506 |
"cgroup namespace allows (since Linux 4.6) that process to mount the cgroup " |
| 507 |
"version 2 filesystem and cgroup version 1 named hierarchies (i.e., cgroup " |
| 508 |
"filesystems mounted with the I<\\[dq]none,name=\\[dq]> option)." |
| 509 |
msgstr "" |
| 510 |
"Att hålla B<CAP_SYS_ADMIN> inom användarnamnrymden som äger en process " |
| 511 |
"cgroup-namnrymd gör (från Linux 4.6) att den processen kan montera " |
| 512 |
"filsystemet cgroup version 2 och namngivna hierarkier av filsystemet cgroup " |
| 513 |
"verson 1 (d.v.s., cgroup-filsystem monterade med flaggan I<\\[dq]none," |
| 514 |
"name=\\[dq]>)." |
| 515 |
|
| 516 |
#. type: Plain text |
| 517 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 518 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 519 |
msgid "" |
| 520 |
"Holding B<CAP_SYS_ADMIN> within the user namespace that owns a process's PID " |
| 521 |
"namespace allows (since Linux 3.8) that process to mount I</proc> " |
| 522 |
"filesystems." |
| 523 |
msgstr "" |
| 524 |
"Att hålla B<CAP_SYS_ADMIN> inom användarnamnrymden som äger en process PID-" |
| 525 |
"namnrymd gör (från Linux 3.8) att den processen kan montera filsystemet I</" |
| 526 |
"proc>." |
| 527 |
|
| 528 |
# |
| 529 |
#. ============================================================ |
| 530 |
#. type: Plain text |
| 531 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 532 |
#: opensuse-tumbleweed |
| 533 |
msgid "" |
| 534 |
"However, mounting block-based filesystems can be done only by a process that " |
| 535 |
"holds B<CAP_SYS_ADMIN> in the initial user namespace." |
| 536 |
msgstr "" |
| 537 |
"Montering av blockbaserade filsystem kan dock endast göras av en process som " |
| 538 |
"håller B<CAP_SYS_ADMIN> i den initiala användarnamnrymden." |
| 539 |
|
| 540 |
#. type: SS |
| 541 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 542 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 543 |
#, no-wrap |
| 544 |
msgid "Interaction of user namespaces and other types of namespaces" |
| 545 |
msgstr "Interaktion mellan användarnamnrymder och andra typer av namnrymder" |
| 546 |
|
| 547 |
#. type: Plain text |
| 548 |
#: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron |
| 549 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 550 |
msgid "" |
| 551 |
"Since Linux 3.8, unprivileged processes can create user namespaces, and the " |
| 552 |
"other types of namespaces can be created with just the B<CAP_SYS_ADMIN> " |
| 553 |
"capability in the caller's user namespace." |
| 554 |
msgstr "" |
| 555 |
"Sedan Linux 3.8 kan oprivilegierade processer skapa användarnamnrymder, och " |
| 556 |
"de andra typerna av namnrymder kan skapas med bara förmågan B<CAP_SYS_ADMIN> " |
| 557 |
"i anroparens användarnamnrymd." |
| 558 |
|
| 559 |
#. type: Plain text |
| 560 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 561 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 562 |
msgid "" |
| 563 |
"When a nonuser namespace is created, it is owned by the user namespace in " |
| 564 |
"which the creating process was a member at the time of the creation of the " |
| 565 |
"namespace. Privileged operations on resources governed by the nonuser " |
| 566 |
"namespace require that the process has the necessary capabilities in the " |
| 567 |
"user namespace that owns the nonuser namespace." |
| 568 |
msgstr "" |
| 569 |
"När en annan namnrymd än en användarnamnrymd skapas ägs den av " |
| 570 |
"användarnamnrymden processen som skapade den var en medlem i vid tidpunkten " |
| 571 |
"då namnrymden skapades. Privilegierade åtgärder på resurser som styrs av en " |
| 572 |
"icke-användarnamnrymd kräver att processen har de nödvändiga förmågorna i " |
| 573 |
"användarnamnrymden som äger den icke-användarnamnrymden." |
| 574 |
|
| 575 |
#. type: Plain text |
| 576 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 577 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 578 |
msgid "" |
| 579 |
"If B<CLONE_NEWUSER> is specified along with other B<CLONE_NEW*> flags in a " |
| 580 |
"single B<clone>(2) or B<unshare>(2) call, the user namespace is guaranteed " |
| 581 |
"to be created first, giving the child (B<clone>(2)) or caller " |
| 582 |
"(B<unshare>(2)) privileges over the remaining namespaces created by the " |
| 583 |
"call. Thus, it is possible for an unprivileged caller to specify this " |
| 584 |
"combination of flags." |
| 585 |
msgstr "" |
| 586 |
"Om B<CLONE_NEWUSER> anges tillsammans med andra flaggor B<CLONE_NEW*> i ett " |
| 587 |
"enskilt anrop av B<clone>(2) eller B<unshare>(2) garanteras det att " |
| 588 |
"användarnamnrymden skapas först vilket ger barnet (B<clone>(2)) eller " |
| 589 |
"anroparen (B<unshare>(2)) privilegier över de andra namnrymderna som skapas " |
| 590 |
"av anropet. Det är alltså möjligt för en oprivilegierad anropare att ange " |
| 591 |
"denna kombination av flaggor." |
| 592 |
|
| 593 |
#. type: Plain text |
| 594 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 595 |
#: opensuse-tumbleweed |
| 596 |
msgid "" |
| 597 |
"When a new namespace (other than a user namespace) is created via " |
| 598 |
"B<clone>(2) or B<unshare>(2), the kernel records the user namespace of the " |
| 599 |
"creating process as the owner of the new namespace. (This association can't " |
| 600 |
"be changed.) When a process in the new namespace subsequently performs " |
| 601 |
"privileged operations that operate on global resources isolated by the " |
| 602 |
"namespace, the permission checks are performed according to the process's " |
| 603 |
"capabilities in the user namespace that the kernel associated with the new " |
| 604 |
"namespace. For example, suppose that a process attempts to change the " |
| 605 |
"hostname (B<sethostname>(2)), a resource governed by the UTS namespace. In " |
| 606 |
"this case, the kernel will determine which user namespace owns the process's " |
| 607 |
"UTS namespace, and check whether the process has the required capability " |
| 608 |
"(B<CAP_SYS_ADMIN>) in that user namespace." |
| 609 |
msgstr "" |
| 610 |
"När en ny namnrymd (annan än en användarnamnrymd) skapas via B<clone>(2) " |
| 611 |
"eller B<unshare>(2) registrerar kärnan användarnamnrymden för processen som " |
| 612 |
"skapar den som ägare till den nya namnrymden. (Denna koppling kan inte " |
| 613 |
"ändras.) När en process i den nya namnrymden senare utför privilegierade " |
| 614 |
"åtgärder som verkar på globala resurser isolerade av namnrymden utförs " |
| 615 |
"rättighetskontrollerna enligt processens förmågor i användarnamnrymden som " |
| 616 |
"kärnan associerade med den nya namnrymden. Till exempel, antag att en " |
| 617 |
"process försöker ändra värdnamnet (B<sethostname>(2)), en resurs som styrs " |
| 618 |
"av UTS-namnrymden. I detta fall kommer kärnan avgöra vilken användarnamnrymd " |
| 619 |
"som äger processens UTS-namnrymd, och kontrollera huruvida processen har den " |
| 620 |
"nödvändiga förmågan (B<CAP_SYS_ADMIN>) i den användarnamnrymden." |
| 621 |
|
| 622 |
# |
| 623 |
#. ============================================================ |
| 624 |
#. type: Plain text |
| 625 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 626 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 627 |
msgid "" |
| 628 |
"The B<NS_GET_USERNS> B<ioctl>(2) operation can be used to discover the user " |
| 629 |
"namespace that owns a nonuser namespace; see B<ioctl_nsfs>(2)." |
| 630 |
msgstr "" |
| 631 |
"B<ioctl>(2)-åtgärden B<NS_GET_USERNS> kan användas för att hitta " |
| 632 |
"användarnamnrymden som äger en icke-användarnamnrymd; se B<ioctl_nsfs>(2)." |
| 633 |
|
| 634 |
#. type: SS |
| 635 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 636 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 637 |
#, no-wrap |
| 638 |
msgid "User and group ID mappings: uid_map and gid_map" |
| 639 |
msgstr "Användar- och grupp-ID-avbildningar: uid_map och gid_map" |
| 640 |
|
| 641 |
#. commit 22d917d80e842829d0ca0a561967d728eb1d6303 |
| 642 |
#. type: Plain text |
| 643 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 644 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 645 |
msgid "" |
| 646 |
"When a user namespace is created, it starts out without a mapping of user " |
| 647 |
"IDs (group IDs) to the parent user namespace. The I</proc/>pidI</uid_map> " |
| 648 |
"and I</proc/>pidI</gid_map> files (available since Linux 3.5) expose the " |
| 649 |
"mappings for user and group IDs inside the user namespace for the process " |
| 650 |
"I<pid>. These files can be read to view the mappings in a user namespace " |
| 651 |
"and written to (once) to define the mappings." |
| 652 |
msgstr "" |
| 653 |
"När en användarnamnrymd skapas börjar den utan någon avbildning av användar-" |
| 654 |
"ID:n (grupp-ID:n) till förälderns användarnamnrymd. Filerna I</proc/>pidI</" |
| 655 |
"uid_map> och I</proc/>pidI</gid_map> (tillgängliga från Linux 3.5) visar " |
| 656 |
"avbildningarna för användar- och grupp-ID:n inuti användarnamnrymden för " |
| 657 |
"processen I<pid>. Dessa filer kan läsas för att visa avbildningarna i en " |
| 658 |
"användarnamnrymd och skrivas till (en gång) för att definiera avbildningarna." |
| 659 |
|
| 660 |
#. type: Plain text |
| 661 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 662 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 663 |
msgid "" |
| 664 |
"The description in the following paragraphs explains the details for " |
| 665 |
"I<uid_map>; I<gid_map> is exactly the same, but each instance of \"user ID\" " |
| 666 |
"is replaced by \"group ID\"." |
| 667 |
msgstr "" |
| 668 |
"Beskrivningen i följande stycken förklarar detaljerna för I<uid_map>; " |
| 669 |
"I<gid_map> är exakt likadan, med varje förekomst av ”användar-ID” ersatt med " |
| 670 |
"”grupp-ID”." |
| 671 |
|
| 672 |
#. type: Plain text |
| 673 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 674 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 675 |
msgid "" |
| 676 |
"The I<uid_map> file exposes the mapping of user IDs from the user namespace " |
| 677 |
"of the process I<pid> to the user namespace of the process that opened " |
| 678 |
"I<uid_map> (but see a qualification to this point below). In other words, " |
| 679 |
"processes that are in different user namespaces will potentially see " |
| 680 |
"different values when reading from a particular I<uid_map> file, depending " |
| 681 |
"on the user ID mappings for the user namespaces of the reading processes." |
| 682 |
msgstr "" |
| 683 |
"Filen I<uid_map> visar avbildningen av användar-ID:n från användarnamnrymden " |
| 684 |
"för processen som öppnade I<uid_map> (men se en avvikelse från denna punkt " |
| 685 |
"nedan). Med andra ord kan potentiellt processer som finns i olika " |
| 686 |
"användarnamnrymder se olika värden när de läser från en viss I<uid_map>-fil, " |
| 687 |
"beroende på användar-ID-avbildningarna för användarnamnrymderna för de " |
| 688 |
"läsande processerna." |
| 689 |
|
| 690 |
#. type: Plain text |
| 691 |
#: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron |
| 692 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 693 |
msgid "" |
| 694 |
"Each line in the I<uid_map> file specifies a 1-to-1 mapping of a range of " |
| 695 |
"contiguous user IDs between two user namespaces. (When a user namespace is " |
| 696 |
"first created, this file is empty.) The specification in each line takes " |
| 697 |
"the form of three numbers delimited by white space. The first two numbers " |
| 698 |
"specify the starting user ID in each of the two user namespaces. The third " |
| 699 |
"number specifies the size of the mapped range. In detail, the fields are " |
| 700 |
"interpreted as follows:" |
| 701 |
msgstr "" |
| 702 |
"Varje rad i filen I<uid_map> anger en 1-till-1-avbildning av ett intervall " |
| 703 |
"av sammanhängande användar-ID:n mellan två användarnamnrymder. (När en " |
| 704 |
"användarnamnrymd först skapas är denna fil tom.) Specifikationen på varje " |
| 705 |
"rad har formen tre tal avgränsade av mellanslag. De första två talen anger " |
| 706 |
"det första användar-ID:t i vardera av de två användarnamnrymderna. Det " |
| 707 |
"tredje talet anger storleken på det avbildade intervallet. Mer exakt tolkas " |
| 708 |
"fälten som följer:" |
| 709 |
|
| 710 |
#. type: IP |
| 711 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 712 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 713 |
#, no-wrap |
| 714 |
msgid "(1)" |
| 715 |
msgstr "(1)" |
| 716 |
|
| 717 |
#. type: Plain text |
| 718 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 719 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 720 |
msgid "" |
| 721 |
"The start of the range of user IDs in the user namespace of the process " |
| 722 |
"I<pid>." |
| 723 |
msgstr "" |
| 724 |
"Början av intervallet av användar-ID:n i processen I<pid>s användarnamnrymd." |
| 725 |
|
| 726 |
#. type: IP |
| 727 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 728 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 729 |
#, no-wrap |
| 730 |
msgid "(2)" |
| 731 |
msgstr "(2)" |
| 732 |
|
| 733 |
#. type: Plain text |
| 734 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 735 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 736 |
msgid "" |
| 737 |
"The start of the range of user IDs to which the user IDs specified by field " |
| 738 |
"one map. How field two is interpreted depends on whether the process that " |
| 739 |
"opened I<uid_map> and the process I<pid> are in the same user namespace, as " |
| 740 |
"follows:" |
| 741 |
msgstr "" |
| 742 |
"Början på intervallet av användar-ID:n till vilka användar-ID:n som anges av " |
| 743 |
"fält ett avbildas. Hur fält två tolkas beror på huruvida processen som " |
| 744 |
"öppnade I<uid_map> och processen I<pid> finns i samma användarnamnrymd, som " |
| 745 |
"följer:" |
| 746 |
|
| 747 |
#. type: IP |
| 748 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 749 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 750 |
#, no-wrap |
| 751 |
msgid "(a)" |
| 752 |
msgstr "(a)" |
| 753 |
|
| 754 |
#. type: Plain text |
| 755 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 756 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 757 |
msgid "" |
| 758 |
"If the two processes are in different user namespaces: field two is the " |
| 759 |
"start of a range of user IDs in the user namespace of the process that " |
| 760 |
"opened I<uid_map>." |
| 761 |
msgstr "" |
| 762 |
"Om de två processerna finns i olika användarnamnrymder: fält två är början " |
| 763 |
"på ett intervall av användar-ID:n i användarnamnrymden för processen som " |
| 764 |
"öppnade I<uid_map>." |
| 765 |
|
| 766 |
#. type: IP |
| 767 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 768 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 769 |
#, no-wrap |
| 770 |
msgid "(b)" |
| 771 |
msgstr "(b)" |
| 772 |
|
| 773 |
#. type: Plain text |
| 774 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 775 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 776 |
msgid "" |
| 777 |
"If the two processes are in the same user namespace: field two is the start " |
| 778 |
"of the range of user IDs in the parent user namespace of the process " |
| 779 |
"I<pid>. This case enables the opener of I<uid_map> (the common case here is " |
| 780 |
"opening I</proc/self/uid_map>) to see the mapping of user IDs into the user " |
| 781 |
"namespace of the process that created this user namespace." |
| 782 |
msgstr "" |
| 783 |
"Om de två processerna finns i samma användarnamnrymd: fält två är början på " |
| 784 |
"intervallet av användar-ID:n i process I<pid>s föräldraanvändarnamnrymd. " |
| 785 |
"Detta gör att den som öppnar I<uid_map> (det vanliga fallet här är att öppna " |
| 786 |
"I</proc/self/uid_map>) kan se avbildningen av användar-ID:n in i " |
| 787 |
"användarnamnrymden för processen som skapade denna användarnamnrymd." |
| 788 |
|
| 789 |
#. type: IP |
| 790 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 791 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 792 |
#, no-wrap |
| 793 |
msgid "(3)" |
| 794 |
msgstr "(3)" |
| 795 |
|
| 796 |
#. type: Plain text |
| 797 |
#: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron |
| 798 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 799 |
msgid "" |
| 800 |
"The size of the range of user IDs that is mapped between the two user " |
| 801 |
"namespaces." |
| 802 |
msgstr "" |
| 803 |
"Storleken på intervallet av användar-ID:n som avbildas mellan de två " |
| 804 |
"användarnamnrymderna." |
| 805 |
|
| 806 |
#. type: Plain text |
| 807 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 808 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 809 |
msgid "" |
| 810 |
"System calls that return user IDs (group IDs)\\[em]for example, " |
| 811 |
"B<getuid>(2), B<getgid>(2), and the credential fields in the structure " |
| 812 |
"returned by B<stat>(2)\\[em]return the user ID (group ID) mapped into the " |
| 813 |
"caller's user namespace." |
| 814 |
msgstr "" |
| 815 |
"Systemanrop som returnerar användar-ID:n (grupp-ID:n) \\[em] till exempel " |
| 816 |
"B<getuid>(2), B<getgid>(2), och kreditivfälten i posten som returneras av " |
| 817 |
"B<stat>(2) \\[em] returnerar användar-ID:t (grupp-ID:t) avbildat in i " |
| 818 |
"anroparens användarnamnrymd." |
| 819 |
|
| 820 |
#. type: Plain text |
| 821 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 822 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 823 |
msgid "" |
| 824 |
"When a process accesses a file, its user and group IDs are mapped into the " |
| 825 |
"initial user namespace for the purpose of permission checking and assigning " |
| 826 |
"IDs when creating a file. When a process retrieves file user and group IDs " |
| 827 |
"via B<stat>(2), the IDs are mapped in the opposite direction, to produce " |
| 828 |
"values relative to the process user and group ID mappings." |
| 829 |
msgstr "" |
| 830 |
"När en process begär tillgång till en fil avbildas dess användar- och grupp-" |
| 831 |
"ID:n in i den initiala användarnamnrymden i syfte att kontrollera " |
| 832 |
"rättigheterna och tilldela ID:n när en fil skapas. När en process hämtar " |
| 833 |
"filens användar- och grupp-ID:n via B<stat>(2) avbildas ID:erna i den andra " |
| 834 |
"riktningen, för att skapa värden relativt processens användar- och grupp-ID-" |
| 835 |
"avbildningar." |
| 836 |
|
| 837 |
#. type: Plain text |
| 838 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 839 |
#: opensuse-tumbleweed |
| 840 |
msgid "" |
| 841 |
"The initial user namespace has no parent namespace, but, for consistency, " |
| 842 |
"the kernel provides dummy user and group ID mapping files for this " |
| 843 |
"namespace. Looking at the I<uid_map> file (I<gid_map> is the same) from a " |
| 844 |
"shell in the initial namespace shows:" |
| 845 |
msgstr "" |
| 846 |
"Den initiala användarnamnrymden har ingen föräldranamnrymd, men för " |
| 847 |
"konsistensens skull tillhandahåller kärnan tomfiler för användar- och grupp-" |
| 848 |
"ID-avbildningar för den namnrymden. Tittar man på filen I<uid_map> " |
| 849 |
"(I<gid_map> är likadan) från ett skal i den initiala namnrymden ser man:" |
| 850 |
|
| 851 |
#. type: Plain text |
| 852 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 853 |
#: opensuse-tumbleweed |
| 854 |
#, no-wrap |
| 855 |
msgid "" |
| 856 |
"$B< cat /proc/$$/uid_map>;\n" |
| 857 |
" 0 0 4294967295\n" |
| 858 |
msgstr "" |
| 859 |
"$B< cat /proc/$$/uid_map>;\n" |
| 860 |
" 0 0 4294967295\n" |
| 861 |
|
| 862 |
# |
| 863 |
#. ============================================================ |
| 864 |
#. type: Plain text |
| 865 |
#: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron |
| 866 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 867 |
#, fuzzy |
| 868 |
#| msgid "" |
| 869 |
#| "This mapping tells us that the range starting at user ID 0 in this " |
| 870 |
#| "namespace maps to a range starting at 0 in the (nonexistent) parent " |
| 871 |
#| "namespace, and the size of the range is the largest 32-bit unsigned " |
| 872 |
#| "integer. This leaves 4294967295 (the 32-bit signed -1 value) unmapped. " |
| 873 |
#| "This is deliberate: I<(uid_t)\\~-1> is used in several interfaces (e.g., " |
| 874 |
#| "B<setreuid>(2)) as a way to specify \"no user ID\". Leaving " |
| 875 |
#| "I<(uid_t)\\~-1> unmapped and unusable guarantees that there will be no " |
| 876 |
#| "confusion when using these interfaces." |
| 877 |
msgid "" |
| 878 |
"This mapping tells us that the range starting at user ID 0 in this namespace " |
| 879 |
"maps to a range starting at 0 in the (nonexistent) parent namespace, and the " |
| 880 |
"size of the range is the largest 32-bit unsigned integer. This leaves " |
| 881 |
"4294967295 (the 32-bit signed -1 value) unmapped. This is deliberate: " |
| 882 |
"I<(uid_t)\\ -1> is used in several interfaces (e.g., B<setreuid>(2)) as a " |
| 883 |
"way to specify \"no user ID\". Leaving I<(uid_t)\\ -1> unmapped and " |
| 884 |
"unusable guarantees that there will be no confusion when using these " |
| 885 |
"interfaces." |
| 886 |
msgstr "" |
| 887 |
"Denna avbildning säger oss att intervallet som startar med användar-ID 0 i " |
| 888 |
"denna namnrymd översätts till ett intervall som startar med 0 i den " |
| 889 |
"(obefintliga) föräldranamnrymden, och att storleken på intervallet är det " |
| 890 |
"största 32-bitars teckenlösa heltalet. Detta lämnar 4294967295 (32-" |
| 891 |
"bitsvärdet -1) oavbildat. Detta är avsiktligt: I<(uid_t)\\~-1> används i " |
| 892 |
"flera gränssnitt (t.ex., B<setreuid>(2)) som ett sätt att ange ”inget " |
| 893 |
"användar-ID”. Genom att låta I<(uid_t)\\~-1> vara oavbildat och oanvändbart " |
| 894 |
"garanteras att det inte kommer uppstå någon förvirring vid användning av " |
| 895 |
"dessa gränssnitt." |
| 896 |
|
| 897 |
#. type: SS |
| 898 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 899 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 900 |
#, no-wrap |
| 901 |
msgid "Defining user and group ID mappings: writing to uid_map and gid_map" |
| 902 |
msgstr "Att definiera användar- och grupp-ID-avbildningar: att skriva till uid_map och gid_map" |
| 903 |
|
| 904 |
#. type: Plain text |
| 905 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 906 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 907 |
msgid "" |
| 908 |
"After the creation of a new user namespace, the I<uid_map> file of I<one> of " |
| 909 |
"the processes in the namespace may be written to I<once> to define the " |
| 910 |
"mapping of user IDs in the new user namespace. An attempt to write more " |
| 911 |
"than once to a I<uid_map> file in a user namespace fails with the error " |
| 912 |
"B<EPERM>. Similar rules apply for I<gid_map> files." |
| 913 |
msgstr "" |
| 914 |
"Efter att en ny användarnamnrymd skapats kan filen I<uid_map> för I<en> av " |
| 915 |
"processerna i namnrymden skrivas till I<en gång> för att definiera " |
| 916 |
"avbildningen av användar-ID:n i den nya användarnamnrymden. Ett försök att " |
| 917 |
"skriva mer än en gång till en I<uid_map>-fil i en användarnamnrymd " |
| 918 |
"misslyckas med felet B<EPERM>. Motsvarande regler gäller för I<gid_map>-" |
| 919 |
"filer." |
| 920 |
|
| 921 |
#. type: Plain text |
| 922 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 923 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 924 |
msgid "" |
| 925 |
"The lines written to I<uid_map> (I<gid_map>) must conform to the following " |
| 926 |
"validity rules:" |
| 927 |
msgstr "" |
| 928 |
"Raderna som skrivs till I<uid_map> (I<gid_map>) måste lyda följande " |
| 929 |
"giltighetsregler:" |
| 930 |
|
| 931 |
#. type: Plain text |
| 932 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 933 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 934 |
msgid "" |
| 935 |
"The three fields must be valid numbers, and the last field must be greater " |
| 936 |
"than 0." |
| 937 |
msgstr "" |
| 938 |
"De tre fälten måste vara giltiga tal, och det sista fältet måste vara större " |
| 939 |
"än 0." |
| 940 |
|
| 941 |
#. type: Plain text |
| 942 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 943 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 944 |
msgid "Lines are terminated by newline characters." |
| 945 |
msgstr "Rader avslutas av nyradstecken." |
| 946 |
|
| 947 |
#. 5*12-byte records could fit in a 64B cache line |
| 948 |
#. commit 6397fac4915ab3002dc15aae751455da1a852f25 |
| 949 |
#. type: Plain text |
| 950 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 951 |
#: opensuse-tumbleweed |
| 952 |
msgid "" |
| 953 |
"There is a limit on the number of lines in the file. Up to Linux 4.14, this " |
| 954 |
"limit was (arbitrarily) set at 5 lines. Since Linux 4.16, the limit is 340 " |
| 955 |
"lines. In addition, the number of bytes written to the file must be less " |
| 956 |
"than the system page size, and the write must be performed at the start of " |
| 957 |
"the file (i.e., B<lseek>(2) and B<pwrite>(2) can't be used to write to " |
| 958 |
"nonzero offsets in the file)." |
| 959 |
msgstr "" |
| 960 |
"Det finns en gräns på antalet rader i filen. Fram till Linux 4.14 sattes " |
| 961 |
"denna gräns (godtyckligt) till 5 rader. Från Linux 4.16 är gränsen 340 " |
| 962 |
"rader. Dessutom måste antalet byte som skrivs till filen vara mindre än " |
| 963 |
"systemets sidstorlek, och skrivningen måste göras från början av filen (d.v." |
| 964 |
"s., B<lseek>(2) och B<pwrite>(2) kan inte användas för att skriva till " |
| 965 |
"nollskilda avstånd in i filen)." |
| 966 |
|
| 967 |
#. commit 0bd14b4fd72afd5df41e9fd59f356740f22fceba |
| 968 |
#. type: Plain text |
| 969 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 970 |
#: opensuse-tumbleweed |
| 971 |
msgid "" |
| 972 |
"The range of user IDs (group IDs) specified in each line cannot overlap " |
| 973 |
"with the ranges in any other lines. In the initial implementation (Linux " |
| 974 |
"3.8), this requirement was satisfied by a simplistic implementation that " |
| 975 |
"imposed the further requirement that the values in both field 1 and field 2 " |
| 976 |
"of successive lines must be in ascending numerical order, which prevented " |
| 977 |
"some otherwise valid maps from being created. Since Linux 3.9, this " |
| 978 |
"limitation has been removed, allowing any valid set of nonoverlapping maps." |
| 979 |
msgstr "" |
| 980 |
"Intervallet av användar-ID:n (grupp-ID:n) som anges på varje rad får inte " |
| 981 |
"överlappa med intervallerna på några andra rader. I den ursprungliga " |
| 982 |
"implementationen (Linux 3.8) uppfylldes detta krav av en enkel " |
| 983 |
"implementation som lade till det ytterligare kravet att värdena i både fält " |
| 984 |
"1 och fält 2 av följande rader måste vara i stigande numerisk ordning, " |
| 985 |
"vilket förhindrade några eljest giltiga avbildningar från att skapas. Från " |
| 986 |
"Linux 3.9 har denna begränsning tagits bort och alla giltiga uppsättningar " |
| 987 |
"av avbildningar som inte överlappar tillåts." |
| 988 |
|
| 989 |
#. type: Plain text |
| 990 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 991 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 992 |
msgid "At least one line must be written to the file." |
| 993 |
msgstr "Åtminstone en rad måste skrivas till filen." |
| 994 |
|
| 995 |
#. type: Plain text |
| 996 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 997 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 998 |
msgid "Writes that violate the above rules fail with the error B<EINVAL>." |
| 999 |
msgstr "" |
| 1000 |
"Skrivningar som bryter mot ovanstående regler misslyckas med felet B<EINVAL>." |
| 1001 |
|
| 1002 |
#. type: Plain text |
| 1003 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1004 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1005 |
msgid "" |
| 1006 |
"In order for a process to write to the I</proc/>pidI</uid_map> (I</proc/" |
| 1007 |
">pidI</gid_map>) file, all of the following permission requirements must be " |
| 1008 |
"met:" |
| 1009 |
msgstr "" |
| 1010 |
"För att en process skall kunna skriva till filen I</proc>pidI</uid_map> (I</" |
| 1011 |
"proc>pidI</gid_map>) måste alla följande rättighetskrav vara uppfyllda:" |
| 1012 |
|
| 1013 |
#. type: Plain text |
| 1014 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1015 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1016 |
msgid "" |
| 1017 |
"The writing process must have the B<CAP_SETUID> (B<CAP_SETGID>) capability " |
| 1018 |
"in the user namespace of the process I<pid>." |
| 1019 |
msgstr "" |
| 1020 |
"Den skrivande processen måste ha förmågan B<CAP_SETUID> (B<CAP_SETGID>) i " |
| 1021 |
"processen I<pid>s användarnamnrymd." |
| 1022 |
|
| 1023 |
#. type: Plain text |
| 1024 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1025 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1026 |
msgid "" |
| 1027 |
"The writing process must either be in the user namespace of the process " |
| 1028 |
"I<pid> or be in the parent user namespace of the process I<pid>." |
| 1029 |
msgstr "" |
| 1030 |
"Den skrivande processen måste antingen finnas i namnrymden för process " |
| 1031 |
"I<pid> eller finnas i föräldraanvändarnamnrymden till process I<pid>." |
| 1032 |
|
| 1033 |
#. type: Plain text |
| 1034 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1035 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1036 |
msgid "" |
| 1037 |
"The mapped user IDs (group IDs) must in turn have a mapping in the parent " |
| 1038 |
"user namespace." |
| 1039 |
msgstr "" |
| 1040 |
"De avbildade användar-ID:na (grupp-ID:na) måste i sin tur ha en avbildning i " |
| 1041 |
"föräldraanvändarnamnrymden." |
| 1042 |
|
| 1043 |
#. type: Plain text |
| 1044 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1045 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1046 |
msgid "" |
| 1047 |
"If updating I</proc/>pidI</uid_map> to create a mapping that maps UID 0 in " |
| 1048 |
"the parent namespace, then one of the following must be true:" |
| 1049 |
msgstr "" |
| 1050 |
"Om man uppdaterar I</proc/>pidI</uid_map> för att skapa en avbildning som " |
| 1051 |
"avbildar till UID 0 i föräldranamnrymden måste en av de följande vara sann:" |
| 1052 |
|
| 1053 |
#. type: Plain text |
| 1054 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1055 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1056 |
msgid "" |
| 1057 |
"if writing process is in the parent user namespace, then it must have the " |
| 1058 |
"B<CAP_SETFCAP> capability in that user namespace; or" |
| 1059 |
msgstr "" |
| 1060 |
"om den skrivande processen finns i föräldraanvändarnamnrymden, då måste den " |
| 1061 |
"ha förmågan B<CAP_SETFCAP> i den användarnamnrymden; eller" |
| 1062 |
|
| 1063 |
#. type: Plain text |
| 1064 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1065 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1066 |
msgid "" |
| 1067 |
"if the writing process is in the child user namespace, then the process that " |
| 1068 |
"created the user namespace must have had the B<CAP_SETFCAP> capability when " |
| 1069 |
"the namespace was created." |
| 1070 |
msgstr "" |
| 1071 |
"om den skrivande processen finns i barnanvändarnamnrymden, då måste " |
| 1072 |
"processen som skapade användarnamnrymden ha haft förmågan B<CAP_SETFCAP> när " |
| 1073 |
"namnrymden skapades." |
| 1074 |
|
| 1075 |
#. commit db2e718a47984b9d71ed890eb2ea36ecf150de18 |
| 1076 |
#. type: Plain text |
| 1077 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1078 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1079 |
msgid "" |
| 1080 |
"This rule has been in place since Linux 5.12. It eliminates an earlier " |
| 1081 |
"security bug whereby a UID 0 process that lacks the B<CAP_SETFCAP> " |
| 1082 |
"capability, which is needed to create a binary with namespaced file " |
| 1083 |
"capabilities (as described in B<capabilities>(7)), could nevertheless create " |
| 1084 |
"such a binary, by the following steps:" |
| 1085 |
msgstr "" |
| 1086 |
"Denna regel har funnits från Linux 5.12. Den eliminerar en tidigare " |
| 1087 |
"säkerhetsbrist varigenom en UID 0-process som saknar förmågan B<CAP_SETFCAP> " |
| 1088 |
"vilken behövs för att skapa en binär med namnrymdsfilförmågor (så som det " |
| 1089 |
"beskrivs i B<capabilities>(7)) ändå kunde skapa en sådan binär genom " |
| 1090 |
"följande steg:" |
| 1091 |
|
| 1092 |
#. type: Plain text |
| 1093 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1094 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1095 |
msgid "" |
| 1096 |
"Create a new user namespace with the identity mapping (i.e., UID 0 in the " |
| 1097 |
"new user namespace maps to UID 0 in the parent namespace), so that UID 0 in " |
| 1098 |
"both namespaces is equivalent to the same root user ID." |
| 1099 |
msgstr "" |
| 1100 |
"Skapa en ny användarnamnrymd med identitetsavbildningen (d.v.s., AID 0 i den " |
| 1101 |
"nya användarnamnrymden avbildas på AID 0 i föräldranamnrymden), så att AID 0 " |
| 1102 |
"båda namnrymderna är ekvivalent med samma root-användar-ID." |
| 1103 |
|
| 1104 |
#. type: Plain text |
| 1105 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1106 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1107 |
msgid "" |
| 1108 |
"Since the child process has the B<CAP_SETFCAP> capability, it could create a " |
| 1109 |
"binary with namespaced file capabilities that would then be effective in the " |
| 1110 |
"parent user namespace (because the root user IDs are the same in the two " |
| 1111 |
"namespaces)." |
| 1112 |
msgstr "" |
| 1113 |
"Eftersom barnprocessen har förmågan B<CAP_SETFCAP> kunde den skapa en binär " |
| 1114 |
"med namnrymdsfilförmågor som sedan skulle vara verkningsfulla i " |
| 1115 |
"föräldranamnrymden (eftersom root-användar-ID:t är desamma i de två " |
| 1116 |
"namnrymderna)." |
| 1117 |
|
| 1118 |
#. type: Plain text |
| 1119 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1120 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1121 |
msgid "One of the following two cases applies:" |
| 1122 |
msgstr "En av följande två fall gäller:" |
| 1123 |
|
| 1124 |
#. type: Plain text |
| 1125 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1126 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1127 |
msgid "" |
| 1128 |
"I<Either> the writing process has the B<CAP_SETUID> (B<CAP_SETGID>) " |
| 1129 |
"capability in the I<parent> user namespace." |
| 1130 |
msgstr "" |
| 1131 |
"I<Antingen> har den skrivande processen förmågan B<CAP_SETUID> " |
| 1132 |
"(B<CAP_SETGID>) i I<föräldra>användarnamnrymden." |
| 1133 |
|
| 1134 |
#. type: Plain text |
| 1135 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1136 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1137 |
msgid "" |
| 1138 |
"No further restrictions apply: the process can make mappings to arbitrary " |
| 1139 |
"user IDs (group IDs) in the parent user namespace." |
| 1140 |
msgstr "" |
| 1141 |
"Inga ytterligare begränsningar gäller: processen kan göra avbildningar till " |
| 1142 |
"godtyckliga användar-ID:n (grupp-ID:n) i föräldraanvändarnamnrymden." |
| 1143 |
|
| 1144 |
#. type: Plain text |
| 1145 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1146 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1147 |
msgid "I<Or> otherwise all of the following restrictions apply:" |
| 1148 |
msgstr "I<Eller> i annat fall gäller alla följande beskrivningar:" |
| 1149 |
|
| 1150 |
#. type: Plain text |
| 1151 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 1152 |
#: opensuse-tumbleweed |
| 1153 |
msgid "" |
| 1154 |
"The data written to I<uid_map> (I<gid_map>) must consist of a single line " |
| 1155 |
"that maps the writing process's effective user ID (group ID) in the parent " |
| 1156 |
"user namespace to a user ID (group ID) in the user namespace." |
| 1157 |
msgstr "" |
| 1158 |
"Data som skrivs till I<uid_map> (I<gid_map>) måste bestå av en enda rad som " |
| 1159 |
"avbildar den skrivande processens effektiva användar-ID (grupp-ID) i " |
| 1160 |
"föräldraanvändarnamnrymden till ett användar-ID (grupp-ID) i " |
| 1161 |
"användarnamnrymden." |
| 1162 |
|
| 1163 |
#. type: Plain text |
| 1164 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1165 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1166 |
msgid "" |
| 1167 |
"The writing process must have the same effective user ID as the process that " |
| 1168 |
"created the user namespace." |
| 1169 |
msgstr "" |
| 1170 |
"Den skrivande processen måste ha samma effektiva användar-ID som processen " |
| 1171 |
"som skapade användarnamnrymden." |
| 1172 |
|
| 1173 |
#. type: Plain text |
| 1174 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 1175 |
#: opensuse-tumbleweed |
| 1176 |
msgid "" |
| 1177 |
"In the case of I<gid_map>, use of the B<setgroups>(2) system call must " |
| 1178 |
"first be denied by writing \\[dq]I<deny>\\[dq] to the I</proc/>pidI</" |
| 1179 |
"setgroups> file (see below) before writing to I<gid_map>." |
| 1180 |
msgstr "" |
| 1181 |
"När det gäller I<gid_map> måste först användning av systemanropet " |
| 1182 |
"B<setgroups>(2) nekas genom att skriva \\[dq]I<deny>\\[dq] till filen I</" |
| 1183 |
"proc/>pidI</setgroups> (se nedan) före någon skrivning till I<gid_map>." |
| 1184 |
|
| 1185 |
# |
| 1186 |
#. ============================================================ |
| 1187 |
#. type: Plain text |
| 1188 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1189 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1190 |
msgid "Writes that violate the above rules fail with the error B<EPERM>." |
| 1191 |
msgstr "" |
| 1192 |
"Skrivningar som strider mot ovanstående regler misslyckas med felet B<EPERM>." |
| 1193 |
|
| 1194 |
#. type: SS |
| 1195 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1196 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1197 |
#, no-wrap |
| 1198 |
msgid "Project ID mappings: projid_map" |
| 1199 |
msgstr "Projekt-ID-avbildningar: projid_map" |
| 1200 |
|
| 1201 |
#. type: Plain text |
| 1202 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1203 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1204 |
msgid "" |
| 1205 |
"Similarly to user and group ID mappings, it is possible to create project ID " |
| 1206 |
"mappings for a user namespace. (Project IDs are used for disk quotas; see " |
| 1207 |
"B<setquota>(8) and B<quotactl>(2).)" |
| 1208 |
msgstr "" |
| 1209 |
"Liksom för användar- och grupp-ID-avbildningar är det möjligt att skapa " |
| 1210 |
"projekt-ID-avbildningar för användarnamnrymder. (Projekt-ID:n används för " |
| 1211 |
"diskkvoter; se B<setquota>(8) och B<quotactl>(2).)" |
| 1212 |
|
| 1213 |
#. commit f76d207a66c3a53defea67e7d36c3eb1b7d6d61d |
| 1214 |
#. type: Plain text |
| 1215 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1216 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1217 |
msgid "" |
| 1218 |
"Project ID mappings are defined by writing to the I</proc/>pidI</projid_map> " |
| 1219 |
"file (present since Linux 3.7)." |
| 1220 |
msgstr "" |
| 1221 |
"Projekt-ID-avbildningar definieras genom att skriva till filen I</proc/" |
| 1222 |
">pidI</projid_map> (som finns från Linux 3.7)." |
| 1223 |
|
| 1224 |
#. type: Plain text |
| 1225 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1226 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1227 |
msgid "" |
| 1228 |
"The validity rules for writing to the I</proc/>pidI</projid_map> file are as " |
| 1229 |
"for writing to the I<uid_map> file; violation of these rules causes " |
| 1230 |
"B<write>(2) to fail with the error B<EINVAL>." |
| 1231 |
msgstr "" |
| 1232 |
"Giltighetsreglerna för att skriva till filen I</proc/>pidI</projid_map> är " |
| 1233 |
"som för att skriva till filen I<uid_map>; brott mot dessa regler får " |
| 1234 |
"B<write>(2) att misslyckas med felet B<EINVAL>." |
| 1235 |
|
| 1236 |
#. type: Plain text |
| 1237 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1238 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1239 |
msgid "" |
| 1240 |
"The permission rules for writing to the I</proc/>pidI</projid_map> file are " |
| 1241 |
"as follows:" |
| 1242 |
msgstr "" |
| 1243 |
"Rättighetsreglerna för att skriva till filen I</proc/>pidI</projid_map> är " |
| 1244 |
"som följer:" |
| 1245 |
|
| 1246 |
#. type: Plain text |
| 1247 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1248 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1249 |
msgid "" |
| 1250 |
"The mapped project IDs must in turn have a mapping in the parent user " |
| 1251 |
"namespace." |
| 1252 |
msgstr "" |
| 1253 |
"De avbildade projekt-ID:na måste i sin tur ha en avbildning i " |
| 1254 |
"föräldraanvändarnamnrymden." |
| 1255 |
|
| 1256 |
# |
| 1257 |
#. ============================================================ |
| 1258 |
#. type: Plain text |
| 1259 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1260 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1261 |
msgid "" |
| 1262 |
"Violation of these rules causes B<write>(2) to fail with the error B<EPERM>." |
| 1263 |
msgstr "" |
| 1264 |
"Brott mot dessa regler får B<write>(2) att misslyckas med felet B<EPERM>." |
| 1265 |
|
| 1266 |
#. type: SS |
| 1267 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1268 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1269 |
#, no-wrap |
| 1270 |
msgid "Interaction with system calls that change process UIDs or GIDs" |
| 1271 |
msgstr "Interaktion med systemanrop som ändrar process-AID:n eller -GID:n" |
| 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 |
"In a user namespace where the I<uid_map> file has not been written, the " |
| 1278 |
"system calls that change user IDs will fail. Similarly, if the I<gid_map> " |
| 1279 |
"file has not been written, the system calls that change group IDs will " |
| 1280 |
"fail. After the I<uid_map> and I<gid_map> files have been written, only the " |
| 1281 |
"mapped values may be used in system calls that change user and group IDs." |
| 1282 |
msgstr "" |
| 1283 |
"I en användarnamnrymd där filen I<uid_map> inte har skrivits kommer " |
| 1284 |
"systemanrop som ändrar användar-ID:n att misslyckas. På liknande sätt, om " |
| 1285 |
"filen I<gid_map> inte har skrivits kommer systemanrop som ändrar grupp-ID:n " |
| 1286 |
"att misslyckas. Efter att filerna I<uid_map> och I<gid_map> har skrivits kan " |
| 1287 |
"endast de avbildade värdena användas i systemanrop som ändrar användar- och " |
| 1288 |
"grupp-ID:n." |
| 1289 |
|
| 1290 |
#. type: Plain text |
| 1291 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1292 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1293 |
msgid "" |
| 1294 |
"For user IDs, the relevant system calls include B<setuid>(2), " |
| 1295 |
"B<setfsuid>(2), B<setreuid>(2), and B<setresuid>(2). For group IDs, the " |
| 1296 |
"relevant system calls include B<setgid>(2), B<setfsgid>(2), B<setregid>(2), " |
| 1297 |
"B<setresgid>(2), and B<setgroups>(2)." |
| 1298 |
msgstr "" |
| 1299 |
"För användar-ID:n inkluderar de relevanta systemanropen B<setuid>(2), " |
| 1300 |
"B<setfsuid>(2), B<setreuid>(2) och B<setresuid>(2). För grupp-ID:n " |
| 1301 |
"inkluderar de relevanta systemanropen B<setgid>(2), B<setfsgid>(2), " |
| 1302 |
"B<setregid>(2), B<setresgid>(2) och B<setgroups>(2)." |
| 1303 |
|
| 1304 |
# |
| 1305 |
#. Things changed in Linux 3.19 |
| 1306 |
#. commit 9cc46516ddf497ea16e8d7cb986ae03a0f6b92f8 |
| 1307 |
#. commit 66d2f338ee4c449396b6f99f5e75cd18eb6df272 |
| 1308 |
#. http://lwn.net/Articles/626665/ |
| 1309 |
#. ============================================================ |
| 1310 |
#. type: Plain text |
| 1311 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1312 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1313 |
msgid "" |
| 1314 |
"Writing \\[dq]I<deny>\\[dq] to the I</proc/>pidI</setgroups> file before " |
| 1315 |
"writing to I</proc/>pidI</gid_map> will permanently disable B<setgroups>(2) " |
| 1316 |
"in a user namespace and allow writing to I</proc/>pidI</gid_map> without " |
| 1317 |
"having the B<CAP_SETGID> capability in the parent user namespace." |
| 1318 |
msgstr "" |
| 1319 |
"Att skriva \\[dq]I<deny>\\[dq] till filen I</proc/>pidI</setgroups> före man " |
| 1320 |
"skriver till I</proc/>pidI</gid_map> kommer permanent avaktivera " |
| 1321 |
"B<setgroups>(2) i en användarnamnrymd och tillåta att man skriver till I</" |
| 1322 |
"proc/>pidI</gid_map> utan att ha förmågan B<CAP_SETGID> i " |
| 1323 |
"föräldraanvändarnamnrymden." |
| 1324 |
|
| 1325 |
#. type: SS |
| 1326 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 1327 |
#: opensuse-tumbleweed |
| 1328 |
#, no-wrap |
| 1329 |
msgid "The \\f[I]/proc/\\fBpid\\f[I]/setgroups\\fB file" |
| 1330 |
msgstr "Filen \\f[I]/proc/\\fBpid\\f[I]/setgroups\\fB" |
| 1331 |
|
| 1332 |
# |
| 1333 |
#. commit 9cc46516ddf497ea16e8d7cb986ae03a0f6b92f8 |
| 1334 |
#. commit 66d2f338ee4c449396b6f99f5e75cd18eb6df272 |
| 1335 |
#. http://lwn.net/Articles/626665/ |
| 1336 |
#. http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2014-8989 |
| 1337 |
#. type: Plain text |
| 1338 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1339 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1340 |
msgid "" |
| 1341 |
"The I</proc/>pidI</setgroups> file displays the string \\[dq]I<allow>\\[dq] " |
| 1342 |
"if processes in the user namespace that contains the process I<pid> are " |
| 1343 |
"permitted to employ the B<setgroups>(2) system call; it displays " |
| 1344 |
"\\[dq]I<deny>\\[dq] if B<setgroups>(2) is not permitted in that user " |
| 1345 |
"namespace. Note that regardless of the value in the I</proc/>pidI</" |
| 1346 |
"setgroups> file (and regardless of the process's capabilities), calls to " |
| 1347 |
"B<setgroups>(2) are also not permitted if I</proc/>pidI</gid_map> has not " |
| 1348 |
"yet been set." |
| 1349 |
msgstr "" |
| 1350 |
"Filen I</proc/>pidI</setgroups> visar strängen \\[dq]I<allow>\\[dq] om " |
| 1351 |
"processer i användarnamnrymden som innehåller process I<pid> får lov att " |
| 1352 |
"använda systemanropet B<setgroups>(2); den visar \\[dq]I<deny>\\[dq] om " |
| 1353 |
"B<setgroups>(2) inte tillåts i den användarnamnrymden. Observera att oavsett " |
| 1354 |
"värdet i filen I</proc/>pidI</setgroups> (och oavsett processens förmågor) " |
| 1355 |
"är inte heller B<setgroups>(2) tillåtet om inte I</proc/>pidI</gid_map> har " |
| 1356 |
"satts ännu." |
| 1357 |
|
| 1358 |
#. type: Plain text |
| 1359 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 1360 |
#: opensuse-tumbleweed |
| 1361 |
msgid "" |
| 1362 |
"A privileged process (one with the B<CAP_SYS_ADMIN> capability in the " |
| 1363 |
"namespace) may write either of the strings \\[dq]I<allow>\\[dq] or " |
| 1364 |
"\\[dq]I<deny>\\[dq] to this file I<before> writing a group ID mapping for " |
| 1365 |
"this user namespace to the file I</proc/>pidI</gid_map>. Writing the string " |
| 1366 |
"\\[dq]I<deny>\\[dq] prevents any process in the user namespace from " |
| 1367 |
"employing B<setgroups>(2)." |
| 1368 |
msgstr "" |
| 1369 |
"En privilegierad process (en med förmågan B<CAP_SYS_ADMIN> i namnrymden) kan " |
| 1370 |
"skriva endera av strängarna \\[dq]I<allow>\\[dq] eller \\[dq]I<deny>\\[dq] " |
| 1371 |
"till denna fil I<före> den skriver en grupp-ID-avbildning för denna " |
| 1372 |
"användarnamnrymd till filen I</proc/>pidI</gid_map>. Att skriva strängen " |
| 1373 |
"\\[dq]I<deny>\\[dq] förhindrar alla processer i användarnamnrymden från att " |
| 1374 |
"använda B<setgroups>(2)." |
| 1375 |
|
| 1376 |
#. type: Plain text |
| 1377 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1378 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1379 |
msgid "" |
| 1380 |
"The essence of the restrictions described in the preceding paragraph is that " |
| 1381 |
"it is permitted to write to I</proc/>pidI</setgroups> only so long as " |
| 1382 |
"calling B<setgroups>(2) is disallowed because I</proc/>pidI</gid_map> has " |
| 1383 |
"not been set. This ensures that a process cannot transition from a state " |
| 1384 |
"where B<setgroups>(2) is allowed to a state where B<setgroups>(2) is " |
| 1385 |
"denied; a process can transition only from B<setgroups>(2) being disallowed " |
| 1386 |
"to B<setgroups>(2) being allowed." |
| 1387 |
msgstr "" |
| 1388 |
"Essensen av begränsningarna som beskrivs i föregående stycke är att det är " |
| 1389 |
"tillåtet att skriva till I</proc/>pidI</setgroups> endast så länge som anrop " |
| 1390 |
"av B<setgroups>(2) är otillåtet för att I</proc/>pidI</gid_map> inte har " |
| 1391 |
"satts. Detta säkerställer att en process inte kan gå över från ett tillstånd " |
| 1392 |
"där B<setgroups>(2) är tillåtet till ett tillstånd där B<setgroups>(2) " |
| 1393 |
"nekas; en process kan gå över endast från att B<setgroups>(2) är otillåtet " |
| 1394 |
"till att B<setgroups>(2) är tillåtet." |
| 1395 |
|
| 1396 |
#. type: Plain text |
| 1397 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1398 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1399 |
msgid "" |
| 1400 |
"The default value of this file in the initial user namespace is " |
| 1401 |
"\\[dq]I<allow>\\[dq]." |
| 1402 |
msgstr "" |
| 1403 |
"Standardvärdet i denna fil i den initiala användarnamnrymden är " |
| 1404 |
"\\[dq]I<allow>\\[dq]." |
| 1405 |
|
| 1406 |
#. type: Plain text |
| 1407 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1408 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1409 |
msgid "" |
| 1410 |
"Once I</proc/>pidI</gid_map> has been written to (which has the effect of " |
| 1411 |
"enabling B<setgroups>(2) in the user namespace), it is no longer possible " |
| 1412 |
"to disallow B<setgroups>(2) by writing \\[dq]I<deny>\\[dq] to I</proc/" |
| 1413 |
">pidI</setgroups> (the write fails with the error B<EPERM>)." |
| 1414 |
msgstr "" |
| 1415 |
"När I</proc/>pidI</gid_map> har skrivits till (vilket har effekten av att " |
| 1416 |
"aktivera B<setgroups>(2) i användarnamnrymden), är det inte längre möjligt " |
| 1417 |
"att göra B<setgroups>(2) otillåtet genom att skriva \\[dq]I<deny>\\[dq] till " |
| 1418 |
"I</proc/>pidI</setgroups> (skrivningen misslyckas med felet B<EPERM>)." |
| 1419 |
|
| 1420 |
#. type: Plain text |
| 1421 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1422 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1423 |
msgid "" |
| 1424 |
"A child user namespace inherits the I</proc/>pidI</setgroups> setting from " |
| 1425 |
"its parent." |
| 1426 |
msgstr "" |
| 1427 |
"En barnnamnrymd ärver inställningen av I</proc/>pidI</setgroups> från sin " |
| 1428 |
"förälder." |
| 1429 |
|
| 1430 |
#. type: Plain text |
| 1431 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 1432 |
#: opensuse-tumbleweed |
| 1433 |
msgid "" |
| 1434 |
"If the I<setgroups> file has the value \\[dq]I<deny>\\[dq], then the " |
| 1435 |
"B<setgroups>(2) system call can't subsequently be reenabled (by writing " |
| 1436 |
"\\[dq]I<allow>\\[dq] to the file) in this user namespace. (Attempts to do " |
| 1437 |
"so fail with the error B<EPERM>.) This restriction also propagates down to " |
| 1438 |
"all child user namespaces of this user namespace." |
| 1439 |
msgstr "" |
| 1440 |
"Om filen I<setgroups> har värdet \\[dq]I<deny>\\[dq], då kan inte senare " |
| 1441 |
"systemanropet B<setgroups>(2) återaktiveras (genom att skriva " |
| 1442 |
"\\[dq]I<allow>\\[dq] till filen) i den användarnamnrymden. (Försök att göra " |
| 1443 |
"så misslyckas med felet B<EPERM>.) Denna begränsning propagerar ner till " |
| 1444 |
"alla barnanvändarnamnrymder till denna användarnamnrymd." |
| 1445 |
|
| 1446 |
# |
| 1447 |
# |
| 1448 |
# |
| 1449 |
# |
| 1450 |
#. /proc/PID/setgroups |
| 1451 |
#. [allow == setgroups() is allowed, "deny" == setgroups() is disallowed] |
| 1452 |
#. * Can write if have CAP_SYS_ADMIN in NS |
| 1453 |
#. * Must write BEFORE writing to /proc/PID/gid_map |
| 1454 |
#. setgroups() |
| 1455 |
#. * Must already have written to gid_map |
| 1456 |
#. * /proc/PID/setgroups must be "allow" |
| 1457 |
#. /proc/PID/gid_map -- writing |
| 1458 |
#. * Must already have written "deny" to /proc/PID/setgroups |
| 1459 |
#. ============================================================ |
| 1460 |
#. type: Plain text |
| 1461 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 1462 |
#: opensuse-tumbleweed |
| 1463 |
msgid "" |
| 1464 |
"The I</proc/>pidI</setgroups> file was added in Linux 3.19, but was " |
| 1465 |
"backported to many earlier stable kernel series, because it addresses a " |
| 1466 |
"security issue. The issue concerned files with permissions such as \"rwx---" |
| 1467 |
"rwx\". Such files give fewer permissions to \"group\" than they do to " |
| 1468 |
"\"other\". This means that dropping groups using B<setgroups>(2) might " |
| 1469 |
"allow a process file access that it did not formerly have. Before the " |
| 1470 |
"existence of user namespaces this was not a concern, since only a privileged " |
| 1471 |
"process (one with the B<CAP_SETGID> capability) could call " |
| 1472 |
"B<setgroups>(2). However, with the introduction of user namespaces, it " |
| 1473 |
"became possible for an unprivileged process to create a new namespace in " |
| 1474 |
"which the user had all privileges. This then allowed formerly unprivileged " |
| 1475 |
"users to drop groups and thus gain file access that they did not previously " |
| 1476 |
"have. The I</proc/>pidI</setgroups> file was added to address this security " |
| 1477 |
"issue, by denying any pathway for an unprivileged process to drop groups " |
| 1478 |
"with B<setgroups>(2)." |
| 1479 |
msgstr "" |
| 1480 |
"Filen I</proc/>pidI</setgroups> lades till i Linux 3.19, men bakåtporterades " |
| 1481 |
"till många tidigare stabila kärnserier, eftersom den åtgärdar ett " |
| 1482 |
"säkerhetsproblem. Problemet rörde filer med rättigheter såsom ”rwx---rwx”. " |
| 1483 |
"Sådana filer ger färre rättigheter till ”gruppen” än de gör till ”övriga”. " |
| 1484 |
"Detta betyder att genom att släppa grupper med B<setgroups>(2) kan en " |
| 1485 |
"process tillåtas filåtkomst som den inte tidigare hade. Före det fanns " |
| 1486 |
"användarnamnrymder var detta inte ett bekymmer, eftersom endast en " |
| 1487 |
"privilegierad process (en med förmågan B<CAP_SETGID>) kunde anropa " |
| 1488 |
"B<setgroups>(2). Dock, med introduktionen av användarnamnrymder blev det " |
| 1489 |
"möjligt för en oprivilegierad process att skapa en ny namnrymd i vilken " |
| 1490 |
"användaren har alla privilegier. Detta tillät sedan tidigare oprivilegierade " |
| 1491 |
"användare att släppa grupprivilegier och därmed få filåtkomst som de inte " |
| 1492 |
"tidigare hade. Filen I</proc/>pidI</setgroups> lades till för att åtgärda " |
| 1493 |
"detta säkerhetsproblem, genom att neka alla vägar för en oprivilegierad " |
| 1494 |
"process att släppa grupper med B<setgroups>(2)." |
| 1495 |
|
| 1496 |
#. type: SS |
| 1497 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1498 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1499 |
#, no-wrap |
| 1500 |
msgid "Unmapped user and group IDs" |
| 1501 |
msgstr "Oavbildade användar- och grupp-ID:n" |
| 1502 |
|
| 1503 |
#. from_kuid_munged(), from_kgid_munged() |
| 1504 |
#. type: Plain text |
| 1505 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1506 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1507 |
msgid "" |
| 1508 |
"There are various places where an unmapped user ID (group ID) may be " |
| 1509 |
"exposed to user space. For example, the first process in a new user " |
| 1510 |
"namespace may call B<getuid>(2) before a user ID mapping has been defined " |
| 1511 |
"for the namespace. In most such cases, an unmapped user ID is converted to " |
| 1512 |
"the overflow user ID (group ID); the default value for the overflow user ID " |
| 1513 |
"(group ID) is 65534. See the descriptions of I</proc/sys/kernel/" |
| 1514 |
"overflowuid> and I</proc/sys/kernel/overflowgid> in B<proc>(5)." |
| 1515 |
msgstr "" |
| 1516 |
"Det finns olika platser där ett oavbildat användar-ID (grupp-ID) kan " |
| 1517 |
"exponeras för användarrymden. Till exempel kan den första processen i en ny " |
| 1518 |
"användarnamnrymd anropa B<getuid>(2) innan en användar-ID-avbildning har " |
| 1519 |
"definierats för namnrymden. I de flesta sådana fall konverteras ett " |
| 1520 |
"oavbildat användar-ID till spillanvändar-ID:t (grupp-ID:t); standardvärdet " |
| 1521 |
"på spillanvändar-ID:t (grupp-ID:t) 65534). Se beskrivningarna av I</proc/sys/" |
| 1522 |
"kernel/overflowuid> och I</proc/sys/kernel/overflowgid> i B<proc>(5)." |
| 1523 |
|
| 1524 |
#. also SO_PEERCRED |
| 1525 |
#. type: Plain text |
| 1526 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1527 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1528 |
msgid "" |
| 1529 |
"The cases where unmapped IDs are mapped in this fashion include system calls " |
| 1530 |
"that return user IDs (B<getuid>(2), B<getgid>(2), and similar), credentials " |
| 1531 |
"passed over a UNIX domain socket, credentials returned by B<stat>(2), " |
| 1532 |
"B<waitid>(2), and the System V IPC \"ctl\" B<IPC_STAT> operations, " |
| 1533 |
"credentials exposed by I</proc/>pidI</status> and the files in I</proc/" |
| 1534 |
"sysvipc/*>, credentials returned via the I<si_uid> field in the I<siginfo_t> " |
| 1535 |
"received with a signal (see B<sigaction>(2)), credentials written to the " |
| 1536 |
"process accounting file (see B<acct>(5)), and credentials returned with " |
| 1537 |
"POSIX message queue notifications (see B<mq_notify>(3))." |
| 1538 |
msgstr "" |
| 1539 |
"Fallen där oavbildade ID:n avbildas på detta sätt inkluderar systemanrop som " |
| 1540 |
"returnerar användar-ID:n (B<getuid>(2), B<getgid>(2) och liknande), kreditiv " |
| 1541 |
"som skickas över ett UNIX-domänsuttag, kreditiv som returneras av " |
| 1542 |
"B<stat>(2), B<waitid>(2) och System V IPC ”ctl”-åtgärder B<IPC_STAT>, " |
| 1543 |
"kreditiv som exponeras av I</proc/>pidI</status> och filerna i I</proc/" |
| 1544 |
"sysvipc/*>, kreditiv som returneras via fältet I<si_uid> i den I<siginfo_t> " |
| 1545 |
"som tas emot med en signal (se B<sigaction>(2)), kreditiv som skrivs till " |
| 1546 |
"processbokföringsfilen (se B<acct>(5)) och kreditiv som returneras via POSIX " |
| 1547 |
"notifieringar i meddelandeköer (se B<mq_notify>(3))." |
| 1548 |
|
| 1549 |
# |
| 1550 |
#. from_kuid(), from_kgid() |
| 1551 |
#. Also F_GETOWNER_UIDS is an exception |
| 1552 |
#. ============================================================ |
| 1553 |
#. type: Plain text |
| 1554 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1555 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1556 |
msgid "" |
| 1557 |
"There is one notable case where unmapped user and group IDs are I<not> " |
| 1558 |
"converted to the corresponding overflow ID value. When viewing a I<uid_map> " |
| 1559 |
"or I<gid_map> file in which there is no mapping for the second field, that " |
| 1560 |
"field is displayed as 4294967295 (-1 as an unsigned integer)." |
| 1561 |
msgstr "" |
| 1562 |
"Det finns ett nämnvärt fall där oavbildade användar- och grupp-ID:n I<inte> " |
| 1563 |
"konverteras till motsvarande spill-ID-värde. När man betraktar en fil " |
| 1564 |
"I<uid_map> eller I<gid_map> i vilken det inte finns någon avbildning för det " |
| 1565 |
"andra fältet visas det fältet som 4294967295 (-1 som ett teckenlöst heltal)." |
| 1566 |
|
| 1567 |
#. type: SS |
| 1568 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1569 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1570 |
#, no-wrap |
| 1571 |
msgid "Accessing files" |
| 1572 |
msgstr "Åtkomst av filer" |
| 1573 |
|
| 1574 |
# |
| 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 |
msgid "" |
| 1580 |
"In order to determine permissions when an unprivileged process accesses a " |
| 1581 |
"file, the process credentials (UID, GID) and the file credentials are in " |
| 1582 |
"effect mapped back to what they would be in the initial user namespace and " |
| 1583 |
"then compared to determine the permissions that the process has on the " |
| 1584 |
"file. The same is also true of other objects that employ the credentials " |
| 1585 |
"plus permissions mask accessibility model, such as System V IPC objects." |
| 1586 |
msgstr "" |
| 1587 |
"För att avgöra rättigheterna när en oprivilegierad process söker tillgång " |
| 1588 |
"till en fil avbildas processkreditiven (AID, GID) och de aktiva " |
| 1589 |
"filkreditiven tillbaka till vad de skulle vara i den initiala " |
| 1590 |
"användarnamnrymden och jämförs sedan för att avgöra rättigheterna som " |
| 1591 |
"processen har till filen. Detsamma är också sant för andra objekt som " |
| 1592 |
"använder åtkomstmodellen med kreditiv plus rättighetsmasker, såsom System V " |
| 1593 |
"IPC-objekt." |
| 1594 |
|
| 1595 |
#. type: SS |
| 1596 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1597 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1598 |
#, no-wrap |
| 1599 |
msgid "Operation of file-related capabilities" |
| 1600 |
msgstr "Åtgärder med filrelaterade förmågor" |
| 1601 |
|
| 1602 |
#. type: Plain text |
| 1603 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1604 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1605 |
msgid "" |
| 1606 |
"Certain capabilities allow a process to bypass various kernel-enforced " |
| 1607 |
"restrictions when performing operations on files owned by other users or " |
| 1608 |
"groups. These capabilities are: B<CAP_CHOWN>, B<CAP_DAC_OVERRIDE>, " |
| 1609 |
"B<CAP_DAC_READ_SEARCH>, B<CAP_FOWNER>, and B<CAP_FSETID>." |
| 1610 |
msgstr "" |
| 1611 |
"Vissa förmågor tillåter en process att kringgå olika begränsningar som " |
| 1612 |
"kärnan upprätthåller när den utför åtgärder på filer som ägs av andra " |
| 1613 |
"användare eller grupper. Dessa förmågor är: B<CAP_CHOWN>, " |
| 1614 |
"B<CAP_DAC_OVERRIDE>, B<CAP_DAC_READ_SEARCH>, B<CAP_FOWNER> och B<CAP_FSETID>." |
| 1615 |
|
| 1616 |
#. type: Plain text |
| 1617 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1618 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1619 |
msgid "" |
| 1620 |
"Within a user namespace, these capabilities allow a process to bypass the " |
| 1621 |
"rules if the process has the relevant capability over the file, meaning that:" |
| 1622 |
msgstr "" |
| 1623 |
"Inom en användarnamnrymd tillåter dessa förmågor en process att kringgå " |
| 1624 |
"reglerna om processen har den relevanta förmågan över filen, vilket betyder:" |
| 1625 |
|
| 1626 |
#. type: Plain text |
| 1627 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1628 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1629 |
msgid "" |
| 1630 |
"the process has the relevant effective capability in its user namespace; and" |
| 1631 |
msgstr "" |
| 1632 |
"processen har den relevanta effektiva förmågan i sin användarnamnrymd; och" |
| 1633 |
|
| 1634 |
#. type: Plain text |
| 1635 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1636 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1637 |
msgid "" |
| 1638 |
"the file's user ID and group ID both have valid mappings in the user " |
| 1639 |
"namespace." |
| 1640 |
msgstr "" |
| 1641 |
"filens användar-ID och grupp-ID båda har giltiga avbildningar i " |
| 1642 |
"användarnamnrymden." |
| 1643 |
|
| 1644 |
# |
| 1645 |
#. #-#-#-#-# archlinux: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-# |
| 1646 |
#. These are the checks performed by the kernel function |
| 1647 |
#. inode_owner_or_capable(). There is one exception to the exception: |
| 1648 |
#. overriding the directory sticky permission bit requires that |
| 1649 |
#. the file has a valid mapping for both its UID and GID. |
| 1650 |
#. ============================================================ |
| 1651 |
#. type: Plain text |
| 1652 |
#. #-#-#-#-# debian-trixie: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-# |
| 1653 |
#. These are the checks performed by the kernel function |
| 1654 |
#. inode_owner_or_capable(). There is one exception to the exception: |
| 1655 |
#. overriding the directory sticky permission bit requires that |
| 1656 |
#. the file has a valid mapping for both its UID and GID. |
| 1657 |
#. ============================================================ |
| 1658 |
#. type: Plain text |
| 1659 |
#. #-#-#-#-# debian-unstable: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-# |
| 1660 |
#. These are the checks performed by the kernel function |
| 1661 |
#. inode_owner_or_capable(). There is one exception to the exception: |
| 1662 |
#. overriding the directory sticky permission bit requires that |
| 1663 |
#. the file has a valid mapping for both its UID and GID. |
| 1664 |
#. ============================================================ |
| 1665 |
#. type: Plain text |
| 1666 |
#. #-#-#-#-# fedora-44: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-# |
| 1667 |
#. These are the checks performed by the kernel function |
| 1668 |
#. inode_owner_or_capable(). There is one exception to the exception: |
| 1669 |
#. overriding the directory sticky permission bit requires that |
| 1670 |
#. the file has a valid mapping for both its UID and GID. |
| 1671 |
#. ============================================================ |
| 1672 |
#. type: Plain text |
| 1673 |
#. #-#-#-#-# fedora-rawhide: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-# |
| 1674 |
#. These are the checks performed by the kernel function |
| 1675 |
#. inode_owner_or_capable(). There is one exception to the exception: |
| 1676 |
#. overriding the directory sticky permission bit requires that |
| 1677 |
#. the file has a valid mapping for both its UID and GID. |
| 1678 |
#. ============================================================ |
| 1679 |
#. type: Plain text |
| 1680 |
#. #-#-#-#-# mageia-cauldron: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-# |
| 1681 |
#. These are the checks performed by the kernel function |
| 1682 |
#. inode_owner_or_capable(). There is one exception to the exception: |
| 1683 |
#. overriding the directory sticky permission bit requires that |
| 1684 |
#. the file has a valid mapping for both its UID and GID. |
| 1685 |
#. ============================================================ |
| 1686 |
#. type: Plain text |
| 1687 |
#. #-#-#-#-# opensuse-leap-16-1: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-# |
| 1688 |
#. These are the checks performed by the kernel function |
| 1689 |
#. inode_owner_or_capable(). There is one exception to the exception: |
| 1690 |
#. overriding the directory sticky permission bit requires that |
| 1691 |
#. the file has a valid mapping for both its UID and GID. |
| 1692 |
#. ============================================================ |
| 1693 |
#. type: Plain text |
| 1694 |
#. #-#-#-#-# opensuse-tumbleweed: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-# |
| 1695 |
#. These are the checks performed by the kernel function |
| 1696 |
#. inode_owner_or_capable(). There is one exception to the exception: |
| 1697 |
#. overriding the directory sticky permission bit requires that |
| 1698 |
#. the file has a valid mapping for both its UID and GID. |
| 1699 |
#. ============================================================ |
| 1700 |
#. type: Plain text |
| 1701 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1702 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1703 |
msgid "" |
| 1704 |
"The B<CAP_FOWNER> capability is treated somewhat exceptionally: it allows a " |
| 1705 |
"process to bypass the corresponding rules so long as at least the file's " |
| 1706 |
"user ID has a mapping in the user namespace (i.e., the file's group ID does " |
| 1707 |
"not need to have a valid mapping)." |
| 1708 |
msgstr "" |
| 1709 |
"Förmågan B<CAP_FOWNER> behandlas något speciellt: den tillåter en process " |
| 1710 |
"att kringgå motsvarande regler så länge som åtminstone filens användar-ID " |
| 1711 |
"har en avbildning i användarnamnrymden (d.v.s., filens grupp-ID behöver inte " |
| 1712 |
"ha en giltig avbildning)." |
| 1713 |
|
| 1714 |
#. type: SS |
| 1715 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1716 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1717 |
#, no-wrap |
| 1718 |
msgid "Set-user-ID and set-group-ID programs" |
| 1719 |
msgstr "Sätt-användar-ID- och sätt-grupp-ID-program" |
| 1720 |
|
| 1721 |
# |
| 1722 |
#. ============================================================ |
| 1723 |
#. type: Plain text |
| 1724 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1725 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1726 |
msgid "" |
| 1727 |
"When a process inside a user namespace executes a set-user-ID (set-group-ID) " |
| 1728 |
"program, the process's effective user (group) ID inside the namespace is " |
| 1729 |
"changed to whatever value is mapped for the user (group) ID of the file. " |
| 1730 |
"However, if either the user I<or> the group ID of the file has no mapping " |
| 1731 |
"inside the namespace, the set-user-ID (set-group-ID) bit is silently " |
| 1732 |
"ignored: the new program is executed, but the process's effective user " |
| 1733 |
"(group) ID is left unchanged. (This mirrors the semantics of executing a " |
| 1734 |
"set-user-ID or set-group-ID program that resides on a filesystem that was " |
| 1735 |
"mounted with the B<MS_NOSUID> flag, as described in B<mount>(2).)" |
| 1736 |
msgstr "" |
| 1737 |
"När en process inuti en användarnamnrymd kör ett program som är sätt-" |
| 1738 |
"användar-ID (sätt-grupp-ID) ändras processens effektiva användar- (grupp-)ID " |
| 1739 |
"inuti namnrymden till det värde som är avbildat för filens användar- " |
| 1740 |
"(grupp-)ID. Dock, om antingen filens användar- I<eller> grupp-ID inte har " |
| 1741 |
"någon avbildning inuti namnrymden ignoreras tyst biten sätt-användar-ID " |
| 1742 |
"(sätt-grupp-ID): det nya programmet körs, men processens effektiva användar- " |
| 1743 |
"(grupp-)ID lämnas orört. (Detta avspeglar semantiken hos att köra ett " |
| 1744 |
"program med sätt-användar-ID eller sätt-grupp-ID som bor på ett filsystem " |
| 1745 |
"som monterades med flaggan B<MS_NOSUID>, såsom beskrivs i B<mount>(2).)" |
| 1746 |
|
| 1747 |
#. type: SS |
| 1748 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1749 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1750 |
#, no-wrap |
| 1751 |
msgid "Miscellaneous" |
| 1752 |
msgstr "Diverse" |
| 1753 |
|
| 1754 |
#. type: Plain text |
| 1755 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1756 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1757 |
msgid "" |
| 1758 |
"When a process's user and group IDs are passed over a UNIX domain socket to " |
| 1759 |
"a process in a different user namespace (see the description of " |
| 1760 |
"B<SCM_CREDENTIALS> in B<unix>(7)), they are translated into the " |
| 1761 |
"corresponding values as per the receiving process's user and group ID " |
| 1762 |
"mappings." |
| 1763 |
msgstr "" |
| 1764 |
"När en process användar- och grupp-ID:n skickas över ett UNIX-domänsuttag " |
| 1765 |
"till en process i en annan användarnamnrymd (se beskrivningen av " |
| 1766 |
"B<SCM_CREDENTIALS> i B<unix>(7)) översätts de till de motsvarande värdena i " |
| 1767 |
"enlighet med den mottagande processens användar- och grupp-ID-avbildningar." |
| 1768 |
|
| 1769 |
#. type: SH |
| 1770 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1771 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1772 |
#, no-wrap |
| 1773 |
msgid "STANDARDS" |
| 1774 |
msgstr "STANDARDER" |
| 1775 |
|
| 1776 |
#. type: Plain text |
| 1777 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1778 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1779 |
msgid "Linux." |
| 1780 |
msgstr "Linux." |
| 1781 |
|
| 1782 |
#. type: SH |
| 1783 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1784 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1785 |
#, no-wrap |
| 1786 |
msgid "NOTES" |
| 1787 |
msgstr "NOTERINGAR" |
| 1788 |
|
| 1789 |
# |
| 1790 |
#. ============================================================ |
| 1791 |
#. type: Plain text |
| 1792 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1793 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1794 |
msgid "" |
| 1795 |
"Over the years, there have been a lot of features that have been added to " |
| 1796 |
"the Linux kernel that have been made available only to privileged users " |
| 1797 |
"because of their potential to confuse set-user-ID-root applications. In " |
| 1798 |
"general, it becomes safe to allow the root user in a user namespace to use " |
| 1799 |
"those features because it is impossible, while in a user namespace, to gain " |
| 1800 |
"more privilege than the root user of a user namespace has." |
| 1801 |
msgstr "" |
| 1802 |
"Under åren har det funnits många funktioner som har lagts till till " |
| 1803 |
"Linuxkärnan som har gjorts tillgängliga endast till privilegierade användare " |
| 1804 |
"på grund av deras potential att förvirra sätt-användar-ID-root-program. I " |
| 1805 |
"allmänhet blir det säkert att tillåta root-användaren i en användarnamnrymd " |
| 1806 |
"att använda dessa funktioner eftersom det är omöjligt, så länge man finns i " |
| 1807 |
"en användarnamnrymd, att få fler privilegier än de som en användarnamnrymds " |
| 1808 |
"root-användare har." |
| 1809 |
|
| 1810 |
#. type: SS |
| 1811 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1812 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1813 |
#, no-wrap |
| 1814 |
msgid "Global root" |
| 1815 |
msgstr "Global root" |
| 1816 |
|
| 1817 |
# |
| 1818 |
#. ============================================================ |
| 1819 |
#. type: Plain text |
| 1820 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1821 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1822 |
msgid "" |
| 1823 |
"The term \"global root\" is sometimes used as a shorthand for user ID 0 in " |
| 1824 |
"the initial user namespace." |
| 1825 |
msgstr "" |
| 1826 |
"Termen ”global root” används ibland som en kortform för användar-ID 0 i den " |
| 1827 |
"initiala användarnamnrymden." |
| 1828 |
|
| 1829 |
#. type: SS |
| 1830 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1831 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1832 |
#, no-wrap |
| 1833 |
msgid "Availability" |
| 1834 |
msgstr "Tillgänglighet" |
| 1835 |
|
| 1836 |
#. type: Plain text |
| 1837 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1838 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1839 |
msgid "" |
| 1840 |
"Use of user namespaces requires a kernel that is configured with the " |
| 1841 |
"B<CONFIG_USER_NS> option. User namespaces require support in a range of " |
| 1842 |
"subsystems across the kernel. When an unsupported subsystem is configured " |
| 1843 |
"into the kernel, it is not possible to configure user namespaces support." |
| 1844 |
msgstr "" |
| 1845 |
"Användning av användarnamnrymder kräver en kärna som är konfigurerad med " |
| 1846 |
"alternativet B<CONFIG_USER_NS>. Användarnamnrymder kräver stöd i ett antal " |
| 1847 |
"undersystem i hela kärnan. När ett undersystem som inte stödjs konfigureras " |
| 1848 |
"i kärnan är det inte möjligt att konfigurera stöd för användarnamnrymder." |
| 1849 |
|
| 1850 |
#. commit d6970d4b726cea6d7a9bc4120814f95c09571fc3 |
| 1851 |
#. type: Plain text |
| 1852 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1853 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1854 |
msgid "" |
| 1855 |
"As at Linux 3.8, most relevant subsystems supported user namespaces, but a " |
| 1856 |
"number of filesystems did not have the infrastructure needed to map user and " |
| 1857 |
"group IDs between user namespaces. Linux 3.9 added the required " |
| 1858 |
"infrastructure support for many of the remaining unsupported filesystems " |
| 1859 |
"(Plan 9 (9P), Andrew File System (AFS), Ceph, CIFS, CODA, NFS, and OCFS2). " |
| 1860 |
"Linux 3.12 added support for the last of the unsupported major filesystems, " |
| 1861 |
"XFS." |
| 1862 |
msgstr "" |
| 1863 |
"Fram till Linux 3.8 stödde de mest relevanta subsystemen användarnamnrymder, " |
| 1864 |
"men ett antal filsystem hade inte den nödvändiga infrastrukturen för att " |
| 1865 |
"avbilda användar- och grupp-ID:n mellan användarnamnrymder. Linux 3.9 lade " |
| 1866 |
"till det nödvändiga infrastrukturstödet till många av de återstående ej " |
| 1867 |
"stödda filsystemen (Plan 9 (9P), Andrew File System (AFS), Ceph, CIFS, CODA, " |
| 1868 |
"NFS och OCFS2). Linux 3.12 lade till stöd till det sista av de ej stödda " |
| 1869 |
"större filsystemen, XFS." |
| 1870 |
|
| 1871 |
#. type: SH |
| 1872 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1873 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1874 |
#, no-wrap |
| 1875 |
msgid "EXAMPLES" |
| 1876 |
msgstr "EXEMPEL" |
| 1877 |
|
| 1878 |
#. type: Plain text |
| 1879 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1880 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1881 |
msgid "" |
| 1882 |
"The program below is designed to allow experimenting with user namespaces, " |
| 1883 |
"as well as other types of namespaces. It creates namespaces as specified by " |
| 1884 |
"command-line options and then executes a command inside those namespaces. " |
| 1885 |
"The comments and I<usage>() function inside the program provide a full " |
| 1886 |
"explanation of the program. The following shell session demonstrates its " |
| 1887 |
"use." |
| 1888 |
msgstr "" |
| 1889 |
"Nedanstående program är skapat för att möjliggöra experimenterande med " |
| 1890 |
"användarnamnrymder, liksom även andra typer av namnrymder. Det skapar " |
| 1891 |
"namnrymder enligt specifikationen från kommandoradsflaggor och kör sedan ett " |
| 1892 |
"kommando inuti dessa namnrymder. Kommentarerna och funktionen I<usage>() " |
| 1893 |
"inuti programmet ger den fullständiga förklaringen av programmet. Följande " |
| 1894 |
"skalsession demonstrerar dess användning." |
| 1895 |
|
| 1896 |
#. type: Plain text |
| 1897 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1898 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1899 |
msgid "First, we look at the run-time environment:" |
| 1900 |
msgstr "Först betraktar vi körtidsmiljön:" |
| 1901 |
|
| 1902 |
#. type: Plain text |
| 1903 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 1904 |
#: opensuse-tumbleweed |
| 1905 |
#, no-wrap |
| 1906 |
msgid "" |
| 1907 |
"$B< uname -rs>; # Need Linux 3.8 or later\n" |
| 1908 |
"Linux 3.8.0\n" |
| 1909 |
"$B< id -u>; # Running as unprivileged user\n" |
| 1910 |
"1000\n" |
| 1911 |
"$B< id -g>;\n" |
| 1912 |
"1000\n" |
| 1913 |
msgstr "" |
| 1914 |
"$B< uname -rs>; # Förutsätter Linux 3.8 eller senare\n" |
| 1915 |
"Linux 3.8.0\n" |
| 1916 |
"$B< id -u> # Kör som en oprivilegierad användare\n" |
| 1917 |
"1000\n" |
| 1918 |
"$B< id -g>\n" |
| 1919 |
"1000\n" |
| 1920 |
|
| 1921 |
#. type: Plain text |
| 1922 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1923 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1924 |
msgid "" |
| 1925 |
"Now start a new shell in new user (I<-U>), mount (I<-m>), and PID (I<-p>) " |
| 1926 |
"namespaces, with user ID (I<-M>) and group ID (I<-G>) 1000 mapped to 0 " |
| 1927 |
"inside the user namespace:" |
| 1928 |
msgstr "" |
| 1929 |
"Starta nu ett skal i en ny användar- (I<-U>), monterings- (I<-m>) och PID- " |
| 1930 |
"(I<-p>) namnrymd, med användar-ID (I<-M>) och grupp-ID (I<-G>) 1000 " |
| 1931 |
"avbildade på 0 inuti användarnamnrymden:" |
| 1932 |
|
| 1933 |
#. type: Plain text |
| 1934 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 1935 |
#: opensuse-tumbleweed |
| 1936 |
#, no-wrap |
| 1937 |
msgid "$B< ./userns_child_exec -p -m -U -M \\[aq]0 1000 1\\[aq] -G \\[aq]0 1000 1\\[aq] bash>;\n" |
| 1938 |
msgstr "$B< ./userns_child_exec -p -m -U -M \\[aq]0 1000 1\\[aq] -G \\[aq]0 1000 1\\[aq] bash>;\n" |
| 1939 |
|
| 1940 |
#. type: Plain text |
| 1941 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1942 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1943 |
msgid "" |
| 1944 |
"The shell has PID 1, because it is the first process in the new PID " |
| 1945 |
"namespace:" |
| 1946 |
msgstr "" |
| 1947 |
"Skalet har PID 1, för att det är den första processen i den nya PID-" |
| 1948 |
"namnrymden." |
| 1949 |
|
| 1950 |
#. type: Plain text |
| 1951 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 1952 |
#: opensuse-tumbleweed |
| 1953 |
#, no-wrap |
| 1954 |
msgid "" |
| 1955 |
"bash$B< echo $$>;\n" |
| 1956 |
"1\n" |
| 1957 |
msgstr "" |
| 1958 |
"bash$B< echo $$>;\n" |
| 1959 |
"1\n" |
| 1960 |
|
| 1961 |
#. type: Plain text |
| 1962 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1963 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1964 |
msgid "" |
| 1965 |
"Mounting a new I</proc> filesystem and listing all of the processes visible " |
| 1966 |
"in the new PID namespace shows that the shell can't see any processes " |
| 1967 |
"outside the PID namespace:" |
| 1968 |
msgstr "" |
| 1969 |
"Att montera ett nytt I</proc>-filsystem och lista alla processerna som är " |
| 1970 |
"synliga i den nya PID-namnrymden visar att skalet inte kan se några " |
| 1971 |
"processer utanför PID-namnrymden:" |
| 1972 |
|
| 1973 |
#. type: Plain text |
| 1974 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 1975 |
#: opensuse-tumbleweed |
| 1976 |
#, no-wrap |
| 1977 |
msgid "" |
| 1978 |
"bash$B< mount -t proc proc /proc>;\n" |
| 1979 |
"bash$B< ps ax>;\n" |
| 1980 |
" PID TTY STAT TIME COMMAND\n" |
| 1981 |
" 1 pts/3 S 0:00 bash\n" |
| 1982 |
" 22 pts/3 R+ 0:00 ps ax\n" |
| 1983 |
msgstr "" |
| 1984 |
"bash$B< mount -t proc proc /proc>;\n" |
| 1985 |
"bash$B< ps ax>;\n" |
| 1986 |
" PID TTY STAT TIME COMMAND\n" |
| 1987 |
" 1 pts/3 S 0:00 bash\n" |
| 1988 |
" 22 pts/3 R+ 0:00 ps ax\n" |
| 1989 |
|
| 1990 |
#. type: Plain text |
| 1991 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1992 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1993 |
msgid "" |
| 1994 |
"Inside the user namespace, the shell has user and group ID 0, and a full set " |
| 1995 |
"of permitted and effective capabilities:" |
| 1996 |
msgstr "" |
| 1997 |
"Inuti användarnamnrymden har skalet användar- och grupp-ID 0, och den " |
| 1998 |
"kompletta uppsättningen av tillåtna och effektiva förmågor:" |
| 1999 |
|
| 2000 |
#. type: Plain text |
| 2001 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 2002 |
#: opensuse-tumbleweed |
| 2003 |
#, no-wrap |
| 2004 |
msgid "" |
| 2005 |
"bash$B< cat /proc/$$/status | egrep \\[aq]\\[ha][UG]id\\[aq]>;\n" |
| 2006 |
"Uid:\t0\t0\t0\t0\n" |
| 2007 |
"Gid:\t0\t0\t0\t0\n" |
| 2008 |
"bash$B< cat /proc/$$/status | egrep \\[aq]\\[ha]Cap(Prm|Inh|Eff)\\[aq]>;\n" |
| 2009 |
"CapInh:\t0000000000000000\n" |
| 2010 |
"CapPrm:\t0000001fffffffff\n" |
| 2011 |
"CapEff:\t0000001fffffffff\n" |
| 2012 |
msgstr "" |
| 2013 |
"bash$B< cat /proc/$$/status | egrep \\[aq]\\[ha][UG]id\\[aq]>;\n" |
| 2014 |
"Uid:\t0\t0\t0\t0\n" |
| 2015 |
"Gid:\t0\t0\t0\t0\n" |
| 2016 |
"bash$B< cat /proc/$$/status | egrep \\[aq]\\[ha]Cap(Prm|Inh|Eff)\\[aq]>;\n" |
| 2017 |
"CapInh:\t0000000000000000\n" |
| 2018 |
"CapPrm:\t0000001fffffffff\n" |
| 2019 |
"CapEff:\t0000001fffffffff\n" |
| 2020 |
|
| 2021 |
#. type: SS |
| 2022 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 2023 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 2024 |
#, no-wrap |
| 2025 |
msgid "Program source" |
| 2026 |
msgstr "Programkällkod" |
| 2027 |
|
| 2028 |
#. type: Plain text |
| 2029 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 2030 |
#: opensuse-tumbleweed |
| 2031 |
#, no-wrap |
| 2032 |
msgid "" |
| 2033 |
"/* userns_child_exec.c\n" |
| 2034 |
"\\&\n" |
| 2035 |
" Licensed under GNU General Public License v2 or later\n" |
| 2036 |
"\\&\n" |
| 2037 |
" Create a child process that executes a shell command in new\n" |
| 2038 |
" namespace(s); allow UID and GID mappings to be specified when\n" |
| 2039 |
" creating a user namespace.\n" |
| 2040 |
"*/\n" |
| 2041 |
"#define _GNU_SOURCE\n" |
| 2042 |
"#include E<lt>err.hE<gt>\n" |
| 2043 |
"#include E<lt>sched.hE<gt>\n" |
| 2044 |
"#include E<lt>unistd.hE<gt>\n" |
| 2045 |
"#include E<lt>stdint.hE<gt>\n" |
| 2046 |
"#include E<lt>stdlib.hE<gt>\n" |
| 2047 |
"#include E<lt>sys/wait.hE<gt>\n" |
| 2048 |
"#include E<lt>signal.hE<gt>\n" |
| 2049 |
"#include E<lt>fcntl.hE<gt>\n" |
| 2050 |
"#include E<lt>stdio.hE<gt>\n" |
| 2051 |
"#include E<lt>string.hE<gt>\n" |
| 2052 |
"#include E<lt>limits.hE<gt>\n" |
| 2053 |
"#include E<lt>errno.hE<gt>\n" |
| 2054 |
"\\&\n" |
| 2055 |
"struct child_args {\n" |
| 2056 |
" char **argv; /* Command to be executed by child, with args */\n" |
| 2057 |
" int pipe_fd[2]; /* Pipe used to synchronize parent and child */\n" |
| 2058 |
"};\n" |
| 2059 |
"\\&\n" |
| 2060 |
"static int verbose;\n" |
| 2061 |
"\\&\n" |
| 2062 |
"static void\n" |
| 2063 |
"usage(char *pname)\n" |
| 2064 |
"{\n" |
| 2065 |
" fprintf(stderr, \"Usage: %s [options] cmd [arg...]\\[rs]n\\[rs]n\", pname);\n" |
| 2066 |
" fprintf(stderr, \"Create a child process that executes a shell \"\n" |
| 2067 |
" \"command in a new user namespace,\\[rs]n\"\n" |
| 2068 |
" \"and possibly also other new namespace(s).\\[rs]n\\[rs]n\");\n" |
| 2069 |
" fprintf(stderr, \"Options can be:\\[rs]n\\[rs]n\");\n" |
| 2070 |
"#define fpe(str) fprintf(stderr, \" %s\", str);\n" |
| 2071 |
" fpe(\"-i New IPC namespace\\[rs]n\");\n" |
| 2072 |
" fpe(\"-m New mount namespace\\[rs]n\");\n" |
| 2073 |
" fpe(\"-n New network namespace\\[rs]n\");\n" |
| 2074 |
" fpe(\"-p New PID namespace\\[rs]n\");\n" |
| 2075 |
" fpe(\"-u New UTS namespace\\[rs]n\");\n" |
| 2076 |
" fpe(\"-U New user namespace\\[rs]n\");\n" |
| 2077 |
" fpe(\"-M uid_map Specify UID map for user namespace\\[rs]n\");\n" |
| 2078 |
" fpe(\"-G gid_map Specify GID map for user namespace\\[rs]n\");\n" |
| 2079 |
" fpe(\"-z Map user\\[aq]s UID and GID to 0 in user namespace\\[rs]n\");\n" |
| 2080 |
" fpe(\" (equivalent to: -M \\[aq]0 E<lt>uidE<gt> 1\\[aq] -G \\[aq]0 E<lt>gidE<gt> 1\\[aq])\\[rs]n\");\n" |
| 2081 |
" fpe(\"-v Display verbose messages\\[rs]n\");\n" |
| 2082 |
" fpe(\"\\[rs]n\");\n" |
| 2083 |
" fpe(\"If -z, -M, or -G is specified, -U is required.\\[rs]n\");\n" |
| 2084 |
" fpe(\"It is not permitted to specify both -z and either -M or -G.\\[rs]n\");\n" |
| 2085 |
" fpe(\"\\[rs]n\");\n" |
| 2086 |
" fpe(\"Map strings for -M and -G consist of records of the form:\\[rs]n\");\n" |
| 2087 |
" fpe(\"\\[rs]n\");\n" |
| 2088 |
" fpe(\" ID-inside-ns ID-outside-ns size\\[rs]n\");\n" |
| 2089 |
" fpe(\"\\[rs]n\");\n" |
| 2090 |
" fpe(\"A map string can contain multiple records, separated\"\n" |
| 2091 |
" \" by commas;\\[rs]n\");\n" |
| 2092 |
" fpe(\"the commas are replaced by newlines before writing\"\n" |
| 2093 |
" \" to map files.\\[rs]n\");\n" |
| 2094 |
"\\&\n" |
| 2095 |
" exit(EXIT_FAILURE);\n" |
| 2096 |
"}\n" |
| 2097 |
"\\&\n" |
| 2098 |
"/* Update the mapping file \\[aq]map_file\\[aq], with the value provided in\n" |
| 2099 |
" \\[aq]mapping\\[aq], a string that defines a UID or GID mapping. A UID or\n" |
| 2100 |
" GID mapping consists of one or more newline-delimited records\n" |
| 2101 |
" of the form:\n" |
| 2102 |
"\\&\n" |
| 2103 |
" ID_inside-ns ID-outside-ns size\n" |
| 2104 |
"\\&\n" |
| 2105 |
" Requiring the user to supply a string that contains newlines is\n" |
| 2106 |
" of course inconvenient for command-line use. Thus, we permit the\n" |
| 2107 |
" use of commas to delimit records in this string, and replace them\n" |
| 2108 |
" with newlines before writing the string to the file. */\n" |
| 2109 |
"\\&\n" |
| 2110 |
"static void\n" |
| 2111 |
"update_map(char *mapping, char *map_file)\n" |
| 2112 |
"{\n" |
| 2113 |
" int fd;\n" |
| 2114 |
" size_t map_len; /* Length of \\[aq]mapping\\[aq] */\n" |
| 2115 |
"\\&\n" |
| 2116 |
" /* Replace commas in mapping string with newlines. */\n" |
| 2117 |
"\\&\n" |
| 2118 |
" map_len = strlen(mapping);\n" |
| 2119 |
" for (size_t j = 0; j E<lt> map_len; j++)\n" |
| 2120 |
" if (mapping[j] == \\[aq],\\[aq])\n" |
| 2121 |
" mapping[j] = \\[aq]\\[rs]n\\[aq];\n" |
| 2122 |
"\\&\n" |
| 2123 |
" fd = open(map_file, O_RDWR);\n" |
| 2124 |
" if (fd == -1) {\n" |
| 2125 |
" fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", map_file,\n" |
| 2126 |
" strerror(errno));\n" |
| 2127 |
" exit(EXIT_FAILURE);\n" |
| 2128 |
" }\n" |
| 2129 |
"\\&\n" |
| 2130 |
" if (write(fd, mapping, map_len) != map_len) {\n" |
| 2131 |
" fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", map_file,\n" |
| 2132 |
" strerror(errno));\n" |
| 2133 |
" exit(EXIT_FAILURE);\n" |
| 2134 |
" }\n" |
| 2135 |
"\\&\n" |
| 2136 |
" close(fd);\n" |
| 2137 |
"}\n" |
| 2138 |
"\\&\n" |
| 2139 |
"/* Linux 3.19 made a change in the handling of setgroups(2) and\n" |
| 2140 |
" the \\[aq]gid_map\\[aq] file to address a security issue. The issue\n" |
| 2141 |
" allowed *unprivileged* users to employ user namespaces in\n" |
| 2142 |
" order to drop groups. The upshot of the 3.19 changes is that\n" |
| 2143 |
" in order to update the \\[aq]gid_maps\\[aq] file, use of the setgroups()\n" |
| 2144 |
" system call in this user namespace must first be disabled by\n" |
| 2145 |
" writing \"deny\" to one of the /proc/PID/setgroups files for\n" |
| 2146 |
" this namespace. That is the purpose of the following function. */\n" |
| 2147 |
"\\&\n" |
| 2148 |
"static void\n" |
| 2149 |
"proc_setgroups_write(pid_t child_pid, char *str)\n" |
| 2150 |
"{\n" |
| 2151 |
" char setgroups_path[PATH_MAX];\n" |
| 2152 |
" int fd;\n" |
| 2153 |
"\\&\n" |
| 2154 |
" snprintf(setgroups_path, PATH_MAX, \"/proc/%jd/setgroups\",\n" |
| 2155 |
" (intmax_t) child_pid);\n" |
| 2156 |
"\\&\n" |
| 2157 |
" fd = open(setgroups_path, O_RDWR);\n" |
| 2158 |
" if (fd == -1) {\n" |
| 2159 |
"\\&\n" |
| 2160 |
" /* We may be on a system that doesn\\[aq]t support\n" |
| 2161 |
" /proc/PID/setgroups. In that case, the file won\\[aq]t exist,\n" |
| 2162 |
" and the system won\\[aq]t impose the restrictions that Linux 3.19\n" |
| 2163 |
" added. That\\[aq]s fine: we don\\[aq]t need to do anything in order\n" |
| 2164 |
" to permit \\[aq]gid_map\\[aq] to be updated.\n" |
| 2165 |
"\\&\n" |
| 2166 |
" However, if the error from open() was something other than\n" |
| 2167 |
" the ENOENT error that is expected for that case, let the\n" |
| 2168 |
" user know. */\n" |
| 2169 |
"\\&\n" |
| 2170 |
" if (errno != ENOENT)\n" |
| 2171 |
" fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", setgroups_path,\n" |
| 2172 |
" strerror(errno));\n" |
| 2173 |
" return;\n" |
| 2174 |
" }\n" |
| 2175 |
"\\&\n" |
| 2176 |
" if (write(fd, str, strlen(str)) == -1)\n" |
| 2177 |
" fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", setgroups_path,\n" |
| 2178 |
" strerror(errno));\n" |
| 2179 |
"\\&\n" |
| 2180 |
" close(fd);\n" |
| 2181 |
"}\n" |
| 2182 |
"\\&\n" |
| 2183 |
"static int /* Start function for cloned child */\n" |
| 2184 |
"childFunc(void *arg)\n" |
| 2185 |
"{\n" |
| 2186 |
" struct child_args *args = arg;\n" |
| 2187 |
" char ch;\n" |
| 2188 |
"\\&\n" |
| 2189 |
" /* Wait until the parent has updated the UID and GID mappings.\n" |
| 2190 |
" See the comment in main(). We wait for end of file on a\n" |
| 2191 |
" pipe that will be closed by the parent process once it has\n" |
| 2192 |
" updated the mappings. */\n" |
| 2193 |
"\\&\n" |
| 2194 |
" close(args-E<gt>pipe_fd[1]); /* Close our descriptor for the write\n" |
| 2195 |
" end of the pipe so that we see EOF\n" |
| 2196 |
" when parent closes its descriptor. */\n" |
| 2197 |
" if (read(args-E<gt>pipe_fd[0], &ch, 1) != 0) {\n" |
| 2198 |
" fprintf(stderr,\n" |
| 2199 |
" \"Failure in child: read from pipe returned != 0\\[rs]n\");\n" |
| 2200 |
" exit(EXIT_FAILURE);\n" |
| 2201 |
" }\n" |
| 2202 |
"\\&\n" |
| 2203 |
" close(args-E<gt>pipe_fd[0]);\n" |
| 2204 |
"\\&\n" |
| 2205 |
" /* Execute a shell command. */\n" |
| 2206 |
"\\&\n" |
| 2207 |
" printf(\"About to exec %s\\[rs]n\", args-E<gt>argv[0]);\n" |
| 2208 |
" execvp(args-E<gt>argv[0], args-E<gt>argv);\n" |
| 2209 |
" err(EXIT_FAILURE, \"execvp\");\n" |
| 2210 |
"}\n" |
| 2211 |
"\\&\n" |
| 2212 |
"#define STACK_SIZE (1024 * 1024)\n" |
| 2213 |
"\\&\n" |
| 2214 |
"static char child_stack[STACK_SIZE]; /* Space for child\\[aq]s stack */\n" |
| 2215 |
"\\&\n" |
| 2216 |
"int\n" |
| 2217 |
"main(int argc, char *argv[])\n" |
| 2218 |
"{\n" |
| 2219 |
" int flags, opt, map_zero;\n" |
| 2220 |
" pid_t child_pid;\n" |
| 2221 |
" struct child_args args;\n" |
| 2222 |
" char *uid_map, *gid_map;\n" |
| 2223 |
" const int MAP_BUF_SIZE = 100;\n" |
| 2224 |
" char map_buf[MAP_BUF_SIZE];\n" |
| 2225 |
" char map_path[PATH_MAX];\n" |
| 2226 |
"\\&\n" |
| 2227 |
" /* Parse command-line options. The initial \\[aq]+\\[aq] character in\n" |
| 2228 |
" the final getopt() argument prevents GNU-style permutation\n" |
| 2229 |
" of command-line options. That\\[aq]s useful, since sometimes\n" |
| 2230 |
" the \\[aq]command\\[aq] to be executed by this program itself\n" |
| 2231 |
" has command-line options. We don\\[aq]t want getopt() to treat\n" |
| 2232 |
" those as options to this program. */\n" |
| 2233 |
"\\&\n" |
| 2234 |
" flags = 0;\n" |
| 2235 |
" verbose = 0;\n" |
| 2236 |
" gid_map = NULL;\n" |
| 2237 |
" uid_map = NULL;\n" |
| 2238 |
" map_zero = 0;\n" |
| 2239 |
" while ((opt = getopt(argc, argv, \"+imnpuUM:G:zv\")) != -1) {\n" |
| 2240 |
" switch (opt) {\n" |
| 2241 |
" case \\[aq]i\\[aq]: flags |= CLONE_NEWIPC; break;\n" |
| 2242 |
" case \\[aq]m\\[aq]: flags |= CLONE_NEWNS; break;\n" |
| 2243 |
" case \\[aq]n\\[aq]: flags |= CLONE_NEWNET; break;\n" |
| 2244 |
" case \\[aq]p\\[aq]: flags |= CLONE_NEWPID; break;\n" |
| 2245 |
" case \\[aq]u\\[aq]: flags |= CLONE_NEWUTS; break;\n" |
| 2246 |
" case \\[aq]v\\[aq]: verbose = 1; break;\n" |
| 2247 |
" case \\[aq]z\\[aq]: map_zero = 1; break;\n" |
| 2248 |
" case \\[aq]M\\[aq]: uid_map = optarg; break;\n" |
| 2249 |
" case \\[aq]G\\[aq]: gid_map = optarg; break;\n" |
| 2250 |
" case \\[aq]U\\[aq]: flags |= CLONE_NEWUSER; break;\n" |
| 2251 |
" default: usage(argv[0]);\n" |
| 2252 |
" }\n" |
| 2253 |
" }\n" |
| 2254 |
"\\&\n" |
| 2255 |
" /* -M or -G without -U is nonsensical */\n" |
| 2256 |
"\\&\n" |
| 2257 |
" if (((uid_map != NULL || gid_map != NULL || map_zero) &&\n" |
| 2258 |
" !(flags & CLONE_NEWUSER)) ||\n" |
| 2259 |
" (map_zero && (uid_map != NULL || gid_map != NULL)))\n" |
| 2260 |
" usage(argv[0]);\n" |
| 2261 |
"\\&\n" |
| 2262 |
" args.argv = &argv[optind];\n" |
| 2263 |
"\\&\n" |
| 2264 |
" /* We use a pipe to synchronize the parent and child, in order to\n" |
| 2265 |
" ensure that the parent sets the UID and GID maps before the child\n" |
| 2266 |
" calls execve(). This ensures that the child maintains its\n" |
| 2267 |
" capabilities during the execve() in the common case where we\n" |
| 2268 |
" want to map the child\\[aq]s effective user ID to 0 in the new user\n" |
| 2269 |
" namespace. Without this synchronization, the child would lose\n" |
| 2270 |
" its capabilities if it performed an execve() with nonzero\n" |
| 2271 |
" user IDs (see the capabilities(7) man page for details of the\n" |
| 2272 |
" transformation of a process\\[aq]s capabilities during execve()). */\n" |
| 2273 |
"\\&\n" |
| 2274 |
" if (pipe(args.pipe_fd) == -1)\n" |
| 2275 |
" err(EXIT_FAILURE, \"pipe\");\n" |
| 2276 |
"\\&\n" |
| 2277 |
" /* Create the child in new namespace(s). */\n" |
| 2278 |
"\\&\n" |
| 2279 |
" child_pid = clone(childFunc, child_stack + STACK_SIZE,\n" |
| 2280 |
" flags | SIGCHLD, &args);\n" |
| 2281 |
" if (child_pid == -1)\n" |
| 2282 |
" err(EXIT_FAILURE, \"clone\");\n" |
| 2283 |
"\\&\n" |
| 2284 |
" /* Parent falls through to here. */\n" |
| 2285 |
"\\&\n" |
| 2286 |
" if (verbose)\n" |
| 2287 |
" printf(\"%s: PID of child created by clone() is %jd\\[rs]n\",\n" |
| 2288 |
" argv[0], (intmax_t) child_pid);\n" |
| 2289 |
"\\&\n" |
| 2290 |
" /* Update the UID and GID maps in the child. */\n" |
| 2291 |
"\\&\n" |
| 2292 |
" if (uid_map != NULL || map_zero) {\n" |
| 2293 |
" snprintf(map_path, PATH_MAX, \"/proc/%jd/uid_map\",\n" |
| 2294 |
" (intmax_t) child_pid);\n" |
| 2295 |
" if (map_zero) {\n" |
| 2296 |
" snprintf(map_buf, MAP_BUF_SIZE, \"0 %jd 1\",\n" |
| 2297 |
" (intmax_t) getuid());\n" |
| 2298 |
" uid_map = map_buf;\n" |
| 2299 |
" }\n" |
| 2300 |
" update_map(uid_map, map_path);\n" |
| 2301 |
" }\n" |
| 2302 |
"\\&\n" |
| 2303 |
" if (gid_map != NULL || map_zero) {\n" |
| 2304 |
" proc_setgroups_write(child_pid, \"deny\");\n" |
| 2305 |
"\\&\n" |
| 2306 |
" snprintf(map_path, PATH_MAX, \"/proc/%jd/gid_map\",\n" |
| 2307 |
" (intmax_t) child_pid);\n" |
| 2308 |
" if (map_zero) {\n" |
| 2309 |
" snprintf(map_buf, MAP_BUF_SIZE, \"0 %ld 1\",\n" |
| 2310 |
" (intmax_t) getgid());\n" |
| 2311 |
" gid_map = map_buf;\n" |
| 2312 |
" }\n" |
| 2313 |
" update_map(gid_map, map_path);\n" |
| 2314 |
" }\n" |
| 2315 |
"\\&\n" |
| 2316 |
" /* Close the write end of the pipe, to signal to the child that we\n" |
| 2317 |
" have updated the UID and GID maps. */\n" |
| 2318 |
"\\&\n" |
| 2319 |
" close(args.pipe_fd[1]);\n" |
| 2320 |
"\\&\n" |
| 2321 |
" if (waitpid(child_pid, NULL, 0) == -1) /* Wait for child */\n" |
| 2322 |
" err(EXIT_FAILURE, \"waitpid\");\n" |
| 2323 |
"\\&\n" |
| 2324 |
" if (verbose)\n" |
| 2325 |
" printf(\"%s: terminating\\[rs]n\", argv[0]);\n" |
| 2326 |
"\\&\n" |
| 2327 |
" exit(EXIT_SUCCESS);\n" |
| 2328 |
"}\n" |
| 2329 |
msgstr "" |
| 2330 |
"/* userns_child_exec.c\n" |
| 2331 |
"\\&\n" |
| 2332 |
" Licensed under GNU General Public License v2 or later\n" |
| 2333 |
"\\&\n" |
| 2334 |
" Skapa en barnprocess som kör ett skalkommando i nya namnrymder;\n" |
| 2335 |
" låt UID- och GID-avbildningar anges när en användarnamnrymd\n" |
| 2336 |
" skapas.\n" |
| 2337 |
"*/\n" |
| 2338 |
"#define _GNU_SOURCE\n" |
| 2339 |
"#include E<lt>err.hE<gt>\n" |
| 2340 |
"#include E<lt>sched.hE<gt>\n" |
| 2341 |
"#include E<lt>unistd.hE<gt>\n" |
| 2342 |
"#include E<lt>stdint.hE<gt>\n" |
| 2343 |
"#include E<lt>stdlib.hE<gt>\n" |
| 2344 |
"#include E<lt>sys/wait.hE<gt>\n" |
| 2345 |
"#include E<lt>signal.hE<gt>\n" |
| 2346 |
"#include E<lt>fcntl.hE<gt>\n" |
| 2347 |
"#include E<lt>stdio.hE<gt>\n" |
| 2348 |
"#include E<lt>string.hE<gt>\n" |
| 2349 |
"#include E<lt>limits.hE<gt>\n" |
| 2350 |
"#include E<lt>errno.hE<gt>\n" |
| 2351 |
"\\&\n" |
| 2352 |
"struct child_args {\n" |
| 2353 |
" char **argv; /* Kommando att köras av barnet, med argument */\n" |
| 2354 |
" int pipe_fd[2]; /* Rör använt för att synkronisera förälder och barn */\n" |
| 2355 |
"};\n" |
| 2356 |
"\\&\n" |
| 2357 |
"static int verbose;\n" |
| 2358 |
"\\&\n" |
| 2359 |
"static void\n" |
| 2360 |
"usage(char *pname)\n" |
| 2361 |
"{\n" |
| 2362 |
" fprintf(stderr, \"Användning: %s [flaggor] kmd [arg…]\\[rs]n\\[rs]n\", pname);\n" |
| 2363 |
" fprintf(stderr, \"Skapa en barnprocess som kör ett skalkommando i \"\n" |
| 2364 |
" \"en ny användarnamnrymd,\\[rs]n\"\n" |
| 2365 |
" \"och eventuellt även andra nya namnrymder.\\[rs]n\\[rs]n\");\n" |
| 2366 |
" fprintf(stderr, \"Flaggor kan vara:\\[rs]n\\[rs]n\");\n" |
| 2367 |
"#define fpe(str) fprintf(stderr, \" %s\", str);\n" |
| 2368 |
" fpe(\"-i Ny IPC-namnrymd\\[rs]n\");\n" |
| 2369 |
" fpe(\"-m Ny monteringsnamnrymd\\[rs]n\");\n" |
| 2370 |
" fpe(\"-n Ny nätverksnamnrymd\\[rs]n\");\n" |
| 2371 |
" fpe(\"-p Ny PID-namnrymd\\[rs]n\");\n" |
| 2372 |
" fpe(\"-u Ny UTS-namnrymd\\[rs]n\");\n" |
| 2373 |
" fpe(\"-U Ny användarnamnrymd\\[rs]n\");\n" |
| 2374 |
" fpe(\"-M uid_map Ange AID-avbildning för användarnamnrymden\\[rs]n\");\n" |
| 2375 |
" fpe(\"-G gid_map Ange GID-avbildning för användarnamnrymden\\[rs]n\");\n" |
| 2376 |
" fpe(\"-z Avbilda användar-AID och -GID till 0 i användarnamnrymden\\[rs]n\");\n" |
| 2377 |
" fpe(\" (ekvivalent med: -M \\[aq]0 E<lt>aidE<gt> 1\\[aq] -G \\[aq]0 E<lt>gidE<gt> 1\\[aq])\\[rs]n\");\n" |
| 2378 |
" fpe(\"-v Visa utförliga meddelanden\\[rs]n\");\n" |
| 2379 |
" fpe(\"\\[rs]n\");\n" |
| 2380 |
" fpe(\"Om -z, -M eller -G anges är -U nödvändigt.\\[rs]n\");\n" |
| 2381 |
" fpe(\"Det är inte tillåtet att ange både -z och någon av -M eller -G.\\[rs]n\");\n" |
| 2382 |
" fpe(\"\\[rs]n\");\n" |
| 2383 |
" fpe(\"Avbildningssträngar för -M och -G består av poster på formen:\\[rs]n\");\n" |
| 2384 |
" fpe(\"\\[rs]n\");\n" |
| 2385 |
" fpe(\" ID-inuti-nr ID-utanför-nr storlek\\[rs]n\");\n" |
| 2386 |
" fpe(\"\\[rs]n\");\n" |
| 2387 |
" fpe(\"En avbildningssträng kan innehålla flera poster, separerade\"\n" |
| 2388 |
" \" av komman;\\[rs]n\");\n" |
| 2389 |
" fpe(\"kommatecknen ersätts med nyrader före skrivning\"\n" |
| 2390 |
" \" till avbildningsfiler.\\[rs]n\");\n" |
| 2391 |
"\\&\n" |
| 2392 |
" exit(EXIT_FAILURE);\n" |
| 2393 |
"}\n" |
| 2394 |
"\\&\n" |
| 2395 |
"/* Uppdatera avbildningsfilen \\[aq]map_fil\\[aq], med värdena som ges i\n" |
| 2396 |
" \\[aq]avbildning\\[aq], en sträng som definierar en AID- eller GID-avbildning.\n" |
| 2397 |
" En AID- eller GID-avbildning består av en eller flera nyradsavgränsade poster\n" |
| 2398 |
" på formen:\n" |
| 2399 |
"\\&\n" |
| 2400 |
" ID_inuti-nr ID-utanför-nr storlek\n" |
| 2401 |
"\\&\n" |
| 2402 |
" Att begära att användaren skall ge en sträng som innehåller nyrader är\n" |
| 2403 |
" naturligtvis opraktiskt för kommandoradsanvändning. Därför tillåter vi\n" |
| 2404 |
" användningen av komman för att avgränsa poster i denna sträng, och\n" |
| 2405 |
" ersätter dem med nyrader före vi skriver strängen till filen. */\"\n" |
| 2406 |
"\\&\n" |
| 2407 |
"static void\n" |
| 2408 |
"update_map(char *mapping, char *map_file)\n" |
| 2409 |
"{\n" |
| 2410 |
" int fd;\n" |
| 2411 |
" size_t map_len; /* Längden på \\\\[aq]avbildning\\\\[aq] */\n" |
| 2412 |
"\\&\n" |
| 2413 |
" /* Ersätt kommatecken i avbildningssträngar med nyrader. */\n" |
| 2414 |
"\\&\n" |
| 2415 |
" map_len = strlen(mapping);\n" |
| 2416 |
" for (size_t j = 0; j E<lt> map_len; j++)\n" |
| 2417 |
" if (mapping[j] == \\[aq],\\[aq])\n" |
| 2418 |
" mapping[j] = \\[aq]\\[rs]n\\[aq];\n" |
| 2419 |
"\\&\n" |
| 2420 |
" fd = open(map_file, O_RDWR);\n" |
| 2421 |
" if (fd == -1) {\n" |
| 2422 |
" fprintf(stderr, \"FEL: open %s: %s\\[rs]n\", map_file,\n" |
| 2423 |
" strerror(errno));\n" |
| 2424 |
" exit(EXIT_FAILURE);\n" |
| 2425 |
" }\n" |
| 2426 |
"\\&\n" |
| 2427 |
" if (write(fd, mapping, map_len) != map_len) {\n" |
| 2428 |
" fprintf(stderr, \"FEL: write %s: %s\\[rs]n\", map_file,\n" |
| 2429 |
" strerror(errno));\n" |
| 2430 |
" exit(EXIT_FAILURE);\n" |
| 2431 |
" }\n" |
| 2432 |
"\\&\n" |
| 2433 |
" close(fd);\n" |
| 2434 |
"}\n" |
| 2435 |
"\\&\n" |
| 2436 |
"/* Linux 3.19 gjorde en ändring av hanteringen av setgroups(2) och filen\n" |
| 2437 |
" \\[aq]gid_map\\[aq] för att åtgärda ett säkerhetsproblem. Problemet tillät\n" |
| 2438 |
" *oprivilegierade* användare att nyttja användarnamnrymder för att släppa\n" |
| 2439 |
" grupper. Följden av ändringarna i 3.19 är att för att uppdatera filen\n" |
| 2440 |
" \\[aq]gid_maps\\[aq] måste först användning av systemanropet setgroups()\n" |
| 2441 |
" i denna användarnamnrymd avaktiveras genom att skriva \"deny\" till en\n" |
| 2442 |
" av filerna /proc/PID/setgroups för denna namnrymd. Det är syftet med\n" |
| 2443 |
" följande funktion. */\n" |
| 2444 |
"\\&\n" |
| 2445 |
"static void\n" |
| 2446 |
"proc_setgroups_write(pid_t child_pid, char *str)\n" |
| 2447 |
"{\n" |
| 2448 |
" char setgroups_path[PATH_MAX];\n" |
| 2449 |
" int fd;\n" |
| 2450 |
"\\&\n" |
| 2451 |
" snprintf(setgroups_path, PATH_MAX, \"/proc/%jd/setgroups\",\n" |
| 2452 |
" (intmax_t) child_pid);\n" |
| 2453 |
"\\&\n" |
| 2454 |
" fd = open(setgroups_path, O_RDWR);\n" |
| 2455 |
" if (fd == -1) {\n" |
| 2456 |
"\\&\n" |
| 2457 |
" /* Vi kan vara på ett system som inte stödjer /proc/PID/setgroups.\n" |
| 2458 |
" I det fallet kommer filen inte att finnas, och systemet kommer\n" |
| 2459 |
" inte att påtvinga begränsningarna som Linux 3.19 lade till. Det\n" |
| 2460 |
" är bra så: vi behöver inte göra något för att tillåta att\n" |
| 2461 |
" \\[aq]gid_map\\[aq] uppdateras.\n" |
| 2462 |
"\\&\n" |
| 2463 |
" Dock, om felet från open() var något annat än felet ENOENT\n" |
| 2464 |
" som förväntas i det fallet, tala om det för användaren. */\n" |
| 2465 |
"\\&\n" |
| 2466 |
" if (errno != ENOENT)\n" |
| 2467 |
" fprintf(stderr, \"FEL: open %s: %s\\[rs]n\", setgroups_path,\n" |
| 2468 |
" strerror(errno));\n" |
| 2469 |
" return;\n" |
| 2470 |
" }\n" |
| 2471 |
"\\&\n" |
| 2472 |
" if (write(fd, str, strlen(str)) == -1)\n" |
| 2473 |
" fprintf(stderr, \"FEL: write %s: %s\\[rs]n\", setgroups_path,\n" |
| 2474 |
" strerror(errno));\n" |
| 2475 |
"\\&\n" |
| 2476 |
" close(fd);\n" |
| 2477 |
"}\n" |
| 2478 |
"\\&\n" |
| 2479 |
"static int /* Startfunktion för klonat barn */\n" |
| 2480 |
"childFunc(void *arg)\n" |
| 2481 |
"{\n" |
| 2482 |
" struct child_args *args = arg;\n" |
| 2483 |
" char ch;\n" |
| 2484 |
"\\&\n" |
| 2485 |
" /* Vänta tills föräldern har uppdaterat AID- och GID-avbildningarna.\n" |
| 2486 |
" Se kommentaren i main(). Vi väntar på filslut från ett rör som\n" |
| 2487 |
" kommer stängas av föräldraprocessen när den har uppdaterat\n" |
| 2488 |
" avbildningarna. */\n" |
| 2489 |
"\\&\n" |
| 2490 |
" close(args-E<gt>pipe_fd[1]); /* Stäng vår beskrivare för skrivänden\n" |
| 2491 |
" av röret så att vi ser EOF när föräldern\n" |
| 2492 |
" stänger sin beskrivare. */\n" |
| 2493 |
" if (read(args-E<gt>pipe_fd[0], &ch, 1) != 0) {\n" |
| 2494 |
" fprintf(stderr,\n" |
| 2495 |
" \"Fel i barnet: läsning från röret returnerade ≠ 0\\[rs]n\");\n" |
| 2496 |
" exit(EXIT_FAILURE);\n" |
| 2497 |
" }\n" |
| 2498 |
"\\&\n" |
| 2499 |
" close(args-E<gt>pipe_fd[0]);\n" |
| 2500 |
"\\&\n" |
| 2501 |
" /* Kör ett skalkommando. */\n" |
| 2502 |
"\\&\n" |
| 2503 |
" printf(\"I begrepp att göra exec %s\\[rs]n\", args-E<gt>argv[0]);\n" |
| 2504 |
" execvp(args-E<gt>argv[0], args-E<gt>argv);\n" |
| 2505 |
" err(EXIT_FAILURE, \"execvp\");\n" |
| 2506 |
"}\n" |
| 2507 |
"\\&\n" |
| 2508 |
"#define STACK_SIZE (1024 * 1024)\n" |
| 2509 |
"\\&\n" |
| 2510 |
"static char child_stack[STACK_SIZE]; /* Utrymme för barnets stack */\n" |
| 2511 |
"\\&\n" |
| 2512 |
"int\n" |
| 2513 |
"main(int argc, char *argv[])\n" |
| 2514 |
"{\n" |
| 2515 |
" int flags, opt, map_zero;\n" |
| 2516 |
" pid_t child_pid;\n" |
| 2517 |
" struct child_args args;\n" |
| 2518 |
" char *uid_map, *gid_map;\n" |
| 2519 |
" const int MAP_BUF_SIZE = 100;\n" |
| 2520 |
" char map_buf[MAP_BUF_SIZE];\n" |
| 2521 |
" char map_path[PATH_MAX];\n" |
| 2522 |
"\\&\n" |
| 2523 |
" /* Tolka kommandoradsflaggor. Det inledande tecknet \\[aq]+\\[aq] i det\n" |
| 2524 |
" sista argumentet till getopt() förhindrar permutationer av\n" |
| 2525 |
" kommandoradsflaggor enligt GNU-stil. Det är användbart, eftersom\n" |
| 2526 |
" ibland \\[aq]kommandot\\[aq] som skall köras av detta program självt\n" |
| 2527 |
" har kommandoradsflaggor. Vi vill inte att getopt() skall hantera\n" |
| 2528 |
" dessa som flaggor till detta program. */\n" |
| 2529 |
"\\&\n" |
| 2530 |
" flags = 0;\n" |
| 2531 |
" verbose = 0;\n" |
| 2532 |
" gid_map = NULL;\n" |
| 2533 |
" uid_map = NULL;\n" |
| 2534 |
" map_zero = 0;\n" |
| 2535 |
" while ((opt = getopt(argc, argv, \"+imnpuUM:G:zv\")) != -1) {\n" |
| 2536 |
" switch (opt) {\n" |
| 2537 |
" case \\[aq]i\\[aq]: flags |= CLONE_NEWIPC; break;\n" |
| 2538 |
" case \\[aq]m\\[aq]: flags |= CLONE_NEWNS; break;\n" |
| 2539 |
" case \\[aq]n\\[aq]: flags |= CLONE_NEWNET; break;\n" |
| 2540 |
" case \\[aq]p\\[aq]: flags |= CLONE_NEWPID; break;\n" |
| 2541 |
" case \\[aq]u\\[aq]: flags |= CLONE_NEWUTS; break;\n" |
| 2542 |
" case \\[aq]v\\[aq]: verbose = 1; break;\n" |
| 2543 |
" case \\[aq]z\\[aq]: map_zero = 1; break;\n" |
| 2544 |
" case \\[aq]M\\[aq]: uid_map = optarg; break;\n" |
| 2545 |
" case \\[aq]G\\[aq]: gid_map = optarg; break;\n" |
| 2546 |
" case \\[aq]U\\[aq]: flags |= CLONE_NEWUSER; break;\n" |
| 2547 |
" default: usage(argv[0]);\n" |
| 2548 |
" }\n" |
| 2549 |
" }\n" |
| 2550 |
"\\&\n" |
| 2551 |
" /* -M eller -G utan -U är meningslöst */\n" |
| 2552 |
"\\&\n" |
| 2553 |
" if (((uid_map != NULL || gid_map != NULL || map_zero) &&\n" |
| 2554 |
" !(flags & CLONE_NEWUSER)) ||\n" |
| 2555 |
" (map_zero && (uid_map != NULL || gid_map != NULL)))\n" |
| 2556 |
" usage(argv[0]);\n" |
| 2557 |
"\\&\n" |
| 2558 |
" args.argv = &argv[optind];\n" |
| 2559 |
"\\&\n" |
| 2560 |
" /* Vi använder ett rör för att synkronisera förälder och barn, för\n" |
| 2561 |
" att säkerställa att föräldern ställer in UID- och GID-avbildningarna\n" |
| 2562 |
" före barnet anropar execve(). Detta ser till att barnet behåller\n" |
| 2563 |
" sina förmågor under execve() i det vanliga fallet då vi vill avbilda\n" |
| 2564 |
" barnets effektiva användar-ID på 0 i den nya användarnamnrymden.\n" |
| 2565 |
" Utan denna synkronisering skulle barnet tappa sina förmågor om det\n" |
| 2566 |
" utförde en execve() med användar-ID:n skilda från noll (se\n" |
| 2567 |
" manualsidan capabilities(7) för detaljer om transformationen av en\n" |
| 2568 |
" process förmågor under execve()). */\n" |
| 2569 |
"\\&\n" |
| 2570 |
" if (pipe(args.pipe_fd) == -1)\n" |
| 2571 |
" err(EXIT_FAILURE, \"pipe\");\n" |
| 2572 |
"\\&\n" |
| 2573 |
" /* Skapa barnet i nya namnrymder. */\n" |
| 2574 |
"\\&\n" |
| 2575 |
" child_pid = clone(childFunc, child_stack + STACK_SIZE,\n" |
| 2576 |
" flags | SIGCHLD, &args);\n" |
| 2577 |
" if (child_pid == -1)\n" |
| 2578 |
" err(EXIT_FAILURE, \"clone\");\n" |
| 2579 |
"\\&\n" |
| 2580 |
" /* Föräldern faller igenom hit. */\n" |
| 2581 |
"\\&\n" |
| 2582 |
" if (verbose)\n" |
| 2583 |
" printf(\"%s: PID för barnet som skapades av clone() är %jd\\[rs]n\",\n" |
| 2584 |
" argv[0], (intmax_t) child_pid);\n" |
| 2585 |
"\\&\n" |
| 2586 |
" /* Uppdatera UID- och GID-avbildningarna i barnet. */\n" |
| 2587 |
"\\&\n" |
| 2588 |
" if (uid_map != NULL || map_zero) {\n" |
| 2589 |
" snprintf(map_path, PATH_MAX, \"/proc/%jd/uid_map\",\n" |
| 2590 |
" (intmax_t) child_pid);\n" |
| 2591 |
" if (map_zero) {\n" |
| 2592 |
" snprintf(map_buf, MAP_BUF_SIZE, \"0 %jd 1\",\n" |
| 2593 |
" (intmax_t) getuid());\n" |
| 2594 |
" uid_map = map_buf;\n" |
| 2595 |
" }\n" |
| 2596 |
" update_map(uid_map, map_path);\n" |
| 2597 |
" }\n" |
| 2598 |
"\\&\n" |
| 2599 |
" if (gid_map != NULL || map_zero) {\n" |
| 2600 |
" proc_setgroups_write(child_pid, \"deny\");\n" |
| 2601 |
"\\&\n" |
| 2602 |
" snprintf(map_path, PATH_MAX, \"/proc/%jd/gid_map\",\n" |
| 2603 |
" (intmax_t) child_pid);\n" |
| 2604 |
" if (map_zero) {\n" |
| 2605 |
" snprintf(map_buf, MAP_BUF_SIZE, \"0 %ld 1\",\n" |
| 2606 |
" (intmax_t) getgid());\n" |
| 2607 |
" gid_map = map_buf;\n" |
| 2608 |
" }\n" |
| 2609 |
" update_map(gid_map, map_path);\n" |
| 2610 |
" }\n" |
| 2611 |
"\\&\n" |
| 2612 |
" /* Stäng skrivänden av röret för att signalera till barnet att vi\n" |
| 2613 |
" har uppdaterat UID- och GID-avbildningarna. */\n" |
| 2614 |
"\\&\n" |
| 2615 |
" close(args.pipe_fd[1]);\n" |
| 2616 |
"\\&\n" |
| 2617 |
" if (waitpid(child_pid, NULL, 0) == -1) /* Wait for child */\n" |
| 2618 |
" err(EXIT_FAILURE, \"waitpid\");\n" |
| 2619 |
"\\&\n" |
| 2620 |
" if (verbose)\n" |
| 2621 |
" printf(\"%s: avslutar\\[rs]n\", argv[0]);\n" |
| 2622 |
"\\&\n" |
| 2623 |
" exit(EXIT_SUCCESS);\n" |
| 2624 |
"}\n" |
| 2625 |
|
| 2626 |
#. type: SH |
| 2627 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 2628 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 2629 |
#, no-wrap |
| 2630 |
msgid "SEE ALSO" |
| 2631 |
msgstr "SE ÄVEN" |
| 2632 |
|
| 2633 |
#. From the shadow package |
| 2634 |
#. From the shadow package |
| 2635 |
#. From the shadow package |
| 2636 |
#. From the shadow package |
| 2637 |
#. type: Plain text |
| 2638 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 2639 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 2640 |
msgid "" |
| 2641 |
"B<newgidmap>(1), B<newuidmap>(1), B<clone>(2), B<ptrace>(2), B<setns>(2), " |
| 2642 |
"B<unshare>(2), B<proc>(5), B<subgid>(5), B<subuid>(5), B<capabilities>(7), " |
| 2643 |
"B<cgroup_namespaces>(7), B<credentials>(7), B<namespaces>(7), " |
| 2644 |
"B<pid_namespaces>(7)" |
| 2645 |
msgstr "" |
| 2646 |
"B<newgidmap>(1), B<newuidmap>(1), B<clone>(2), B<ptrace>(2), B<setns>(2), " |
| 2647 |
"B<unshare>(2), B<proc>(5), B<subgid>(5), B<subuid>(5), B<capabilities>(7), " |
| 2648 |
"B<cgroup_namespaces>(7), B<credentials>(7), B<namespaces>(7), " |
| 2649 |
"B<pid_namespaces>(7)" |
| 2650 |
|
| 2651 |
#. type: Plain text |
| 2652 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 2653 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 2654 |
msgid "" |
| 2655 |
"The kernel source file I<Documentation/admin-guide/namespaces/resource-" |
| 2656 |
"control.rst>." |
| 2657 |
msgstr "" |
| 2658 |
"Kärnans källfil I<Documentation/admin-guide/namespaces/resource-control.rst>." |
| 2659 |
|
| 2660 |
#. type: TH |
| 2661 |
#: debian-trixie |
| 2662 |
#, no-wrap |
| 2663 |
msgid "2024-06-15" |
| 2664 |
msgstr "15 juni 2024" |
| 2665 |
|
| 2666 |
#. type: TH |
| 2667 |
#: debian-trixie |
| 2668 |
#, no-wrap |
| 2669 |
msgid "Linux man-pages 6.9.1" |
| 2670 |
msgstr "Linux man-pages 6.9.1" |
| 2671 |
|
| 2672 |
#. type: Plain text |
| 2673 |
#: debian-trixie fedora-44 fedora-rawhide |
| 2674 |
msgid "" |
| 2675 |
"User namespaces can be nested; that is, each user namespace\\[em]except the " |
| 2676 |
"initial (\"root\") namespace\\[em]has a parent user namespace, and can have " |
| 2677 |
"zero or more child user namespaces. The parent user namespace is the user " |
| 2678 |
"namespace of the process that creates the user namespace via a call to " |
| 2679 |
"B<unshare>(2) or B<clone>(2) with the B<CLONE_NEWUSER> flag." |
| 2680 |
msgstr "" |
| 2681 |
"Användarnamnrymder kan nästas; det vill säga, varje användarnamnrymd \\[em] " |
| 2682 |
"utom den initiala (”rot-”)namnrymden \\[em] har en föräldraanvändarnamnrymd, " |
| 2683 |
"och kan ha noll eller flera barnanvändarnamnrymder. " |
| 2684 |
"Föräldraanvändarnamnrymden är användarnamnrymden för processen som skapar " |
| 2685 |
"användarnamnrymden via ett anrop av B<unshare>(2) eller B<clone>(2) med " |
| 2686 |
"flaggan B<CLONE_NEWUSER>." |
| 2687 |
|
| 2688 |
#. commit 8742f229b635bf1c1c84a3dfe5e47c814c20b5c8 |
| 2689 |
#. FIXME Explain the rationale for this limit. (What is the rationale?) |
| 2690 |
#. type: Plain text |
| 2691 |
#: debian-trixie fedora-44 fedora-rawhide |
| 2692 |
msgid "" |
| 2693 |
"The kernel imposes (since Linux 3.11) a limit of 32 nested levels of user " |
| 2694 |
"namespaces. Calls to B<unshare>(2) or B<clone>(2) that would cause this " |
| 2695 |
"limit to be exceeded fail with the error B<EUSERS>." |
| 2696 |
msgstr "" |
| 2697 |
"Kärnan lägger (från Linux 3.11) en gräns på 32 nästade nivåer med " |
| 2698 |
"användarnamnrymder. Anrop av B<unshare>(2) eller B<clone>(2) som annars " |
| 2699 |
"skulle orsaka att denna gräns överskrids misslyckas med felet B<EUSERS>." |
| 2700 |
|
| 2701 |
# |
| 2702 |
#. ============================================================ |
| 2703 |
#. type: Plain text |
| 2704 |
#: debian-trixie fedora-44 fedora-rawhide |
| 2705 |
msgid "" |
| 2706 |
"A task that changes one of its effective IDs will have its dumpability reset " |
| 2707 |
"to the value in I</proc/sys/fs/suid_dumpable>. This may affect the " |
| 2708 |
"ownership of proc files of child processes and may thus cause the parent to " |
| 2709 |
"lack the permissions to write to mapping files of child processes running in " |
| 2710 |
"a new user namespace. In such cases making the parent process dumpable, " |
| 2711 |
"using B<PR_SET_DUMPABLE> in a call to B<prctl>(2), before creating a child " |
| 2712 |
"process in a new user namespace may rectify this problem. See B<prctl>(2) " |
| 2713 |
"and B<proc>(5) for details on how ownership is affected." |
| 2714 |
msgstr "" |
| 2715 |
"En uppgift som ändrar ett av sina effektiva ID:n kommer ha sin dumpbarhet " |
| 2716 |
"återställd till värdet i I</proc/sys/fs/suid_dumpable>. Detta kan påverka " |
| 2717 |
"ägandet av proc-filer för barnprocesser och kan alltså orsaka att föräldern " |
| 2718 |
"kommer att sakna rättigheter att skriva till avbildningsfiler för " |
| 2719 |
"barnprocesser som kör i en ny användarnamnrymd. I dessa fall kan man genom " |
| 2720 |
"att göra processen dumpbar med B<PR_SET_DUMPABLE> i ett anrop av B<prctl>(2) " |
| 2721 |
"före en barnprocess skapas i en ny användarnamnrymd åtgärda detta problem. " |
| 2722 |
"Se B<prctl>82) och B<proc>(5) för detaljer om hur ägarskap påverkas." |
| 2723 |
|
| 2724 |
#. type: Plain text |
| 2725 |
#: debian-trixie fedora-44 fedora-rawhide |
| 2726 |
msgid "" |
| 2727 |
"A call to B<clone>(2) or B<unshare>(2) using the B<CLONE_NEWUSER> flag or " |
| 2728 |
"a call to B<setns>(2) that moves the caller into another user namespace " |
| 2729 |
"sets the \"securebits\" flags (see B<capabilities>(7)) to their default " |
| 2730 |
"values (all flags disabled) in the child (for B<clone>(2)) or caller (for " |
| 2731 |
"B<unshare>(2) or B<setns>(2)). Note that because the caller no longer has " |
| 2732 |
"capabilities in its original user namespace after a call to B<setns>(2), it " |
| 2733 |
"is not possible for a process to reset its \"securebits\" flags while " |
| 2734 |
"retaining its user namespace membership by using a pair of B<setns>(2) " |
| 2735 |
"calls to move to another user namespace and then return to its original user " |
| 2736 |
"namespace." |
| 2737 |
msgstr "" |
| 2738 |
"Ett anrop av B<clone>(2) eller B<unshare>(2) med flaggan B<CLONE_NEWUSER> " |
| 2739 |
"eller ett anrop av B<setns>(2) som flyttar anroparen in i en annan " |
| 2740 |
"användarnamnrymd sätter flaggorna ”securebits” (se B<capabilities>(7)) till " |
| 2741 |
"sitt standardvärde (alla flaggor avslagna) i barnet (för B<clone>(2)) eller " |
| 2742 |
"anroparen (för B<unshare>(2) eller B<setns>(2)). Observera att eftersom " |
| 2743 |
"anroparen inte längre har förmågor i sin originalanvändarnamnrymd efter " |
| 2744 |
"anropet av B<setns>(2) är det inte möjligt för en process att återställa " |
| 2745 |
"sina flaggor ”securebits” medan den behåller sitt medlemskap i " |
| 2746 |
"användarnamnrymden genom att använda ett par av anrop av B<setns>(2) för att " |
| 2747 |
"flytta till en annan användarnamnrymd och sedan återvända till sin " |
| 2748 |
"originalanvändarnamnrymd." |
| 2749 |
|
| 2750 |
#. type: Plain text |
| 2751 |
#: debian-trixie fedora-44 fedora-rawhide |
| 2752 |
msgid "" |
| 2753 |
"If a process has a capability in a user namespace, then it has that " |
| 2754 |
"capability in all child (and further removed descendant) namespaces as well." |
| 2755 |
msgstr "" |
| 2756 |
"Om en process har en förmåga i en användarnamnrymd, då har den den förmågan " |
| 2757 |
"i alla barn- (och mer avlägsna avkomme-)namnrymder också." |
| 2758 |
|
| 2759 |
#. type: Plain text |
| 2760 |
#: debian-trixie fedora-44 fedora-rawhide |
| 2761 |
msgid "" |
| 2762 |
"Having a capability inside a user namespace permits a process to perform " |
| 2763 |
"operations (that require privilege) only on resources governed by that " |
| 2764 |
"namespace. In other words, having a capability in a user namespace permits " |
| 2765 |
"a process to perform privileged operations on resources that are governed by " |
| 2766 |
"(nonuser) namespaces owned by (associated with) the user namespace (see the " |
| 2767 |
"next subsection)." |
| 2768 |
msgstr "" |
| 2769 |
"Att ha en förmåga inuti en användarnamnrymd tillåter en process att utföra " |
| 2770 |
"åtgärder (som kräver privilegier) endast på resurser som styrs av den " |
| 2771 |
"namnrymden. Med andra ord, att ha en förmåga i en användarnamnrymd tillåter " |
| 2772 |
"en process att utföra privilegierade åtgärder på resurser som styrs av (icke " |
| 2773 |
"användar-)namnrymder som ägs av (är associerade med) användarnamnrymden (se " |
| 2774 |
"nästa underavdelning)." |
| 2775 |
|
| 2776 |
#. type: Plain text |
| 2777 |
#: debian-trixie |
| 2778 |
msgid "" |
| 2779 |
"Holding B<CAP_SYS_ADMIN> within the user namespace that owns a process's " |
| 2780 |
"cgroup namespace allows (since Linux 4.6) that process to the mount the " |
| 2781 |
"cgroup version 2 filesystem and cgroup version 1 named hierarchies (i.e., " |
| 2782 |
"cgroup filesystems mounted with the I<\\[dq]none,name=\\[dq]> option)." |
| 2783 |
msgstr "" |
| 2784 |
"Att hålla B<CAP_SYS_ADMIN> inom användarnamnrymden som äger en process " |
| 2785 |
"cgroup-namnrymd gör (från Linux 4.6) att den processen kan montera " |
| 2786 |
"filsystemet cgroup version 2 och namngivna hierarkier av filsystemet cgroup " |
| 2787 |
"verson 1 (d.v.s., cgroup-filsystem monterade med flaggan I<\\[dq]none," |
| 2788 |
"name=\\[dq]>)." |
| 2789 |
|
| 2790 |
# |
| 2791 |
#. ============================================================ |
| 2792 |
#. type: Plain text |
| 2793 |
#: debian-trixie fedora-44 fedora-rawhide |
| 2794 |
msgid "" |
| 2795 |
"Note, however, that mounting block-based filesystems can be done only by a " |
| 2796 |
"process that holds B<CAP_SYS_ADMIN> in the initial user namespace." |
| 2797 |
msgstr "" |
| 2798 |
"Observera dock att montering av blockbaserade filsystem endast kan göras av " |
| 2799 |
"en process som håller B<CAP_SYS_ADMIN> i den initiala användarnamnrymden." |
| 2800 |
|
| 2801 |
#. type: Plain text |
| 2802 |
#: debian-trixie |
| 2803 |
msgid "" |
| 2804 |
"Starting in Linux 3.8, unprivileged processes can create user namespaces, " |
| 2805 |
"and the other types of namespaces can be created with just the " |
| 2806 |
"B<CAP_SYS_ADMIN> capability in the caller's user namespace." |
| 2807 |
msgstr "" |
| 2808 |
"Med början från Linux 3.8 kan oprivilegierade processer skapa " |
| 2809 |
"användarnamnrymder, och de andra typerna av namnrymder kan skapas med bara " |
| 2810 |
"förmågan B<CAP_SYS_ADMIN> i anroparens användarnamnrymd." |
| 2811 |
|
| 2812 |
#. type: Plain text |
| 2813 |
#: debian-trixie fedora-44 fedora-rawhide |
| 2814 |
msgid "" |
| 2815 |
"When a new namespace (other than a user namespace) is created via " |
| 2816 |
"B<clone>(2) or B<unshare>(2), the kernel records the user namespace of the " |
| 2817 |
"creating process as the owner of the new namespace. (This association can't " |
| 2818 |
"be changed.) When a process in the new namespace subsequently performs " |
| 2819 |
"privileged operations that operate on global resources isolated by the " |
| 2820 |
"namespace, the permission checks are performed according to the process's " |
| 2821 |
"capabilities in the user namespace that the kernel associated with the new " |
| 2822 |
"namespace. For example, suppose that a process attempts to change the " |
| 2823 |
"hostname (B<sethostname>(2)), a resource governed by the UTS namespace. In " |
| 2824 |
"this case, the kernel will determine which user namespace owns the process's " |
| 2825 |
"UTS namespace, and check whether the process has the required capability " |
| 2826 |
"(B<CAP_SYS_ADMIN>) in that user namespace." |
| 2827 |
msgstr "" |
| 2828 |
"När en ny namnrymd (annan än en användarnamnrymd) skapas via B<clone>(2) " |
| 2829 |
"eller B<unshare>(2) registrerar kärnan användarnamnrymden för processen som " |
| 2830 |
"skapar den som ägare till den nya namnrymden. (Denna koppling kan inte " |
| 2831 |
"ändras.) När en process i den nya namnrymden senare utför privilegierade " |
| 2832 |
"åtgärder som verkar på globala resurser isolerade av namnrymden utförs " |
| 2833 |
"rättighetskontrollerna enligt processens förmågor i användarnamnrymden som " |
| 2834 |
"kärnan associerade med den nya namnrymden. Till exempel, antag att en " |
| 2835 |
"process försöker ändra värdnamnet (B<sethostname>(2)), en resurs som styrs " |
| 2836 |
"av UTS-namnrymden. I detta fall kommer kärnan avgöra vilken användarnamnrymd " |
| 2837 |
"som äger processens UTS-namnrymd, och kontrollera huruvida processen har den " |
| 2838 |
"nödvändiga förmågan (B<CAP_SYS_ADMIN>) i den användarnamnrymden." |
| 2839 |
|
| 2840 |
#. type: Plain text |
| 2841 |
#: debian-trixie |
| 2842 |
msgid "" |
| 2843 |
"Each line in the I<uid_map> file specifies a 1-to-1 mapping of a range of " |
| 2844 |
"contiguous user IDs between two user namespaces. (When a user namespace is " |
| 2845 |
"first created, this file is empty.) The specification in each line takes " |
| 2846 |
"the form of three numbers delimited by white space. The first two numbers " |
| 2847 |
"specify the starting user ID in each of the two user namespaces. The third " |
| 2848 |
"number specifies the length of the mapped range. In detail, the fields are " |
| 2849 |
"interpreted as follows:" |
| 2850 |
msgstr "" |
| 2851 |
"Varje rad i filen I<uid_map> anger en 1-till-1-avbildning av ett intervall " |
| 2852 |
"av sammanhängande användar-ID:n mellan två användarnamnrymder. (När en " |
| 2853 |
"användarnamnrymd först skapas är denna fil tom.) Specifikationen på varje " |
| 2854 |
"rad har formen tre tal avgränsade av mellanslag. De första två talen anger " |
| 2855 |
"det första användar-ID:t i vardera av de två användarnamnrymderna. Det " |
| 2856 |
"tredje talet anger längden på det avbildade intervallet. Mer exakt tolkas " |
| 2857 |
"fälten som följer:" |
| 2858 |
|
| 2859 |
#. type: Plain text |
| 2860 |
#: debian-trixie |
| 2861 |
msgid "" |
| 2862 |
"The length of the range of user IDs that is mapped between the two user " |
| 2863 |
"namespaces." |
| 2864 |
msgstr "" |
| 2865 |
"Längden på intervallet av användar-ID:n som avbildas mellan de två " |
| 2866 |
"användarnamnrymderna." |
| 2867 |
|
| 2868 |
#. type: Plain text |
| 2869 |
#: debian-trixie fedora-44 fedora-rawhide |
| 2870 |
msgid "" |
| 2871 |
"The initial user namespace has no parent namespace, but, for consistency, " |
| 2872 |
"the kernel provides dummy user and group ID mapping files for this " |
| 2873 |
"namespace. Looking at the I<uid_map> file (I<gid_map> is the same) from a " |
| 2874 |
"shell in the initial namespace shows:" |
| 2875 |
msgstr "" |
| 2876 |
"Den initiala användarnamnrymden har ingen föräldranamnrymd, men för " |
| 2877 |
"konsistensens skull tillhandahåller kärnan tomfiler för användar- och grupp-" |
| 2878 |
"ID-avbildningar för den namnrymden. Tittar man på filen I<uid_map> " |
| 2879 |
"(I<gid_map> är likadan) från ett skal i den initiala namnrymden ser man:" |
| 2880 |
|
| 2881 |
#. type: Plain text |
| 2882 |
#: debian-trixie fedora-44 fedora-rawhide |
| 2883 |
#, no-wrap |
| 2884 |
msgid "" |
| 2885 |
"$ B<cat /proc/$$/uid_map>\n" |
| 2886 |
" 0 0 4294967295\n" |
| 2887 |
msgstr "" |
| 2888 |
"$ B<cat /proc/$$/uid_map>\n" |
| 2889 |
" 0 0 4294967295\n" |
| 2890 |
|
| 2891 |
# |
| 2892 |
#. ============================================================ |
| 2893 |
#. type: Plain text |
| 2894 |
#: debian-trixie |
| 2895 |
#, fuzzy |
| 2896 |
#| msgid "" |
| 2897 |
#| "This mapping tells us that the range starting at user ID 0 in this " |
| 2898 |
#| "namespace maps to a range starting at 0 in the (nonexistent) parent " |
| 2899 |
#| "namespace, and the length of the range is the largest 32-bit unsigned " |
| 2900 |
#| "integer. This leaves 4294967295 (the 32-bit signed -1 value) unmapped. " |
| 2901 |
#| "This is deliberate: I<(uid_t)\\~-1> is used in several interfaces (e.g., " |
| 2902 |
#| "B<setreuid>(2)) as a way to specify \"no user ID\". Leaving " |
| 2903 |
#| "I<(uid_t)\\~-1> unmapped and unusable guarantees that there will be no " |
| 2904 |
#| "confusion when using these interfaces." |
| 2905 |
msgid "" |
| 2906 |
"This mapping tells us that the range starting at user ID 0 in this namespace " |
| 2907 |
"maps to a range starting at 0 in the (nonexistent) parent namespace, and the " |
| 2908 |
"length of the range is the largest 32-bit unsigned integer. This leaves " |
| 2909 |
"4294967295 (the 32-bit signed -1 value) unmapped. This is deliberate: " |
| 2910 |
"I<(uid_t)\\ -1> is used in several interfaces (e.g., B<setreuid>(2)) as a " |
| 2911 |
"way to specify \"no user ID\". Leaving I<(uid_t)\\ -1> unmapped and " |
| 2912 |
"unusable guarantees that there will be no confusion when using these " |
| 2913 |
"interfaces." |
| 2914 |
msgstr "" |
| 2915 |
"Denna avbildning säger oss att intervallet som startar med användar-ID 0 i " |
| 2916 |
"denna namnrymd översätts till ett intervall som startar med 0 i den " |
| 2917 |
"(obefintliga) föräldranamnrymden, och att längden på intervallet är det " |
| 2918 |
"största 32-bitars teckenlösa heltalet. Detta lämnar 4294967295 (32-" |
| 2919 |
"bitsvärdet -1) oavbildat. Detta är avsiktligt: I<(uid_t)\\~-1> används i " |
| 2920 |
"flera gränssnitt (t.ex., B<setreuid>(2)) som ett sätt att ange ”inget " |
| 2921 |
"användar-ID”. Genom att låta I<(uid_t)\\~-1> vara oavbildat och oanvändbart " |
| 2922 |
"garanteras att det inte kommer uppstå någon förvirring vid användning av " |
| 2923 |
"dessa gränssnitt." |
| 2924 |
|
| 2925 |
#. 5*12-byte records could fit in a 64B cache line |
| 2926 |
#. commit 6397fac4915ab3002dc15aae751455da1a852f25 |
| 2927 |
#. type: Plain text |
| 2928 |
#: debian-trixie fedora-44 fedora-rawhide |
| 2929 |
msgid "" |
| 2930 |
"There is a limit on the number of lines in the file. In Linux 4.14 and " |
| 2931 |
"earlier, this limit was (arbitrarily) set at 5 lines. Since Linux 4.15, " |
| 2932 |
"the limit is 340 lines. In addition, the number of bytes written to the " |
| 2933 |
"file must be less than the system page size, and the write must be performed " |
| 2934 |
"at the start of the file (i.e., B<lseek>(2) and B<pwrite>(2) can't be used " |
| 2935 |
"to write to nonzero offsets in the file)." |
| 2936 |
msgstr "" |
| 2937 |
"Det finns en gräns på antalet rader i filen. I Linux 4.14 och tidigare " |
| 2938 |
"sattes denna gräns (godtyckligt) till 5 rader. Från Linux 4.15 är gränsen " |
| 2939 |
"340 rader. Dessutom måste antalet byte som skrivs till filen vara mindre än " |
| 2940 |
"systemets sidstorlek, och skrivningen måste göras från början av filen (d.v." |
| 2941 |
"s., B<lseek>(2) och B<pwrite>(2) kan inte användas för att skriva till " |
| 2942 |
"nollskilda avstånd in i filen)." |
| 2943 |
|
| 2944 |
#. commit 0bd14b4fd72afd5df41e9fd59f356740f22fceba |
| 2945 |
#. type: Plain text |
| 2946 |
#: debian-trixie fedora-44 fedora-rawhide |
| 2947 |
msgid "" |
| 2948 |
"The range of user IDs (group IDs) specified in each line cannot overlap " |
| 2949 |
"with the ranges in any other lines. In the initial implementation (Linux " |
| 2950 |
"3.8), this requirement was satisfied by a simplistic implementation that " |
| 2951 |
"imposed the further requirement that the values in both field 1 and field 2 " |
| 2952 |
"of successive lines must be in ascending numerical order, which prevented " |
| 2953 |
"some otherwise valid maps from being created. Linux 3.9 and later fix this " |
| 2954 |
"limitation, allowing any valid set of nonoverlapping maps." |
| 2955 |
msgstr "" |
| 2956 |
"Intervallet av användar-ID:n (grupp-ID:n) som anges på varje rad får inte " |
| 2957 |
"överlappa med intervallerna på några andra rader. I den ursprungliga " |
| 2958 |
"implementationen (Linux 3.8) uppfylldes detta krav av en enkel " |
| 2959 |
"implementation som lade till det ytterligare kravet att värdena i både fält " |
| 2960 |
"1 och fält 2 av följande rader måste vara i stigande numerisk ordning, " |
| 2961 |
"vilket förhindrade några eljest giltiga avbildningar från att skapas. Linux " |
| 2962 |
"3.9 och senare fixar denna begränsning, och tillåter alla giltiga " |
| 2963 |
"uppsättningar av avbildningar som inte överlappar." |
| 2964 |
|
| 2965 |
#. type: Plain text |
| 2966 |
#: debian-trixie fedora-44 fedora-rawhide |
| 2967 |
msgid "" |
| 2968 |
"The data written to I<uid_map> (I<gid_map>) must consist of a single line " |
| 2969 |
"that maps the writing process's effective user ID (group ID) in the parent " |
| 2970 |
"user namespace to a user ID (group ID) in the user namespace." |
| 2971 |
msgstr "" |
| 2972 |
"Data som skrivs till I<uid_map> (I<gid_map>) måste bestå av en enda rad som " |
| 2973 |
"avbildar den skrivande processens effektiva användar-ID (grupp-ID) i " |
| 2974 |
"föräldraanvändarnamnrymden till ett användar-ID (grupp-ID) i " |
| 2975 |
"användarnamnrymden." |
| 2976 |
|
| 2977 |
#. type: Plain text |
| 2978 |
#: debian-trixie fedora-44 fedora-rawhide |
| 2979 |
msgid "" |
| 2980 |
"In the case of I<gid_map>, use of the B<setgroups>(2) system call must " |
| 2981 |
"first be denied by writing \\[dq]I<deny>\\[dq] to the I</proc/>pidI</" |
| 2982 |
"setgroups> file (see below) before writing to I<gid_map>." |
| 2983 |
msgstr "" |
| 2984 |
"När det gäller I<gid_map> måste först användning av systemanropet " |
| 2985 |
"B<setgroups>(2) nekas genom att skriva \\[dq]I<deny>\\[dq] till filen I</" |
| 2986 |
"proc/>pidI</setgroups> (se nedan) före någon skrivning till I<gid_map>." |
| 2987 |
|
| 2988 |
#. type: SS |
| 2989 |
#: debian-trixie fedora-44 fedora-rawhide |
| 2990 |
#, no-wrap |
| 2991 |
msgid "The I</proc/>pidI</setgroups> file" |
| 2992 |
msgstr "Filen I</proc/>pidI</setgroups>" |
| 2993 |
|
| 2994 |
#. type: Plain text |
| 2995 |
#: debian-trixie fedora-44 fedora-rawhide |
| 2996 |
msgid "" |
| 2997 |
"A privileged process (one with the B<CAP_SYS_ADMIN> capability in the " |
| 2998 |
"namespace) may write either of the strings \\[dq]I<allow>\\[dq] or " |
| 2999 |
"\\[dq]I<deny>\\[dq] to this file I<before> writing a group ID mapping for " |
| 3000 |
"this user namespace to the file I</proc/>pidI</gid_map>. Writing the string " |
| 3001 |
"\\[dq]I<deny>\\[dq] prevents any process in the user namespace from " |
| 3002 |
"employing B<setgroups>(2)." |
| 3003 |
msgstr "" |
| 3004 |
"En privilegierad process (en med förmågan B<CAP_SYS_ADMIN> i namnrymden) kan " |
| 3005 |
"skriva endera av strängarna \\[dq]I<allow>\\[dq] eller \\[dq]I<deny>\\[dq] " |
| 3006 |
"till denna fil I<före> den skriver en grupp-ID-avbildning för denna " |
| 3007 |
"användarnamnrymd till filen I</proc/>pidI</gid_map>. Att skriva strängen " |
| 3008 |
"\\[dq]I<deny>\\[dq] förhindrar alla processer i användarnamnrymden från att " |
| 3009 |
"använda B<setgroups>(2)." |
| 3010 |
|
| 3011 |
#. type: Plain text |
| 3012 |
#: debian-trixie fedora-44 fedora-rawhide |
| 3013 |
msgid "" |
| 3014 |
"If the I<setgroups> file has the value \\[dq]I<deny>\\[dq], then the " |
| 3015 |
"B<setgroups>(2) system call can't subsequently be reenabled (by writing " |
| 3016 |
"\\[dq]I<allow>\\[dq] to the file) in this user namespace. (Attempts to do " |
| 3017 |
"so fail with the error B<EPERM>.) This restriction also propagates down to " |
| 3018 |
"all child user namespaces of this user namespace." |
| 3019 |
msgstr "" |
| 3020 |
"Om filen I<setgroups> har värdet \\[dq]I<deny>\\[dq], då kan inte senare " |
| 3021 |
"systemanropet B<setgroups>(2) återaktiveras (genom att skriva " |
| 3022 |
"\\[dq]I<allow>\\[dq] till filen) i den användarnamnrymden. (Försök att göra " |
| 3023 |
"så misslyckas med felet B<EPERM>.) Denna begränsning propagerar ner till " |
| 3024 |
"alla barnanvändarnamnrymder till denna användarnamnrymd." |
| 3025 |
|
| 3026 |
# |
| 3027 |
# |
| 3028 |
# |
| 3029 |
# |
| 3030 |
#. /proc/PID/setgroups |
| 3031 |
#. [allow == setgroups() is allowed, "deny" == setgroups() is disallowed] |
| 3032 |
#. * Can write if have CAP_SYS_ADMIN in NS |
| 3033 |
#. * Must write BEFORE writing to /proc/PID/gid_map |
| 3034 |
#. setgroups() |
| 3035 |
#. * Must already have written to gid_map |
| 3036 |
#. * /proc/PID/setgroups must be "allow" |
| 3037 |
#. /proc/PID/gid_map -- writing |
| 3038 |
#. * Must already have written "deny" to /proc/PID/setgroups |
| 3039 |
#. ============================================================ |
| 3040 |
#. type: Plain text |
| 3041 |
#: debian-trixie fedora-44 fedora-rawhide |
| 3042 |
msgid "" |
| 3043 |
"The I</proc/>pidI</setgroups> file was added in Linux 3.19, but was " |
| 3044 |
"backported to many earlier stable kernel series, because it addresses a " |
| 3045 |
"security issue. The issue concerned files with permissions such as \"rwx---" |
| 3046 |
"rwx\". Such files give fewer permissions to \"group\" than they do to " |
| 3047 |
"\"other\". This means that dropping groups using B<setgroups>(2) might " |
| 3048 |
"allow a process file access that it did not formerly have. Before the " |
| 3049 |
"existence of user namespaces this was not a concern, since only a privileged " |
| 3050 |
"process (one with the B<CAP_SETGID> capability) could call B<setgroups>(2). " |
| 3051 |
"However, with the introduction of user namespaces, it became possible for an " |
| 3052 |
"unprivileged process to create a new namespace in which the user had all " |
| 3053 |
"privileges. This then allowed formerly unprivileged users to drop groups " |
| 3054 |
"and thus gain file access that they did not previously have. The I</proc/" |
| 3055 |
">pidI</setgroups> file was added to address this security issue, by denying " |
| 3056 |
"any pathway for an unprivileged process to drop groups with B<setgroups>(2)." |
| 3057 |
msgstr "" |
| 3058 |
"Filen I</proc/>pidI</setgroups> lades till i Linux 3.19, men bakåtporterades " |
| 3059 |
"till många tidigare stabila kärnserier, eftersom den åtgärdar ett " |
| 3060 |
"säkerhetsproblem. Problemet rörde filer med rättigheter såsom ”rwx---rwx”. " |
| 3061 |
"Sådana filer ger färre rättigheter till ”gruppen” än de gör till ”övriga”. " |
| 3062 |
"Detta betyder att genom att släppa grupper med B<setgroups>(2) kan en " |
| 3063 |
"process tillåtas filåtkomst som den inte tidigare hade. Före det fanns " |
| 3064 |
"användarnamnrymder var detta inte ett bekymmer, eftersom endast en " |
| 3065 |
"privilegierad process (en med förmågan B<CAP_SETGID>) kunde anropa " |
| 3066 |
"B<setgroups>(2). Dock, med introduktionen av användarnamnrymder blev det " |
| 3067 |
"möjligt för en oprivilegierad process att skapa en ny namnrymd i vilken " |
| 3068 |
"användaren har alla privilegier. Detta tillät sedan tidigare oprivilegierade " |
| 3069 |
"användare att släppa grupprivilegier och därmed få filåtkomst som de inte " |
| 3070 |
"tidigare hade. Filen I</proc/>pidI</setgroups> lades till för att åtgärda " |
| 3071 |
"detta säkerhetsproblem, genom att neka alla vägar för en oprivilegierad " |
| 3072 |
"process att släppa grupper med B<setgroups>(2)." |
| 3073 |
|
| 3074 |
#. type: Plain text |
| 3075 |
#: debian-trixie fedora-44 fedora-rawhide |
| 3076 |
#, no-wrap |
| 3077 |
msgid "" |
| 3078 |
"$ B<uname -rs> # Need Linux 3.8 or later\n" |
| 3079 |
"Linux 3.8.0\n" |
| 3080 |
"$ B<id -u> # Running as unprivileged user\n" |
| 3081 |
"1000\n" |
| 3082 |
"$ B<id -g>\n" |
| 3083 |
"1000\n" |
| 3084 |
msgstr "" |
| 3085 |
"$ B<uname -rs> # Förutsätter Linux 3.8 eller senare\n" |
| 3086 |
"Linux 3.8.0\n" |
| 3087 |
"$ B<id -u> # Kör som en oprivilegierad användare\n" |
| 3088 |
"1000\n" |
| 3089 |
"$ B<id -g>\n" |
| 3090 |
"1000\n" |
| 3091 |
|
| 3092 |
#. type: Plain text |
| 3093 |
#: debian-trixie fedora-44 fedora-rawhide |
| 3094 |
#, no-wrap |
| 3095 |
msgid "$ B<./userns_child_exec -p -m -U -M \\[aq]0 1000 1\\[aq] -G \\[aq]0 1000 1\\[aq] bash>\n" |
| 3096 |
msgstr "$ B<./userns_child_exec -p -m -U -M \\[aq]0 1000 1\\[aq] -G \\[aq]0 1000 1\\[aq] bash>\n" |
| 3097 |
|
| 3098 |
#. type: Plain text |
| 3099 |
#: debian-trixie fedora-44 fedora-rawhide |
| 3100 |
#, no-wrap |
| 3101 |
msgid "" |
| 3102 |
"bash$ B<echo $$>\n" |
| 3103 |
"1\n" |
| 3104 |
msgstr "" |
| 3105 |
"bash$ B<echo $$>\n" |
| 3106 |
"1\n" |
| 3107 |
|
| 3108 |
#. type: Plain text |
| 3109 |
#: debian-trixie fedora-44 fedora-rawhide |
| 3110 |
#, no-wrap |
| 3111 |
msgid "" |
| 3112 |
"bash$ B<mount -t proc proc /proc>\n" |
| 3113 |
"bash$ B<ps ax>\n" |
| 3114 |
" PID TTY STAT TIME COMMAND\n" |
| 3115 |
" 1 pts/3 S 0:00 bash\n" |
| 3116 |
" 22 pts/3 R+ 0:00 ps ax\n" |
| 3117 |
msgstr "" |
| 3118 |
"bash$ B<mount -t proc proc /proc>\n" |
| 3119 |
"bash$ B<ps ax>\n" |
| 3120 |
" PID TTY STAT TIME COMMAND\n" |
| 3121 |
" 1 pts/3 S 0:00 bash\n" |
| 3122 |
" 22 pts/3 R+ 0:00 ps ax\n" |
| 3123 |
|
| 3124 |
#. type: Plain text |
| 3125 |
#: debian-trixie fedora-44 fedora-rawhide |
| 3126 |
#, no-wrap |
| 3127 |
msgid "" |
| 3128 |
"bash$ B<cat /proc/$$/status | egrep \\[aq]\\[ha][UG]id\\[aq]>\n" |
| 3129 |
"Uid:\t0\t0\t0\t0\n" |
| 3130 |
"Gid:\t0\t0\t0\t0\n" |
| 3131 |
"bash$ B<cat /proc/$$/status | egrep \\[aq]\\[ha]Cap(Prm|Inh|Eff)\\[aq]>\n" |
| 3132 |
"CapInh:\t0000000000000000\n" |
| 3133 |
"CapPrm:\t0000001fffffffff\n" |
| 3134 |
"CapEff:\t0000001fffffffff\n" |
| 3135 |
msgstr "" |
| 3136 |
"bash$ B<cat /proc/$$/status | egrep \\[aq]\\[ha][UG]id\\[aq]>\n" |
| 3137 |
"Uid:\t0\t0\t0\t0\n" |
| 3138 |
"Gid:\t0\t0\t0\t0\n" |
| 3139 |
"bash$ B<cat /proc/$$/status | egrep \\[aq]\\[ha]Cap(Prm|Inh|Eff)\\[aq]>\n" |
| 3140 |
"CapInh:\t0000000000000000\n" |
| 3141 |
"CapPrm:\t0000001fffffffff\n" |
| 3142 |
"CapEff:\t0000001fffffffff\n" |
| 3143 |
|
| 3144 |
#. type: Plain text |
| 3145 |
#: debian-trixie |
| 3146 |
#, no-wrap |
| 3147 |
msgid "" |
| 3148 |
"/* userns_child_exec.c\n" |
| 3149 |
"\\&\n" |
| 3150 |
" Licensed under GNU General Public License v2 or later\n" |
| 3151 |
"\\&\n" |
| 3152 |
" Create a child process that executes a shell command in new\n" |
| 3153 |
" namespace(s); allow UID and GID mappings to be specified when\n" |
| 3154 |
" creating a user namespace.\n" |
| 3155 |
"*/\n" |
| 3156 |
"#define _GNU_SOURCE\n" |
| 3157 |
"#include E<lt>err.hE<gt>\n" |
| 3158 |
"#include E<lt>sched.hE<gt>\n" |
| 3159 |
"#include E<lt>unistd.hE<gt>\n" |
| 3160 |
"#include E<lt>stdint.hE<gt>\n" |
| 3161 |
"#include E<lt>stdlib.hE<gt>\n" |
| 3162 |
"#include E<lt>sys/wait.hE<gt>\n" |
| 3163 |
"#include E<lt>signal.hE<gt>\n" |
| 3164 |
"#include E<lt>fcntl.hE<gt>\n" |
| 3165 |
"#include E<lt>stdio.hE<gt>\n" |
| 3166 |
"#include E<lt>string.hE<gt>\n" |
| 3167 |
"#include E<lt>limits.hE<gt>\n" |
| 3168 |
"#include E<lt>errno.hE<gt>\n" |
| 3169 |
"\\&\n" |
| 3170 |
"struct child_args {\n" |
| 3171 |
" char **argv; /* Command to be executed by child, with args */\n" |
| 3172 |
" int pipe_fd[2]; /* Pipe used to synchronize parent and child */\n" |
| 3173 |
"};\n" |
| 3174 |
"\\&\n" |
| 3175 |
"static int verbose;\n" |
| 3176 |
"\\&\n" |
| 3177 |
"static void\n" |
| 3178 |
"usage(char *pname)\n" |
| 3179 |
"{\n" |
| 3180 |
" fprintf(stderr, \"Usage: %s [options] cmd [arg...]\\[rs]n\\[rs]n\", pname);\n" |
| 3181 |
" fprintf(stderr, \"Create a child process that executes a shell \"\n" |
| 3182 |
" \"command in a new user namespace,\\[rs]n\"\n" |
| 3183 |
" \"and possibly also other new namespace(s).\\[rs]n\\[rs]n\");\n" |
| 3184 |
" fprintf(stderr, \"Options can be:\\[rs]n\\[rs]n\");\n" |
| 3185 |
"#define fpe(str) fprintf(stderr, \" %s\", str);\n" |
| 3186 |
" fpe(\"-i New IPC namespace\\[rs]n\");\n" |
| 3187 |
" fpe(\"-m New mount namespace\\[rs]n\");\n" |
| 3188 |
" fpe(\"-n New network namespace\\[rs]n\");\n" |
| 3189 |
" fpe(\"-p New PID namespace\\[rs]n\");\n" |
| 3190 |
" fpe(\"-u New UTS namespace\\[rs]n\");\n" |
| 3191 |
" fpe(\"-U New user namespace\\[rs]n\");\n" |
| 3192 |
" fpe(\"-M uid_map Specify UID map for user namespace\\[rs]n\");\n" |
| 3193 |
" fpe(\"-G gid_map Specify GID map for user namespace\\[rs]n\");\n" |
| 3194 |
" fpe(\"-z Map user\\[aq]s UID and GID to 0 in user namespace\\[rs]n\");\n" |
| 3195 |
" fpe(\" (equivalent to: -M \\[aq]0 E<lt>uidE<gt> 1\\[aq] -G \\[aq]0 E<lt>gidE<gt> 1\\[aq])\\[rs]n\");\n" |
| 3196 |
" fpe(\"-v Display verbose messages\\[rs]n\");\n" |
| 3197 |
" fpe(\"\\[rs]n\");\n" |
| 3198 |
" fpe(\"If -z, -M, or -G is specified, -U is required.\\[rs]n\");\n" |
| 3199 |
" fpe(\"It is not permitted to specify both -z and either -M or -G.\\[rs]n\");\n" |
| 3200 |
" fpe(\"\\[rs]n\");\n" |
| 3201 |
" fpe(\"Map strings for -M and -G consist of records of the form:\\[rs]n\");\n" |
| 3202 |
" fpe(\"\\[rs]n\");\n" |
| 3203 |
" fpe(\" ID-inside-ns ID-outside-ns len\\[rs]n\");\n" |
| 3204 |
" fpe(\"\\[rs]n\");\n" |
| 3205 |
" fpe(\"A map string can contain multiple records, separated\"\n" |
| 3206 |
" \" by commas;\\[rs]n\");\n" |
| 3207 |
" fpe(\"the commas are replaced by newlines before writing\"\n" |
| 3208 |
" \" to map files.\\[rs]n\");\n" |
| 3209 |
"\\&\n" |
| 3210 |
" exit(EXIT_FAILURE);\n" |
| 3211 |
"}\n" |
| 3212 |
"\\&\n" |
| 3213 |
"/* Update the mapping file \\[aq]map_file\\[aq], with the value provided in\n" |
| 3214 |
" \\[aq]mapping\\[aq], a string that defines a UID or GID mapping. A UID or\n" |
| 3215 |
" GID mapping consists of one or more newline-delimited records\n" |
| 3216 |
" of the form:\n" |
| 3217 |
"\\&\n" |
| 3218 |
" ID_inside-ns ID-outside-ns length\n" |
| 3219 |
"\\&\n" |
| 3220 |
" Requiring the user to supply a string that contains newlines is\n" |
| 3221 |
" of course inconvenient for command-line use. Thus, we permit the\n" |
| 3222 |
" use of commas to delimit records in this string, and replace them\n" |
| 3223 |
" with newlines before writing the string to the file. */\n" |
| 3224 |
"\\&\n" |
| 3225 |
"static void\n" |
| 3226 |
"update_map(char *mapping, char *map_file)\n" |
| 3227 |
"{\n" |
| 3228 |
" int fd;\n" |
| 3229 |
" size_t map_len; /* Length of \\[aq]mapping\\[aq] */\n" |
| 3230 |
"\\&\n" |
| 3231 |
" /* Replace commas in mapping string with newlines. */\n" |
| 3232 |
"\\&\n" |
| 3233 |
" map_len = strlen(mapping);\n" |
| 3234 |
" for (size_t j = 0; j E<lt> map_len; j++)\n" |
| 3235 |
" if (mapping[j] == \\[aq],\\[aq])\n" |
| 3236 |
" mapping[j] = \\[aq]\\[rs]n\\[aq];\n" |
| 3237 |
"\\&\n" |
| 3238 |
" fd = open(map_file, O_RDWR);\n" |
| 3239 |
" if (fd == -1) {\n" |
| 3240 |
" fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", map_file,\n" |
| 3241 |
" strerror(errno));\n" |
| 3242 |
" exit(EXIT_FAILURE);\n" |
| 3243 |
" }\n" |
| 3244 |
"\\&\n" |
| 3245 |
" if (write(fd, mapping, map_len) != map_len) {\n" |
| 3246 |
" fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", map_file,\n" |
| 3247 |
" strerror(errno));\n" |
| 3248 |
" exit(EXIT_FAILURE);\n" |
| 3249 |
" }\n" |
| 3250 |
"\\&\n" |
| 3251 |
" close(fd);\n" |
| 3252 |
"}\n" |
| 3253 |
"\\&\n" |
| 3254 |
"/* Linux 3.19 made a change in the handling of setgroups(2) and\n" |
| 3255 |
" the \\[aq]gid_map\\[aq] file to address a security issue. The issue\n" |
| 3256 |
" allowed *unprivileged* users to employ user namespaces in\n" |
| 3257 |
" order to drop groups. The upshot of the 3.19 changes is that\n" |
| 3258 |
" in order to update the \\[aq]gid_maps\\[aq] file, use of the setgroups()\n" |
| 3259 |
" system call in this user namespace must first be disabled by\n" |
| 3260 |
" writing \"deny\" to one of the /proc/PID/setgroups files for\n" |
| 3261 |
" this namespace. That is the purpose of the following function. */\n" |
| 3262 |
"\\&\n" |
| 3263 |
"static void\n" |
| 3264 |
"proc_setgroups_write(pid_t child_pid, char *str)\n" |
| 3265 |
"{\n" |
| 3266 |
" char setgroups_path[PATH_MAX];\n" |
| 3267 |
" int fd;\n" |
| 3268 |
"\\&\n" |
| 3269 |
" snprintf(setgroups_path, PATH_MAX, \"/proc/%jd/setgroups\",\n" |
| 3270 |
" (intmax_t) child_pid);\n" |
| 3271 |
"\\&\n" |
| 3272 |
" fd = open(setgroups_path, O_RDWR);\n" |
| 3273 |
" if (fd == -1) {\n" |
| 3274 |
"\\&\n" |
| 3275 |
" /* We may be on a system that doesn\\[aq]t support\n" |
| 3276 |
" /proc/PID/setgroups. In that case, the file won\\[aq]t exist,\n" |
| 3277 |
" and the system won\\[aq]t impose the restrictions that Linux 3.19\n" |
| 3278 |
" added. That\\[aq]s fine: we don\\[aq]t need to do anything in order\n" |
| 3279 |
" to permit \\[aq]gid_map\\[aq] to be updated.\n" |
| 3280 |
"\\&\n" |
| 3281 |
" However, if the error from open() was something other than\n" |
| 3282 |
" the ENOENT error that is expected for that case, let the\n" |
| 3283 |
" user know. */\n" |
| 3284 |
"\\&\n" |
| 3285 |
" if (errno != ENOENT)\n" |
| 3286 |
" fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", setgroups_path,\n" |
| 3287 |
" strerror(errno));\n" |
| 3288 |
" return;\n" |
| 3289 |
" }\n" |
| 3290 |
"\\&\n" |
| 3291 |
" if (write(fd, str, strlen(str)) == -1)\n" |
| 3292 |
" fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", setgroups_path,\n" |
| 3293 |
" strerror(errno));\n" |
| 3294 |
"\\&\n" |
| 3295 |
" close(fd);\n" |
| 3296 |
"}\n" |
| 3297 |
"\\&\n" |
| 3298 |
"static int /* Start function for cloned child */\n" |
| 3299 |
"childFunc(void *arg)\n" |
| 3300 |
"{\n" |
| 3301 |
" struct child_args *args = arg;\n" |
| 3302 |
" char ch;\n" |
| 3303 |
"\\&\n" |
| 3304 |
" /* Wait until the parent has updated the UID and GID mappings.\n" |
| 3305 |
" See the comment in main(). We wait for end of file on a\n" |
| 3306 |
" pipe that will be closed by the parent process once it has\n" |
| 3307 |
" updated the mappings. */\n" |
| 3308 |
"\\&\n" |
| 3309 |
" close(args-E<gt>pipe_fd[1]); /* Close our descriptor for the write\n" |
| 3310 |
" end of the pipe so that we see EOF\n" |
| 3311 |
" when parent closes its descriptor. */\n" |
| 3312 |
" if (read(args-E<gt>pipe_fd[0], &ch, 1) != 0) {\n" |
| 3313 |
" fprintf(stderr,\n" |
| 3314 |
" \"Failure in child: read from pipe returned != 0\\[rs]n\");\n" |
| 3315 |
" exit(EXIT_FAILURE);\n" |
| 3316 |
" }\n" |
| 3317 |
"\\&\n" |
| 3318 |
" close(args-E<gt>pipe_fd[0]);\n" |
| 3319 |
"\\&\n" |
| 3320 |
" /* Execute a shell command. */\n" |
| 3321 |
"\\&\n" |
| 3322 |
" printf(\"About to exec %s\\[rs]n\", args-E<gt>argv[0]);\n" |
| 3323 |
" execvp(args-E<gt>argv[0], args-E<gt>argv);\n" |
| 3324 |
" err(EXIT_FAILURE, \"execvp\");\n" |
| 3325 |
"}\n" |
| 3326 |
"\\&\n" |
| 3327 |
"#define STACK_SIZE (1024 * 1024)\n" |
| 3328 |
"\\&\n" |
| 3329 |
"static char child_stack[STACK_SIZE]; /* Space for child\\[aq]s stack */\n" |
| 3330 |
"\\&\n" |
| 3331 |
"int\n" |
| 3332 |
"main(int argc, char *argv[])\n" |
| 3333 |
"{\n" |
| 3334 |
" int flags, opt, map_zero;\n" |
| 3335 |
" pid_t child_pid;\n" |
| 3336 |
" struct child_args args;\n" |
| 3337 |
" char *uid_map, *gid_map;\n" |
| 3338 |
" const int MAP_BUF_SIZE = 100;\n" |
| 3339 |
" char map_buf[MAP_BUF_SIZE];\n" |
| 3340 |
" char map_path[PATH_MAX];\n" |
| 3341 |
"\\&\n" |
| 3342 |
" /* Parse command-line options. The initial \\[aq]+\\[aq] character in\n" |
| 3343 |
" the final getopt() argument prevents GNU-style permutation\n" |
| 3344 |
" of command-line options. That\\[aq]s useful, since sometimes\n" |
| 3345 |
" the \\[aq]command\\[aq] to be executed by this program itself\n" |
| 3346 |
" has command-line options. We don\\[aq]t want getopt() to treat\n" |
| 3347 |
" those as options to this program. */\n" |
| 3348 |
"\\&\n" |
| 3349 |
" flags = 0;\n" |
| 3350 |
" verbose = 0;\n" |
| 3351 |
" gid_map = NULL;\n" |
| 3352 |
" uid_map = NULL;\n" |
| 3353 |
" map_zero = 0;\n" |
| 3354 |
" while ((opt = getopt(argc, argv, \"+imnpuUM:G:zv\")) != -1) {\n" |
| 3355 |
" switch (opt) {\n" |
| 3356 |
" case \\[aq]i\\[aq]: flags |= CLONE_NEWIPC; break;\n" |
| 3357 |
" case \\[aq]m\\[aq]: flags |= CLONE_NEWNS; break;\n" |
| 3358 |
" case \\[aq]n\\[aq]: flags |= CLONE_NEWNET; break;\n" |
| 3359 |
" case \\[aq]p\\[aq]: flags |= CLONE_NEWPID; break;\n" |
| 3360 |
" case \\[aq]u\\[aq]: flags |= CLONE_NEWUTS; break;\n" |
| 3361 |
" case \\[aq]v\\[aq]: verbose = 1; break;\n" |
| 3362 |
" case \\[aq]z\\[aq]: map_zero = 1; break;\n" |
| 3363 |
" case \\[aq]M\\[aq]: uid_map = optarg; break;\n" |
| 3364 |
" case \\[aq]G\\[aq]: gid_map = optarg; break;\n" |
| 3365 |
" case \\[aq]U\\[aq]: flags |= CLONE_NEWUSER; break;\n" |
| 3366 |
" default: usage(argv[0]);\n" |
| 3367 |
" }\n" |
| 3368 |
" }\n" |
| 3369 |
"\\&\n" |
| 3370 |
" /* -M or -G without -U is nonsensical */\n" |
| 3371 |
"\\&\n" |
| 3372 |
" if (((uid_map != NULL || gid_map != NULL || map_zero) &&\n" |
| 3373 |
" !(flags & CLONE_NEWUSER)) ||\n" |
| 3374 |
" (map_zero && (uid_map != NULL || gid_map != NULL)))\n" |
| 3375 |
" usage(argv[0]);\n" |
| 3376 |
"\\&\n" |
| 3377 |
" args.argv = &argv[optind];\n" |
| 3378 |
"\\&\n" |
| 3379 |
" /* We use a pipe to synchronize the parent and child, in order to\n" |
| 3380 |
" ensure that the parent sets the UID and GID maps before the child\n" |
| 3381 |
" calls execve(). This ensures that the child maintains its\n" |
| 3382 |
" capabilities during the execve() in the common case where we\n" |
| 3383 |
" want to map the child\\[aq]s effective user ID to 0 in the new user\n" |
| 3384 |
" namespace. Without this synchronization, the child would lose\n" |
| 3385 |
" its capabilities if it performed an execve() with nonzero\n" |
| 3386 |
" user IDs (see the capabilities(7) man page for details of the\n" |
| 3387 |
" transformation of a process\\[aq]s capabilities during execve()). */\n" |
| 3388 |
"\\&\n" |
| 3389 |
" if (pipe(args.pipe_fd) == -1)\n" |
| 3390 |
" err(EXIT_FAILURE, \"pipe\");\n" |
| 3391 |
"\\&\n" |
| 3392 |
" /* Create the child in new namespace(s). */\n" |
| 3393 |
"\\&\n" |
| 3394 |
" child_pid = clone(childFunc, child_stack + STACK_SIZE,\n" |
| 3395 |
" flags | SIGCHLD, &args);\n" |
| 3396 |
" if (child_pid == -1)\n" |
| 3397 |
" err(EXIT_FAILURE, \"clone\");\n" |
| 3398 |
"\\&\n" |
| 3399 |
" /* Parent falls through to here. */\n" |
| 3400 |
"\\&\n" |
| 3401 |
" if (verbose)\n" |
| 3402 |
" printf(\"%s: PID of child created by clone() is %jd\\[rs]n\",\n" |
| 3403 |
" argv[0], (intmax_t) child_pid);\n" |
| 3404 |
"\\&\n" |
| 3405 |
" /* Update the UID and GID maps in the child. */\n" |
| 3406 |
"\\&\n" |
| 3407 |
" if (uid_map != NULL || map_zero) {\n" |
| 3408 |
" snprintf(map_path, PATH_MAX, \"/proc/%jd/uid_map\",\n" |
| 3409 |
" (intmax_t) child_pid);\n" |
| 3410 |
" if (map_zero) {\n" |
| 3411 |
" snprintf(map_buf, MAP_BUF_SIZE, \"0 %jd 1\",\n" |
| 3412 |
" (intmax_t) getuid());\n" |
| 3413 |
" uid_map = map_buf;\n" |
| 3414 |
" }\n" |
| 3415 |
" update_map(uid_map, map_path);\n" |
| 3416 |
" }\n" |
| 3417 |
"\\&\n" |
| 3418 |
" if (gid_map != NULL || map_zero) {\n" |
| 3419 |
" proc_setgroups_write(child_pid, \"deny\");\n" |
| 3420 |
"\\&\n" |
| 3421 |
" snprintf(map_path, PATH_MAX, \"/proc/%jd/gid_map\",\n" |
| 3422 |
" (intmax_t) child_pid);\n" |
| 3423 |
" if (map_zero) {\n" |
| 3424 |
" snprintf(map_buf, MAP_BUF_SIZE, \"0 %ld 1\",\n" |
| 3425 |
" (intmax_t) getgid());\n" |
| 3426 |
" gid_map = map_buf;\n" |
| 3427 |
" }\n" |
| 3428 |
" update_map(gid_map, map_path);\n" |
| 3429 |
" }\n" |
| 3430 |
"\\&\n" |
| 3431 |
" /* Close the write end of the pipe, to signal to the child that we\n" |
| 3432 |
" have updated the UID and GID maps. */\n" |
| 3433 |
"\\&\n" |
| 3434 |
" close(args.pipe_fd[1]);\n" |
| 3435 |
"\\&\n" |
| 3436 |
" if (waitpid(child_pid, NULL, 0) == -1) /* Wait for child */\n" |
| 3437 |
" err(EXIT_FAILURE, \"waitpid\");\n" |
| 3438 |
"\\&\n" |
| 3439 |
" if (verbose)\n" |
| 3440 |
" printf(\"%s: terminating\\[rs]n\", argv[0]);\n" |
| 3441 |
"\\&\n" |
| 3442 |
" exit(EXIT_SUCCESS);\n" |
| 3443 |
"}\n" |
| 3444 |
msgstr "" |
| 3445 |
"/* userns_child_exec.c\n" |
| 3446 |
"\\&\n" |
| 3447 |
" Licensed under GNU General Public License v2 or later\n" |
| 3448 |
"\\&\n" |
| 3449 |
" Skapa en barnprocess som kör ett skalkommando i nya namnrymder;\n" |
| 3450 |
" låt UID- och GID-avbildningar anges när en användarnamnrymd\n" |
| 3451 |
" skapas.\n" |
| 3452 |
"*/\n" |
| 3453 |
"#define _GNU_SOURCE\n" |
| 3454 |
"#include E<lt>err.hE<gt>\n" |
| 3455 |
"#include E<lt>sched.hE<gt>\n" |
| 3456 |
"#include E<lt>unistd.hE<gt>\n" |
| 3457 |
"#include E<lt>stdint.hE<gt>\n" |
| 3458 |
"#include E<lt>stdlib.hE<gt>\n" |
| 3459 |
"#include E<lt>sys/wait.hE<gt>\n" |
| 3460 |
"#include E<lt>signal.hE<gt>\n" |
| 3461 |
"#include E<lt>fcntl.hE<gt>\n" |
| 3462 |
"#include E<lt>stdio.hE<gt>\n" |
| 3463 |
"#include E<lt>string.hE<gt>\n" |
| 3464 |
"#include E<lt>limits.hE<gt>\n" |
| 3465 |
"#include E<lt>errno.hE<gt>\n" |
| 3466 |
"\\&\n" |
| 3467 |
"struct child_args {\n" |
| 3468 |
" char **argv; /* Kommando att köras av barnet, med argument */\n" |
| 3469 |
" int pipe_fd[2]; /* Rör använt för att synkronisera förälder och barn */\n" |
| 3470 |
"};\n" |
| 3471 |
"\\&\n" |
| 3472 |
"static int verbose;\n" |
| 3473 |
"\\&\n" |
| 3474 |
"static void\n" |
| 3475 |
"usage(char *pname)\n" |
| 3476 |
"{\n" |
| 3477 |
" fprintf(stderr, \"Användning: %s [flaggor] kmd [arg…]\\[rs]n\\[rs]n\", pname);\n" |
| 3478 |
" fprintf(stderr, \"Skapa en barnprocess som kör ett skalkommando i \"\n" |
| 3479 |
" \"en ny användarnamnrymd,\\[rs]n\"\n" |
| 3480 |
" \"och eventuellt även andra nya namnrymder.\\[rs]n\\[rs]n\");\n" |
| 3481 |
" fprintf(stderr, \"Flaggor kan vara:\\[rs]n\\[rs]n\");\n" |
| 3482 |
"#define fpe(str) fprintf(stderr, \" %s\", str);\n" |
| 3483 |
" fpe(\"-i Ny IPC-namnrymd\\[rs]n\");\n" |
| 3484 |
" fpe(\"-m Ny monteringsnamnrymd\\[rs]n\");\n" |
| 3485 |
" fpe(\"-n Ny nätverksnamnrymd\\[rs]n\");\n" |
| 3486 |
" fpe(\"-p Ny PID-namnrymd\\[rs]n\");\n" |
| 3487 |
" fpe(\"-u Ny UTS-namnrymd\\[rs]n\");\n" |
| 3488 |
" fpe(\"-U Ny användarnamnrymd\\[rs]n\");\n" |
| 3489 |
" fpe(\"-M uid_map Ange AID-avbildning för användarnamnrymden\\[rs]n\");\n" |
| 3490 |
" fpe(\"-G gid_map Ange GID-avbildning för användarnamnrymden\\[rs]n\");\n" |
| 3491 |
" fpe(\"-z Avbilda användar-AID och -GID till 0 i användarnamnrymden\\[rs]n\");\n" |
| 3492 |
" fpe(\" (ekvivalent med: -M \\[aq]0 E<lt>aidE<gt> 1\\[aq] -G \\[aq]0 E<lt>gidE<gt> 1\\[aq])\\[rs]n\");\n" |
| 3493 |
" fpe(\"-v Visa utförliga meddelanden\\[rs]n\");\n" |
| 3494 |
" fpe(\"\\[rs]n\");\n" |
| 3495 |
" fpe(\"Om -z, -M eller -G anges är -U nödvändigt.\\[rs]n\");\n" |
| 3496 |
" fpe(\"Det är inte tillåtet att ange både -z och någon av -M eller -G.\\[rs]n\");\n" |
| 3497 |
" fpe(\"\\[rs]n\");\n" |
| 3498 |
" fpe(\"Avbildningssträngar för -M och -G består av poster på formen:\\[rs]n\");\n" |
| 3499 |
" fpe(\"\\[rs]n\");\n" |
| 3500 |
" fpe(\" ID-inuti-nr ID-utanför-nr längd\\[rs]n\");\n" |
| 3501 |
" fpe(\"\\[rs]n\");\n" |
| 3502 |
" fpe(\"En avbildningssträng kan innehålla flera poster, separerade\"\n" |
| 3503 |
" \" av komman;\\[rs]n\");\n" |
| 3504 |
" fpe(\"kommatecknen ersätts med nyrader före skrivning\"\n" |
| 3505 |
" \" till avbildningsfiler.\\[rs]n\");\n" |
| 3506 |
"\\&\n" |
| 3507 |
" exit(EXIT_FAILURE);\n" |
| 3508 |
"}\n" |
| 3509 |
"\\&\n" |
| 3510 |
"/* Uppdatera avbildningsfilen \\[aq]map_fil\\[aq], med värdena som ges i\n" |
| 3511 |
" \\[aq]avbildning\\[aq], en sträng som definierar en AID- eller GID-avbildning.\n" |
| 3512 |
" En AID- eller GID-avbildning består av en eller flera nyradsavgränsade poster\n" |
| 3513 |
" på formen:\n" |
| 3514 |
"\\&\n" |
| 3515 |
" ID_inuti-nr ID-utanför-nr längd\n" |
| 3516 |
"\\&\n" |
| 3517 |
" Att begära att användaren skall ge en sträng som innehåller nyrader är\n" |
| 3518 |
" naturligtvis opraktiskt för kommandoradsanvändning. Därför tillåter vi\n" |
| 3519 |
" användningen av komman för att avgränsa poster i denna sträng, och\n" |
| 3520 |
" ersätter dem med nyrader före vi skriver strängen till filen. */\"\n" |
| 3521 |
"\\&\n" |
| 3522 |
"static void\n" |
| 3523 |
"update_map(char *mapping, char *map_file)\n" |
| 3524 |
"{\n" |
| 3525 |
" int fd;\n" |
| 3526 |
" size_t map_len; /* Längden på \\\\[aq]avbildning\\\\[aq] */\n" |
| 3527 |
"\\&\n" |
| 3528 |
" /* Ersätt kommatecken i avbildningssträngar med nyrader. */\n" |
| 3529 |
"\\&\n" |
| 3530 |
" map_len = strlen(mapping);\n" |
| 3531 |
" for (size_t j = 0; j E<lt> map_len; j++)\n" |
| 3532 |
" if (mapping[j] == \\[aq],\\[aq])\n" |
| 3533 |
" mapping[j] = \\[aq]\\[rs]n\\[aq];\n" |
| 3534 |
"\\&\n" |
| 3535 |
" fd = open(map_file, O_RDWR);\n" |
| 3536 |
" if (fd == -1) {\n" |
| 3537 |
" fprintf(stderr, \"FEL: open %s: %s\\[rs]n\", map_file,\n" |
| 3538 |
" strerror(errno));\n" |
| 3539 |
" exit(EXIT_FAILURE);\n" |
| 3540 |
" }\n" |
| 3541 |
"\\&\n" |
| 3542 |
" if (write(fd, mapping, map_len) != map_len) {\n" |
| 3543 |
" fprintf(stderr, \"FEL: write %s: %s\\[rs]n\", map_file,\n" |
| 3544 |
" strerror(errno));\n" |
| 3545 |
" exit(EXIT_FAILURE);\n" |
| 3546 |
" }\n" |
| 3547 |
"\\&\n" |
| 3548 |
" close(fd);\n" |
| 3549 |
"}\n" |
| 3550 |
"\\&\n" |
| 3551 |
"/* Linux 3.19 gjorde en ändring av hanteringen av setgroups(2) och filen\n" |
| 3552 |
" \\[aq]gid_map\\[aq] för att åtgärda ett säkerhetsproblem. Problemet tillät\n" |
| 3553 |
" *oprivilegierade* användare att nyttja användarnamnrymder för att släppa\n" |
| 3554 |
" grupper. Följden av ändringarna i 3.19 är att för att uppdatera filen\n" |
| 3555 |
" \\[aq]gid_maps\\[aq] måste först användning av systemanropet setgroups()\n" |
| 3556 |
" i denna användarnamnrymd avaktiveras genom att skriva \"deny\" till en\n" |
| 3557 |
" av filerna /proc/PID/setgroups för denna namnrymd. Det är syftet med\n" |
| 3558 |
" följande funktion. */\n" |
| 3559 |
"\\&\n" |
| 3560 |
"static void\n" |
| 3561 |
"proc_setgroups_write(pid_t child_pid, char *str)\n" |
| 3562 |
"{\n" |
| 3563 |
" char setgroups_path[PATH_MAX];\n" |
| 3564 |
" int fd;\n" |
| 3565 |
"\\&\n" |
| 3566 |
" snprintf(setgroups_path, PATH_MAX, \"/proc/%jd/setgroups\",\n" |
| 3567 |
" (intmax_t) child_pid);\n" |
| 3568 |
"\\&\n" |
| 3569 |
" fd = open(setgroups_path, O_RDWR);\n" |
| 3570 |
" if (fd == -1) {\n" |
| 3571 |
"\\&\n" |
| 3572 |
" /* Vi kan vara på ett system som inte stödjer /proc/PID/setgroups.\n" |
| 3573 |
" I det fallet kommer filen inte att finnas, och systemet kommer\n" |
| 3574 |
" inte att påtvinga begränsningarna som Linux 3.19 lade till. Det\n" |
| 3575 |
" är bra så: vi behöver inte göra något för att tillåta att\n" |
| 3576 |
" \\[aq]gid_map\\[aq] uppdateras.\n" |
| 3577 |
"\\&\n" |
| 3578 |
" Dock, om felet från open() var något annat än felet ENOENT\n" |
| 3579 |
" som förväntas i det fallet, tala om det för användaren. */\n" |
| 3580 |
"\\&\n" |
| 3581 |
" if (errno != ENOENT)\n" |
| 3582 |
" fprintf(stderr, \"FEL: open %s: %s\\[rs]n\", setgroups_path,\n" |
| 3583 |
" strerror(errno));\n" |
| 3584 |
" return;\n" |
| 3585 |
" }\n" |
| 3586 |
"\\&\n" |
| 3587 |
" if (write(fd, str, strlen(str)) == -1)\n" |
| 3588 |
" fprintf(stderr, \"FEL: write %s: %s\\[rs]n\", setgroups_path,\n" |
| 3589 |
" strerror(errno));\n" |
| 3590 |
"\\&\n" |
| 3591 |
" close(fd);\n" |
| 3592 |
"}\n" |
| 3593 |
"\\&\n" |
| 3594 |
"static int /* Startfunktion för klonat barn */\n" |
| 3595 |
"childFunc(void *arg)\n" |
| 3596 |
"{\n" |
| 3597 |
" struct child_args *args = arg;\n" |
| 3598 |
" char ch;\n" |
| 3599 |
"\\&\n" |
| 3600 |
" /* Vänta tills föräldern har uppdaterat AID- och GID-avbildningarna.\n" |
| 3601 |
" Se kommentaren i main(). Vi väntar på filslut från ett rör som\n" |
| 3602 |
" kommer stängas av föräldraprocessen när den har uppdaterat\n" |
| 3603 |
" avbildningarna. */\n" |
| 3604 |
"\\&\n" |
| 3605 |
" close(args-E<gt>pipe_fd[1]); /* Stäng vår beskrivare för skrivänden\n" |
| 3606 |
" av röret så att vi ser EOF när föräldern\n" |
| 3607 |
" stänger sin beskrivare. */\n" |
| 3608 |
" if (read(args-E<gt>pipe_fd[0], &ch, 1) != 0) {\n" |
| 3609 |
" fprintf(stderr,\n" |
| 3610 |
" \"Fel i barnet: läsning från röret returnerade ≠ 0\\[rs]n\");\n" |
| 3611 |
" exit(EXIT_FAILURE);\n" |
| 3612 |
" }\n" |
| 3613 |
"\\&\n" |
| 3614 |
" close(args-E<gt>pipe_fd[0]);\n" |
| 3615 |
"\\&\n" |
| 3616 |
" /* Kör ett skalkommando. */\n" |
| 3617 |
"\\&\n" |
| 3618 |
" printf(\"I begrepp att göra exec %s\\[rs]n\", args-E<gt>argv[0]);\n" |
| 3619 |
" execvp(args-E<gt>argv[0], args-E<gt>argv);\n" |
| 3620 |
" err(EXIT_FAILURE, \"execvp\");\n" |
| 3621 |
"}\n" |
| 3622 |
"\\&\n" |
| 3623 |
"#define STACK_SIZE (1024 * 1024)\n" |
| 3624 |
"\\&\n" |
| 3625 |
"static char child_stack[STACK_SIZE]; /* Utrymme för barnets stack */\n" |
| 3626 |
"\\&\n" |
| 3627 |
"int\n" |
| 3628 |
"main(int argc, char *argv[])\n" |
| 3629 |
"{\n" |
| 3630 |
" int flags, opt, map_zero;\n" |
| 3631 |
" pid_t child_pid;\n" |
| 3632 |
" struct child_args args;\n" |
| 3633 |
" char *uid_map, *gid_map;\n" |
| 3634 |
" const int MAP_BUF_SIZE = 100;\n" |
| 3635 |
" char map_buf[MAP_BUF_SIZE];\n" |
| 3636 |
" char map_path[PATH_MAX];\n" |
| 3637 |
"\\&\n" |
| 3638 |
" /* Tolka kommandoradsflaggor. Det inledande tecknet \\[aq]+\\[aq] i det\n" |
| 3639 |
" sista argumentet till getopt() förhindrar permutationer av\n" |
| 3640 |
" kommandoradsflaggor enligt GNU-stil. Det är användbart, eftersom\n" |
| 3641 |
" ibland \\[aq]kommandot\\[aq] som skall köras av detta program självt\n" |
| 3642 |
" har kommandoradsflaggor. Vi vill inte att getopt() skall hantera\n" |
| 3643 |
" dessa som flaggor till detta program. */\n" |
| 3644 |
"\\&\n" |
| 3645 |
" flags = 0;\n" |
| 3646 |
" verbose = 0;\n" |
| 3647 |
" gid_map = NULL;\n" |
| 3648 |
" uid_map = NULL;\n" |
| 3649 |
" map_zero = 0;\n" |
| 3650 |
" while ((opt = getopt(argc, argv, \"+imnpuUM:G:zv\")) != -1) {\n" |
| 3651 |
" switch (opt) {\n" |
| 3652 |
" case \\[aq]i\\[aq]: flags |= CLONE_NEWIPC; break;\n" |
| 3653 |
" case \\[aq]m\\[aq]: flags |= CLONE_NEWNS; break;\n" |
| 3654 |
" case \\[aq]n\\[aq]: flags |= CLONE_NEWNET; break;\n" |
| 3655 |
" case \\[aq]p\\[aq]: flags |= CLONE_NEWPID; break;\n" |
| 3656 |
" case \\[aq]u\\[aq]: flags |= CLONE_NEWUTS; break;\n" |
| 3657 |
" case \\[aq]v\\[aq]: verbose = 1; break;\n" |
| 3658 |
" case \\[aq]z\\[aq]: map_zero = 1; break;\n" |
| 3659 |
" case \\[aq]M\\[aq]: uid_map = optarg; break;\n" |
| 3660 |
" case \\[aq]G\\[aq]: gid_map = optarg; break;\n" |
| 3661 |
" case \\[aq]U\\[aq]: flags |= CLONE_NEWUSER; break;\n" |
| 3662 |
" default: usage(argv[0]);\n" |
| 3663 |
" }\n" |
| 3664 |
" }\n" |
| 3665 |
"\\&\n" |
| 3666 |
" /* -M eller -G utan -U är meningslöst */\n" |
| 3667 |
"\\&\n" |
| 3668 |
" if (((uid_map != NULL || gid_map != NULL || map_zero) &&\n" |
| 3669 |
" !(flags & CLONE_NEWUSER)) ||\n" |
| 3670 |
" (map_zero && (uid_map != NULL || gid_map != NULL)))\n" |
| 3671 |
" usage(argv[0]);\n" |
| 3672 |
"\\&\n" |
| 3673 |
" args.argv = &argv[optind];\n" |
| 3674 |
"\\&\n" |
| 3675 |
" /* Vi använder ett rör för att synkronisera förälder och barn, för\n" |
| 3676 |
" att säkerställa att föräldern ställer in UID- och GID-avbildningarna\n" |
| 3677 |
" före barnet anropar execve(). Detta ser till att barnet behåller\n" |
| 3678 |
" sina förmågor under execve() i det vanliga fallet då vi vill avbilda\n" |
| 3679 |
" barnets effektiva användar-ID på 0 i den nya användarnamnrymden.\n" |
| 3680 |
" Utan denna synkronisering skulle barnet tappa sina förmågor om det\n" |
| 3681 |
" utförde en execve() med användar-ID:n skilda från noll (se\n" |
| 3682 |
" manualsidan capabilities(7) för detaljer om transformationen av en\n" |
| 3683 |
" process förmågor under execve()). */\n" |
| 3684 |
"\\&\n" |
| 3685 |
" if (pipe(args.pipe_fd) == -1)\n" |
| 3686 |
" err(EXIT_FAILURE, \"pipe\");\n" |
| 3687 |
"\\&\n" |
| 3688 |
" /* Skapa barnet i nya namnrymder. */\n" |
| 3689 |
"\\&\n" |
| 3690 |
" child_pid = clone(childFunc, child_stack + STACK_SIZE,\n" |
| 3691 |
" flags | SIGCHLD, &args);\n" |
| 3692 |
" if (child_pid == -1)\n" |
| 3693 |
" err(EXIT_FAILURE, \"clone\");\n" |
| 3694 |
"\\&\n" |
| 3695 |
" /* Föräldern faller igenom hit. */\n" |
| 3696 |
"\\&\n" |
| 3697 |
" if (verbose)\n" |
| 3698 |
" printf(\"%s: PID för barnet som skapades av clone() är %jd\\[rs]n\",\n" |
| 3699 |
" argv[0], (intmax_t) child_pid);\n" |
| 3700 |
"\\&\n" |
| 3701 |
" /* Uppdatera UID- och GID-avbildningarna i barnet. */\n" |
| 3702 |
"\\&\n" |
| 3703 |
" if (uid_map != NULL || map_zero) {\n" |
| 3704 |
" snprintf(map_path, PATH_MAX, \"/proc/%jd/uid_map\",\n" |
| 3705 |
" (intmax_t) child_pid);\n" |
| 3706 |
" if (map_zero) {\n" |
| 3707 |
" snprintf(map_buf, MAP_BUF_SIZE, \"0 %jd 1\",\n" |
| 3708 |
" (intmax_t) getuid());\n" |
| 3709 |
" uid_map = map_buf;\n" |
| 3710 |
" }\n" |
| 3711 |
" update_map(uid_map, map_path);\n" |
| 3712 |
" }\n" |
| 3713 |
"\\&\n" |
| 3714 |
" if (gid_map != NULL || map_zero) {\n" |
| 3715 |
" proc_setgroups_write(child_pid, \"deny\");\n" |
| 3716 |
"\\&\n" |
| 3717 |
" snprintf(map_path, PATH_MAX, \"/proc/%jd/gid_map\",\n" |
| 3718 |
" (intmax_t) child_pid);\n" |
| 3719 |
" if (map_zero) {\n" |
| 3720 |
" snprintf(map_buf, MAP_BUF_SIZE, \"0 %ld 1\",\n" |
| 3721 |
" (intmax_t) getgid());\n" |
| 3722 |
" gid_map = map_buf;\n" |
| 3723 |
" }\n" |
| 3724 |
" update_map(gid_map, map_path);\n" |
| 3725 |
" }\n" |
| 3726 |
"\\&\n" |
| 3727 |
" /* Stäng skrivänden av röret för att signalera till barnet att vi\n" |
| 3728 |
" har uppdaterat UID- och GID-avbildningarna. */\n" |
| 3729 |
"\\&\n" |
| 3730 |
" close(args.pipe_fd[1]);\n" |
| 3731 |
"\\&\n" |
| 3732 |
" if (waitpid(child_pid, NULL, 0) == -1) /* Wait for child */\n" |
| 3733 |
" err(EXIT_FAILURE, \"waitpid\");\n" |
| 3734 |
"\\&\n" |
| 3735 |
" if (verbose)\n" |
| 3736 |
" printf(\"%s: avslutar\\[rs]n\", argv[0]);\n" |
| 3737 |
"\\&\n" |
| 3738 |
" exit(EXIT_SUCCESS);\n" |
| 3739 |
"}\n" |
| 3740 |
|
| 3741 |
#. type: TH |
| 3742 |
#: fedora-44 fedora-rawhide |
| 3743 |
#, no-wrap |
| 3744 |
msgid "2025-01-11" |
| 3745 |
msgstr "11 januari 2025" |
| 3746 |
|
| 3747 |
#. type: TH |
| 3748 |
#: fedora-44 fedora-rawhide |
| 3749 |
#, no-wrap |
| 3750 |
msgid "Linux man-pages 6.13" |
| 3751 |
msgstr "Linux man-pages 6.13" |
| 3752 |
|
| 3753 |
#. type: Plain text |
| 3754 |
#: fedora-44 fedora-rawhide |
| 3755 |
#, no-wrap |
| 3756 |
msgid "" |
| 3757 |
"/* userns_child_exec.c\n" |
| 3758 |
"\\&\n" |
| 3759 |
" Licensed under GNU General Public License v2 or later\n" |
| 3760 |
"\\&\n" |
| 3761 |
" Create a child process that executes a shell command in new\n" |
| 3762 |
" namespace(s); allow UID and GID mappings to be specified when\n" |
| 3763 |
" creating a user namespace.\n" |
| 3764 |
"*/\n" |
| 3765 |
"#define _GNU_SOURCE\n" |
| 3766 |
"#include E<lt>err.hE<gt>\n" |
| 3767 |
"#include E<lt>sched.hE<gt>\n" |
| 3768 |
"#include E<lt>unistd.hE<gt>\n" |
| 3769 |
"#include E<lt>stdint.hE<gt>\n" |
| 3770 |
"#include E<lt>stdlib.hE<gt>\n" |
| 3771 |
"#include E<lt>sys/wait.hE<gt>\n" |
| 3772 |
"#include E<lt>signal.hE<gt>\n" |
| 3773 |
"#include E<lt>fcntl.hE<gt>\n" |
| 3774 |
"#include E<lt>stdio.hE<gt>\n" |
| 3775 |
"#include E<lt>string.hE<gt>\n" |
| 3776 |
"#include E<lt>limits.hE<gt>\n" |
| 3777 |
"#include E<lt>errno.hE<gt>\n" |
| 3778 |
"\\&\n" |
| 3779 |
"struct child_args {\n" |
| 3780 |
" char **argv; /* Command to be executed by child, with args */\n" |
| 3781 |
" int pipe_fd[2]; /* Pipe used to synchronize parent and child */\n" |
| 3782 |
"};\n" |
| 3783 |
"\\&\n" |
| 3784 |
"static int verbose;\n" |
| 3785 |
"\\&\n" |
| 3786 |
"static void\n" |
| 3787 |
"usage(char *pname)\n" |
| 3788 |
"{\n" |
| 3789 |
" fprintf(stderr, \"Usage: %s [options] cmd [arg...]\\[rs]n\\[rs]n\", pname);\n" |
| 3790 |
" fprintf(stderr, \"Create a child process that executes a shell \"\n" |
| 3791 |
" \"command in a new user namespace,\\[rs]n\"\n" |
| 3792 |
" \"and possibly also other new namespace(s).\\[rs]n\\[rs]n\");\n" |
| 3793 |
" fprintf(stderr, \"Options can be:\\[rs]n\\[rs]n\");\n" |
| 3794 |
"#define fpe(str) fprintf(stderr, \" %s\", str);\n" |
| 3795 |
" fpe(\"-i New IPC namespace\\[rs]n\");\n" |
| 3796 |
" fpe(\"-m New mount namespace\\[rs]n\");\n" |
| 3797 |
" fpe(\"-n New network namespace\\[rs]n\");\n" |
| 3798 |
" fpe(\"-p New PID namespace\\[rs]n\");\n" |
| 3799 |
" fpe(\"-u New UTS namespace\\[rs]n\");\n" |
| 3800 |
" fpe(\"-U New user namespace\\[rs]n\");\n" |
| 3801 |
" fpe(\"-M uid_map Specify UID map for user namespace\\[rs]n\");\n" |
| 3802 |
" fpe(\"-G gid_map Specify GID map for user namespace\\[rs]n\");\n" |
| 3803 |
" fpe(\"-z Map user\\[aq]s UID and GID to 0 in user namespace\\[rs]n\");\n" |
| 3804 |
" fpe(\" (equivalent to: -M \\[aq]0 E<lt>uidE<gt> 1\\[aq] -G \\[aq]0 E<lt>gidE<gt> 1\\[aq])\\[rs]n\");\n" |
| 3805 |
" fpe(\"-v Display verbose messages\\[rs]n\");\n" |
| 3806 |
" fpe(\"\\[rs]n\");\n" |
| 3807 |
" fpe(\"If -z, -M, or -G is specified, -U is required.\\[rs]n\");\n" |
| 3808 |
" fpe(\"It is not permitted to specify both -z and either -M or -G.\\[rs]n\");\n" |
| 3809 |
" fpe(\"\\[rs]n\");\n" |
| 3810 |
" fpe(\"Map strings for -M and -G consist of records of the form:\\[rs]n\");\n" |
| 3811 |
" fpe(\"\\[rs]n\");\n" |
| 3812 |
" fpe(\" ID-inside-ns ID-outside-ns size\\[rs]n\");\n" |
| 3813 |
" fpe(\"\\[rs]n\");\n" |
| 3814 |
" fpe(\"A map string can contain multiple records, separated\"\n" |
| 3815 |
" \" by commas;\\[rs]n\");\n" |
| 3816 |
" fpe(\"the commas are replaced by newlines before writing\"\n" |
| 3817 |
" \" to map files.\\[rs]n\");\n" |
| 3818 |
"\\&\n" |
| 3819 |
" exit(EXIT_FAILURE);\n" |
| 3820 |
"}\n" |
| 3821 |
"\\&\n" |
| 3822 |
"/* Update the mapping file \\[aq]map_file\\[aq], with the value provided in\n" |
| 3823 |
" \\[aq]mapping\\[aq], a string that defines a UID or GID mapping. A UID or\n" |
| 3824 |
" GID mapping consists of one or more newline-delimited records\n" |
| 3825 |
" of the form:\n" |
| 3826 |
"\\&\n" |
| 3827 |
" ID_inside-ns ID-outside-ns size\n" |
| 3828 |
"\\&\n" |
| 3829 |
" Requiring the user to supply a string that contains newlines is\n" |
| 3830 |
" of course inconvenient for command-line use. Thus, we permit the\n" |
| 3831 |
" use of commas to delimit records in this string, and replace them\n" |
| 3832 |
" with newlines before writing the string to the file. */\n" |
| 3833 |
"\\&\n" |
| 3834 |
"static void\n" |
| 3835 |
"update_map(char *mapping, char *map_file)\n" |
| 3836 |
"{\n" |
| 3837 |
" int fd;\n" |
| 3838 |
" size_t map_len; /* Length of \\[aq]mapping\\[aq] */\n" |
| 3839 |
"\\&\n" |
| 3840 |
" /* Replace commas in mapping string with newlines. */\n" |
| 3841 |
"\\&\n" |
| 3842 |
" map_len = strlen(mapping);\n" |
| 3843 |
" for (size_t j = 0; j E<lt> map_len; j++)\n" |
| 3844 |
" if (mapping[j] == \\[aq],\\[aq])\n" |
| 3845 |
" mapping[j] = \\[aq]\\[rs]n\\[aq];\n" |
| 3846 |
"\\&\n" |
| 3847 |
" fd = open(map_file, O_RDWR);\n" |
| 3848 |
" if (fd == -1) {\n" |
| 3849 |
" fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", map_file,\n" |
| 3850 |
" strerror(errno));\n" |
| 3851 |
" exit(EXIT_FAILURE);\n" |
| 3852 |
" }\n" |
| 3853 |
"\\&\n" |
| 3854 |
" if (write(fd, mapping, map_len) != map_len) {\n" |
| 3855 |
" fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", map_file,\n" |
| 3856 |
" strerror(errno));\n" |
| 3857 |
" exit(EXIT_FAILURE);\n" |
| 3858 |
" }\n" |
| 3859 |
"\\&\n" |
| 3860 |
" close(fd);\n" |
| 3861 |
"}\n" |
| 3862 |
"\\&\n" |
| 3863 |
"/* Linux 3.19 made a change in the handling of setgroups(2) and\n" |
| 3864 |
" the \\[aq]gid_map\\[aq] file to address a security issue. The issue\n" |
| 3865 |
" allowed *unprivileged* users to employ user namespaces in\n" |
| 3866 |
" order to drop groups. The upshot of the 3.19 changes is that\n" |
| 3867 |
" in order to update the \\[aq]gid_maps\\[aq] file, use of the setgroups()\n" |
| 3868 |
" system call in this user namespace must first be disabled by\n" |
| 3869 |
" writing \"deny\" to one of the /proc/PID/setgroups files for\n" |
| 3870 |
" this namespace. That is the purpose of the following function. */\n" |
| 3871 |
"\\&\n" |
| 3872 |
"static void\n" |
| 3873 |
"proc_setgroups_write(pid_t child_pid, char *str)\n" |
| 3874 |
"{\n" |
| 3875 |
" char setgroups_path[PATH_MAX];\n" |
| 3876 |
" int fd;\n" |
| 3877 |
"\\&\n" |
| 3878 |
" snprintf(setgroups_path, PATH_MAX, \"/proc/%jd/setgroups\",\n" |
| 3879 |
" (intmax_t) child_pid);\n" |
| 3880 |
"\\&\n" |
| 3881 |
" fd = open(setgroups_path, O_RDWR);\n" |
| 3882 |
" if (fd == -1) {\n" |
| 3883 |
"\\&\n" |
| 3884 |
" /* We may be on a system that doesn\\[aq]t support\n" |
| 3885 |
" /proc/PID/setgroups. In that case, the file won\\[aq]t exist,\n" |
| 3886 |
" and the system won\\[aq]t impose the restrictions that Linux 3.19\n" |
| 3887 |
" added. That\\[aq]s fine: we don\\[aq]t need to do anything in order\n" |
| 3888 |
" to permit \\[aq]gid_map\\[aq] to be updated.\n" |
| 3889 |
"\\&\n" |
| 3890 |
" However, if the error from open() was something other than\n" |
| 3891 |
" the ENOENT error that is expected for that case, let the\n" |
| 3892 |
" user know. */\n" |
| 3893 |
"\\&\n" |
| 3894 |
" if (errno != ENOENT)\n" |
| 3895 |
" fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", setgroups_path,\n" |
| 3896 |
" strerror(errno));\n" |
| 3897 |
" return;\n" |
| 3898 |
" }\n" |
| 3899 |
"\\&\n" |
| 3900 |
" if (write(fd, str, strlen(str)) == -1)\n" |
| 3901 |
" fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", setgroups_path,\n" |
| 3902 |
" strerror(errno));\n" |
| 3903 |
"\\&\n" |
| 3904 |
" close(fd);\n" |
| 3905 |
"}\n" |
| 3906 |
"\\&\n" |
| 3907 |
"static int /* Start function for cloned child */\n" |
| 3908 |
"childFunc(void *arg)\n" |
| 3909 |
"{\n" |
| 3910 |
" struct child_args *args = arg;\n" |
| 3911 |
" char ch;\n" |
| 3912 |
"\\&\n" |
| 3913 |
" /* Wait until the parent has updated the UID and GID mappings.\n" |
| 3914 |
" See the comment in main(). We wait for end of file on a\n" |
| 3915 |
" pipe that will be closed by the parent process once it has\n" |
| 3916 |
" updated the mappings. */\n" |
| 3917 |
"\\&\n" |
| 3918 |
" close(args-E<gt>pipe_fd[1]); /* Close our descriptor for the write\n" |
| 3919 |
" end of the pipe so that we see EOF\n" |
| 3920 |
" when parent closes its descriptor. */\n" |
| 3921 |
" if (read(args-E<gt>pipe_fd[0], &ch, 1) != 0) {\n" |
| 3922 |
" fprintf(stderr,\n" |
| 3923 |
" \"Failure in child: read from pipe returned != 0\\[rs]n\");\n" |
| 3924 |
" exit(EXIT_FAILURE);\n" |
| 3925 |
" }\n" |
| 3926 |
"\\&\n" |
| 3927 |
" close(args-E<gt>pipe_fd[0]);\n" |
| 3928 |
"\\&\n" |
| 3929 |
" /* Execute a shell command. */\n" |
| 3930 |
"\\&\n" |
| 3931 |
" printf(\"About to exec %s\\[rs]n\", args-E<gt>argv[0]);\n" |
| 3932 |
" execvp(args-E<gt>argv[0], args-E<gt>argv);\n" |
| 3933 |
" err(EXIT_FAILURE, \"execvp\");\n" |
| 3934 |
"}\n" |
| 3935 |
"\\&\n" |
| 3936 |
"#define STACK_SIZE (1024 * 1024)\n" |
| 3937 |
"\\&\n" |
| 3938 |
"static char child_stack[STACK_SIZE]; /* Space for child\\[aq]s stack */\n" |
| 3939 |
"\\&\n" |
| 3940 |
"int\n" |
| 3941 |
"main(int argc, char *argv[])\n" |
| 3942 |
"{\n" |
| 3943 |
" int flags, opt, map_zero;\n" |
| 3944 |
" pid_t child_pid;\n" |
| 3945 |
" struct child_args args;\n" |
| 3946 |
" char *uid_map, *gid_map;\n" |
| 3947 |
" const int MAP_BUF_SIZE = 100;\n" |
| 3948 |
" char map_buf[MAP_BUF_SIZE];\n" |
| 3949 |
" char map_path[PATH_MAX];\n" |
| 3950 |
"\\&\n" |
| 3951 |
" /* Parse command-line options. The initial \\[aq]+\\[aq] character in\n" |
| 3952 |
" the final getopt() argument prevents GNU-style permutation\n" |
| 3953 |
" of command-line options. That\\[aq]s useful, since sometimes\n" |
| 3954 |
" the \\[aq]command\\[aq] to be executed by this program itself\n" |
| 3955 |
" has command-line options. We don\\[aq]t want getopt() to treat\n" |
| 3956 |
" those as options to this program. */\n" |
| 3957 |
"\\&\n" |
| 3958 |
" flags = 0;\n" |
| 3959 |
" verbose = 0;\n" |
| 3960 |
" gid_map = NULL;\n" |
| 3961 |
" uid_map = NULL;\n" |
| 3962 |
" map_zero = 0;\n" |
| 3963 |
" while ((opt = getopt(argc, argv, \"+imnpuUM:G:zv\")) != -1) {\n" |
| 3964 |
" switch (opt) {\n" |
| 3965 |
" case \\[aq]i\\[aq]: flags |= CLONE_NEWIPC; break;\n" |
| 3966 |
" case \\[aq]m\\[aq]: flags |= CLONE_NEWNS; break;\n" |
| 3967 |
" case \\[aq]n\\[aq]: flags |= CLONE_NEWNET; break;\n" |
| 3968 |
" case \\[aq]p\\[aq]: flags |= CLONE_NEWPID; break;\n" |
| 3969 |
" case \\[aq]u\\[aq]: flags |= CLONE_NEWUTS; break;\n" |
| 3970 |
" case \\[aq]v\\[aq]: verbose = 1; break;\n" |
| 3971 |
" case \\[aq]z\\[aq]: map_zero = 1; break;\n" |
| 3972 |
" case \\[aq]M\\[aq]: uid_map = optarg; break;\n" |
| 3973 |
" case \\[aq]G\\[aq]: gid_map = optarg; break;\n" |
| 3974 |
" case \\[aq]U\\[aq]: flags |= CLONE_NEWUSER; break;\n" |
| 3975 |
" default: usage(argv[0]);\n" |
| 3976 |
" }\n" |
| 3977 |
" }\n" |
| 3978 |
"\\&\n" |
| 3979 |
" /* -M or -G without -U is nonsensical */\n" |
| 3980 |
"\\&\n" |
| 3981 |
" if (((uid_map != NULL || gid_map != NULL || map_zero) &&\n" |
| 3982 |
" !(flags & CLONE_NEWUSER)) ||\n" |
| 3983 |
" (map_zero && (uid_map != NULL || gid_map != NULL)))\n" |
| 3984 |
" usage(argv[0]);\n" |
| 3985 |
"\\&\n" |
| 3986 |
" args.argv = &argv[optind];\n" |
| 3987 |
"\\&\n" |
| 3988 |
" /* We use a pipe to synchronize the parent and child, in order to\n" |
| 3989 |
" ensure that the parent sets the UID and GID maps before the child\n" |
| 3990 |
" calls execve(). This ensures that the child maintains its\n" |
| 3991 |
" capabilities during the execve() in the common case where we\n" |
| 3992 |
" want to map the child\\[aq]s effective user ID to 0 in the new user\n" |
| 3993 |
" namespace. Without this synchronization, the child would lose\n" |
| 3994 |
" its capabilities if it performed an execve() with nonzero\n" |
| 3995 |
" user IDs (see the capabilities(7) man page for details of the\n" |
| 3996 |
" transformation of a process\\[aq]s capabilities during execve()). */\n" |
| 3997 |
"\\&\n" |
| 3998 |
" if (pipe(args.pipe_fd) == -1)\n" |
| 3999 |
" err(EXIT_FAILURE, \"pipe\");\n" |
| 4000 |
"\\&\n" |
| 4001 |
" /* Create the child in new namespace(s). */\n" |
| 4002 |
"\\&\n" |
| 4003 |
" child_pid = clone(childFunc, child_stack + STACK_SIZE,\n" |
| 4004 |
" flags | SIGCHLD, &args);\n" |
| 4005 |
" if (child_pid == -1)\n" |
| 4006 |
" err(EXIT_FAILURE, \"clone\");\n" |
| 4007 |
"\\&\n" |
| 4008 |
" /* Parent falls through to here. */\n" |
| 4009 |
"\\&\n" |
| 4010 |
" if (verbose)\n" |
| 4011 |
" printf(\"%s: PID of child created by clone() is %jd\\[rs]n\",\n" |
| 4012 |
" argv[0], (intmax_t) child_pid);\n" |
| 4013 |
"\\&\n" |
| 4014 |
" /* Update the UID and GID maps in the child. */\n" |
| 4015 |
"\\&\n" |
| 4016 |
" if (uid_map != NULL || map_zero) {\n" |
| 4017 |
" snprintf(map_path, PATH_MAX, \"/proc/%jd/uid_map\",\n" |
| 4018 |
" (intmax_t) child_pid);\n" |
| 4019 |
" if (map_zero) {\n" |
| 4020 |
" snprintf(map_buf, MAP_BUF_SIZE, \"0 %jd 1\",\n" |
| 4021 |
" (intmax_t) getuid());\n" |
| 4022 |
" uid_map = map_buf;\n" |
| 4023 |
" }\n" |
| 4024 |
" update_map(uid_map, map_path);\n" |
| 4025 |
" }\n" |
| 4026 |
"\\&\n" |
| 4027 |
" if (gid_map != NULL || map_zero) {\n" |
| 4028 |
" proc_setgroups_write(child_pid, \"deny\");\n" |
| 4029 |
"\\&\n" |
| 4030 |
" snprintf(map_path, PATH_MAX, \"/proc/%jd/gid_map\",\n" |
| 4031 |
" (intmax_t) child_pid);\n" |
| 4032 |
" if (map_zero) {\n" |
| 4033 |
" snprintf(map_buf, MAP_BUF_SIZE, \"0 %ld 1\",\n" |
| 4034 |
" (intmax_t) getgid());\n" |
| 4035 |
" gid_map = map_buf;\n" |
| 4036 |
" }\n" |
| 4037 |
" update_map(gid_map, map_path);\n" |
| 4038 |
" }\n" |
| 4039 |
"\\&\n" |
| 4040 |
" /* Close the write end of the pipe, to signal to the child that we\n" |
| 4041 |
" have updated the UID and GID maps. */\n" |
| 4042 |
"\\&\n" |
| 4043 |
" close(args.pipe_fd[1]);\n" |
| 4044 |
"\\&\n" |
| 4045 |
" if (waitpid(child_pid, NULL, 0) == -1) /* Wait for child */\n" |
| 4046 |
" err(EXIT_FAILURE, \"waitpid\");\n" |
| 4047 |
"\\&\n" |
| 4048 |
" if (verbose)\n" |
| 4049 |
" printf(\"%s: terminating\\[rs]n\", argv[0]);\n" |
| 4050 |
"\\&\n" |
| 4051 |
" exit(EXIT_SUCCESS);\n" |
| 4052 |
"}\n" |
| 4053 |
msgstr "" |
| 4054 |
"/* userns_child_exec.c\n" |
| 4055 |
"\\&\n" |
| 4056 |
" Licensed under GNU General Public License v2 or later\n" |
| 4057 |
"\\&\n" |
| 4058 |
" Skapa en barnprocess som kör ett skalkommando i nya namnrymder;\n" |
| 4059 |
" låt UID- och GID-avbildningar anges när en användarnamnrymd\n" |
| 4060 |
" skapas.\n" |
| 4061 |
"*/\n" |
| 4062 |
"#define _GNU_SOURCE\n" |
| 4063 |
"#include E<lt>err.hE<gt>\n" |
| 4064 |
"#include E<lt>sched.hE<gt>\n" |
| 4065 |
"#include E<lt>unistd.hE<gt>\n" |
| 4066 |
"#include E<lt>stdint.hE<gt>\n" |
| 4067 |
"#include E<lt>stdlib.hE<gt>\n" |
| 4068 |
"#include E<lt>sys/wait.hE<gt>\n" |
| 4069 |
"#include E<lt>signal.hE<gt>\n" |
| 4070 |
"#include E<lt>fcntl.hE<gt>\n" |
| 4071 |
"#include E<lt>stdio.hE<gt>\n" |
| 4072 |
"#include E<lt>string.hE<gt>\n" |
| 4073 |
"#include E<lt>limits.hE<gt>\n" |
| 4074 |
"#include E<lt>errno.hE<gt>\n" |
| 4075 |
"\\&\n" |
| 4076 |
"struct child_args {\n" |
| 4077 |
" char **argv; /* Kommando att köras av barnet, med argument */\n" |
| 4078 |
" int pipe_fd[2]; /* Rör använt för att synkronisera förälder och barn */\n" |
| 4079 |
"};\n" |
| 4080 |
"\\&\n" |
| 4081 |
"static int verbose;\n" |
| 4082 |
"\\&\n" |
| 4083 |
"static void\n" |
| 4084 |
"usage(char *pname)\n" |
| 4085 |
"{\n" |
| 4086 |
" fprintf(stderr, \"Användning: %s [flaggor] kmd [arg…]\\[rs]n\\[rs]n\", pname);\n" |
| 4087 |
" fprintf(stderr, \"Skapa en barnprocess som kör ett skalkommando i \"\n" |
| 4088 |
" \"en ny användarnamnrymd,\\[rs]n\"\n" |
| 4089 |
" \"och eventuellt även andra nya namnrymder.\\[rs]n\\[rs]n\");\n" |
| 4090 |
" fprintf(stderr, \"Flaggor kan vara:\\[rs]n\\[rs]n\");\n" |
| 4091 |
"#define fpe(str) fprintf(stderr, \" %s\", str);\n" |
| 4092 |
" fpe(\"-i Ny IPC-namnrymd\\[rs]n\");\n" |
| 4093 |
" fpe(\"-m Ny monteringsnamnrymd\\[rs]n\");\n" |
| 4094 |
" fpe(\"-n Ny nätverksnamnrymd\\[rs]n\");\n" |
| 4095 |
" fpe(\"-p Ny PID-namnrymd\\[rs]n\");\n" |
| 4096 |
" fpe(\"-u Ny UTS-namnrymd\\[rs]n\");\n" |
| 4097 |
" fpe(\"-U Ny användarnamnrymd\\[rs]n\");\n" |
| 4098 |
" fpe(\"-M uid_map Ange AID-avbildning för användarnamnrymden\\[rs]n\");\n" |
| 4099 |
" fpe(\"-G gid_map Ange GID-avbildning för användarnamnrymden\\[rs]n\");\n" |
| 4100 |
" fpe(\"-z Avbilda användar-AID och -GID till 0 i användarnamnrymden\\[rs]n\");\n" |
| 4101 |
" fpe(\" (ekvivalent med: -M \\[aq]0 E<lt>aidE<gt> 1\\[aq] -G \\[aq]0 E<lt>gidE<gt> 1\\[aq])\\[rs]n\");\n" |
| 4102 |
" fpe(\"-v Visa utförliga meddelanden\\[rs]n\");\n" |
| 4103 |
" fpe(\"\\[rs]n\");\n" |
| 4104 |
" fpe(\"Om -z, -M eller -G anges är -U nödvändigt.\\[rs]n\");\n" |
| 4105 |
" fpe(\"Det är inte tillåtet att ange både -z och någon av -M eller -G.\\[rs]n\");\n" |
| 4106 |
" fpe(\"\\[rs]n\");\n" |
| 4107 |
" fpe(\"Avbildningssträngar för -M och -G består av poster på formen:\\[rs]n\");\n" |
| 4108 |
" fpe(\"\\[rs]n\");\n" |
| 4109 |
" fpe(\" ID-inuti-nr ID-utanför-nr storlek\\[rs]n\");\n" |
| 4110 |
" fpe(\"\\[rs]n\");\n" |
| 4111 |
" fpe(\"En avbildningssträng kan innehålla flera poster, separerade\"\n" |
| 4112 |
" \" av komman;\\[rs]n\");\n" |
| 4113 |
" fpe(\"kommatecknen ersätts med nyrader före skrivning\"\n" |
| 4114 |
" \" till avbildningsfiler.\\[rs]n\");\n" |
| 4115 |
"\\&\n" |
| 4116 |
" exit(EXIT_FAILURE);\n" |
| 4117 |
"}\n" |
| 4118 |
"\\&\n" |
| 4119 |
"/* Uppdatera avbildningsfilen \\[aq]map_fil\\[aq], med värdena som ges i\n" |
| 4120 |
" \\[aq]avbildning\\[aq], en sträng som definierar en AID- eller GID-avbildning.\n" |
| 4121 |
" En AID- eller GID-avbildning består av en eller flera nyradsavgränsade poster\n" |
| 4122 |
" på formen:\n" |
| 4123 |
"\\&\n" |
| 4124 |
" ID_inuti-nr ID-utanför-nr storlek\n" |
| 4125 |
"\\&\n" |
| 4126 |
" Att begära att användaren skall ge en sträng som innehåller nyrader är\n" |
| 4127 |
" naturligtvis opraktiskt för kommandoradsanvändning. Därför tillåter vi\n" |
| 4128 |
" användningen av komman för att avgränsa poster i denna sträng, och\n" |
| 4129 |
" ersätter dem med nyrader före vi skriver strängen till filen. */\"\n" |
| 4130 |
"\\&\n" |
| 4131 |
"static void\n" |
| 4132 |
"update_map(char *mapping, char *map_file)\n" |
| 4133 |
"{\n" |
| 4134 |
" int fd;\n" |
| 4135 |
" size_t map_len; /* Längden på \\\\[aq]avbildning\\\\[aq] */\n" |
| 4136 |
"\\&\n" |
| 4137 |
" /* Ersätt kommatecken i avbildningssträngar med nyrader. */\n" |
| 4138 |
"\\&\n" |
| 4139 |
" map_len = strlen(mapping);\n" |
| 4140 |
" for (size_t j = 0; j E<lt> map_len; j++)\n" |
| 4141 |
" if (mapping[j] == \\[aq],\\[aq])\n" |
| 4142 |
" mapping[j] = \\[aq]\\[rs]n\\[aq];\n" |
| 4143 |
"\\&\n" |
| 4144 |
" fd = open(map_file, O_RDWR);\n" |
| 4145 |
" if (fd == -1) {\n" |
| 4146 |
" fprintf(stderr, \"FEL: open %s: %s\\[rs]n\", map_file,\n" |
| 4147 |
" strerror(errno));\n" |
| 4148 |
" exit(EXIT_FAILURE);\n" |
| 4149 |
" }\n" |
| 4150 |
"\\&\n" |
| 4151 |
" if (write(fd, mapping, map_len) != map_len) {\n" |
| 4152 |
" fprintf(stderr, \"FEL: write %s: %s\\[rs]n\", map_file,\n" |
| 4153 |
" strerror(errno));\n" |
| 4154 |
" exit(EXIT_FAILURE);\n" |
| 4155 |
" }\n" |
| 4156 |
"\\&\n" |
| 4157 |
" close(fd);\n" |
| 4158 |
"}\n" |
| 4159 |
"\\&\n" |
| 4160 |
"/* Linux 3.19 gjorde en ändring av hanteringen av setgroups(2) och filen\n" |
| 4161 |
" \\[aq]gid_map\\[aq] för att åtgärda ett säkerhetsproblem. Problemet tillät\n" |
| 4162 |
" *oprivilegierade* användare att nyttja användarnamnrymder för att släppa\n" |
| 4163 |
" grupper. Följden av ändringarna i 3.19 är att för att uppdatera filen\n" |
| 4164 |
" \\[aq]gid_maps\\[aq] måste först användning av systemanropet setgroups()\n" |
| 4165 |
" i denna användarnamnrymd avaktiveras genom att skriva \"deny\" till en\n" |
| 4166 |
" av filerna /proc/PID/setgroups för denna namnrymd. Det är syftet med\n" |
| 4167 |
" följande funktion. */\n" |
| 4168 |
"\\&\n" |
| 4169 |
"static void\n" |
| 4170 |
"proc_setgroups_write(pid_t child_pid, char *str)\n" |
| 4171 |
"{\n" |
| 4172 |
" char setgroups_path[PATH_MAX];\n" |
| 4173 |
" int fd;\n" |
| 4174 |
"\\&\n" |
| 4175 |
" snprintf(setgroups_path, PATH_MAX, \"/proc/%jd/setgroups\",\n" |
| 4176 |
" (intmax_t) child_pid);\n" |
| 4177 |
"\\&\n" |
| 4178 |
" fd = open(setgroups_path, O_RDWR);\n" |
| 4179 |
" if (fd == -1) {\n" |
| 4180 |
"\\&\n" |
| 4181 |
" /* Vi kan vara på ett system som inte stödjer /proc/PID/setgroups.\n" |
| 4182 |
" I det fallet kommer filen inte att finnas, och systemet kommer\n" |
| 4183 |
" inte att påtvinga begränsningarna som Linux 3.19 lade till. Det\n" |
| 4184 |
" är bra så: vi behöver inte göra något för att tillåta att\n" |
| 4185 |
" \\[aq]gid_map\\[aq] uppdateras.\n" |
| 4186 |
"\\&\n" |
| 4187 |
" Dock, om felet från open() var något annat än felet ENOENT\n" |
| 4188 |
" som förväntas i det fallet, tala om det för användaren. */\n" |
| 4189 |
"\\&\n" |
| 4190 |
" if (errno != ENOENT)\n" |
| 4191 |
" fprintf(stderr, \"FEL: open %s: %s\\[rs]n\", setgroups_path,\n" |
| 4192 |
" strerror(errno));\n" |
| 4193 |
" return;\n" |
| 4194 |
" }\n" |
| 4195 |
"\\&\n" |
| 4196 |
" if (write(fd, str, strlen(str)) == -1)\n" |
| 4197 |
" fprintf(stderr, \"FEL: write %s: %s\\[rs]n\", setgroups_path,\n" |
| 4198 |
" strerror(errno));\n" |
| 4199 |
"\\&\n" |
| 4200 |
" close(fd);\n" |
| 4201 |
"}\n" |
| 4202 |
"\\&\n" |
| 4203 |
"static int /* Startfunktion för klonat barn */\n" |
| 4204 |
"childFunc(void *arg)\n" |
| 4205 |
"{\n" |
| 4206 |
" struct child_args *args = arg;\n" |
| 4207 |
" char ch;\n" |
| 4208 |
"\\&\n" |
| 4209 |
" /* Vänta tills föräldern har uppdaterat AID- och GID-avbildningarna.\n" |
| 4210 |
" Se kommentaren i main(). Vi väntar på filslut från ett rör som\n" |
| 4211 |
" kommer stängas av föräldraprocessen när den har uppdaterat\n" |
| 4212 |
" avbildningarna. */\n" |
| 4213 |
"\\&\n" |
| 4214 |
" close(args-E<gt>pipe_fd[1]); /* Stäng vår beskrivare för skrivänden\n" |
| 4215 |
" av röret så att vi ser EOF när föräldern\n" |
| 4216 |
" stänger sin beskrivare. */\n" |
| 4217 |
" if (read(args-E<gt>pipe_fd[0], &ch, 1) != 0) {\n" |
| 4218 |
" fprintf(stderr,\n" |
| 4219 |
" \"Fel i barnet: läsning från röret returnerade ≠ 0\\[rs]n\");\n" |
| 4220 |
" exit(EXIT_FAILURE);\n" |
| 4221 |
" }\n" |
| 4222 |
"\\&\n" |
| 4223 |
" close(args-E<gt>pipe_fd[0]);\n" |
| 4224 |
"\\&\n" |
| 4225 |
" /* Kör ett skalkommando. */\n" |
| 4226 |
"\\&\n" |
| 4227 |
" printf(\"I begrepp att göra exec %s\\[rs]n\", args-E<gt>argv[0]);\n" |
| 4228 |
" execvp(args-E<gt>argv[0], args-E<gt>argv);\n" |
| 4229 |
" err(EXIT_FAILURE, \"execvp\");\n" |
| 4230 |
"}\n" |
| 4231 |
"\\&\n" |
| 4232 |
"#define STACK_SIZE (1024 * 1024)\n" |
| 4233 |
"\\&\n" |
| 4234 |
"static char child_stack[STACK_SIZE]; /* Utrymme för barnets stack */\n" |
| 4235 |
"\\&\n" |
| 4236 |
"int\n" |
| 4237 |
"main(int argc, char *argv[])\n" |
| 4238 |
"{\n" |
| 4239 |
" int flags, opt, map_zero;\n" |
| 4240 |
" pid_t child_pid;\n" |
| 4241 |
" struct child_args args;\n" |
| 4242 |
" char *uid_map, *gid_map;\n" |
| 4243 |
" const int MAP_BUF_SIZE = 100;\n" |
| 4244 |
" char map_buf[MAP_BUF_SIZE];\n" |
| 4245 |
" char map_path[PATH_MAX];\n" |
| 4246 |
"\\&\n" |
| 4247 |
" /* Tolka kommandoradsflaggor. Det inledande tecknet \\[aq]+\\[aq] i det\n" |
| 4248 |
" sista argumentet till getopt() förhindrar permutationer av\n" |
| 4249 |
" kommandoradsflaggor enligt GNU-stil. Det är användbart, eftersom\n" |
| 4250 |
" ibland \\[aq]kommandot\\[aq] som skall köras av detta program självt\n" |
| 4251 |
" har kommandoradsflaggor. Vi vill inte att getopt() skall hantera\n" |
| 4252 |
" dessa som flaggor till detta program. */\n" |
| 4253 |
"\\&\n" |
| 4254 |
" flags = 0;\n" |
| 4255 |
" verbose = 0;\n" |
| 4256 |
" gid_map = NULL;\n" |
| 4257 |
" uid_map = NULL;\n" |
| 4258 |
" map_zero = 0;\n" |
| 4259 |
" while ((opt = getopt(argc, argv, \"+imnpuUM:G:zv\")) != -1) {\n" |
| 4260 |
" switch (opt) {\n" |
| 4261 |
" case \\[aq]i\\[aq]: flags |= CLONE_NEWIPC; break;\n" |
| 4262 |
" case \\[aq]m\\[aq]: flags |= CLONE_NEWNS; break;\n" |
| 4263 |
" case \\[aq]n\\[aq]: flags |= CLONE_NEWNET; break;\n" |
| 4264 |
" case \\[aq]p\\[aq]: flags |= CLONE_NEWPID; break;\n" |
| 4265 |
" case \\[aq]u\\[aq]: flags |= CLONE_NEWUTS; break;\n" |
| 4266 |
" case \\[aq]v\\[aq]: verbose = 1; break;\n" |
| 4267 |
" case \\[aq]z\\[aq]: map_zero = 1; break;\n" |
| 4268 |
" case \\[aq]M\\[aq]: uid_map = optarg; break;\n" |
| 4269 |
" case \\[aq]G\\[aq]: gid_map = optarg; break;\n" |
| 4270 |
" case \\[aq]U\\[aq]: flags |= CLONE_NEWUSER; break;\n" |
| 4271 |
" default: usage(argv[0]);\n" |
| 4272 |
" }\n" |
| 4273 |
" }\n" |
| 4274 |
"\\&\n" |
| 4275 |
" /* -M eller -G utan -U är meningslöst */\n" |
| 4276 |
"\\&\n" |
| 4277 |
" if (((uid_map != NULL || gid_map != NULL || map_zero) &&\n" |
| 4278 |
" !(flags & CLONE_NEWUSER)) ||\n" |
| 4279 |
" (map_zero && (uid_map != NULL || gid_map != NULL)))\n" |
| 4280 |
" usage(argv[0]);\n" |
| 4281 |
"\\&\n" |
| 4282 |
" args.argv = &argv[optind];\n" |
| 4283 |
"\\&\n" |
| 4284 |
" /* Vi använder ett rör för att synkronisera förälder och barn, för\n" |
| 4285 |
" att säkerställa att föräldern ställer in UID- och GID-avbildningarna\n" |
| 4286 |
" före barnet anropar execve(). Detta ser till att barnet behåller\n" |
| 4287 |
" sina förmågor under execve() i det vanliga fallet då vi vill avbilda\n" |
| 4288 |
" barnets effektiva användar-ID på 0 i den nya användarnamnrymden.\n" |
| 4289 |
" Utan denna synkronisering skulle barnet tappa sina förmågor om det\n" |
| 4290 |
" utförde en execve() med användar-ID:n skilda från noll (se\n" |
| 4291 |
" manualsidan capabilities(7) för detaljer om transformationen av en\n" |
| 4292 |
" process förmågor under execve()). */\n" |
| 4293 |
"\\&\n" |
| 4294 |
" if (pipe(args.pipe_fd) == -1)\n" |
| 4295 |
" err(EXIT_FAILURE, \"pipe\");\n" |
| 4296 |
"\\&\n" |
| 4297 |
" /* Skapa barnet i nya namnrymder. */\n" |
| 4298 |
"\\&\n" |
| 4299 |
" child_pid = clone(childFunc, child_stack + STACK_SIZE,\n" |
| 4300 |
" flags | SIGCHLD, &args);\n" |
| 4301 |
" if (child_pid == -1)\n" |
| 4302 |
" err(EXIT_FAILURE, \"clone\");\n" |
| 4303 |
"\\&\n" |
| 4304 |
" /* Föräldern faller igenom hit. */\n" |
| 4305 |
"\\&\n" |
| 4306 |
" if (verbose)\n" |
| 4307 |
" printf(\"%s: PID för barnet som skapades av clone() är %jd\\[rs]n\",\n" |
| 4308 |
" argv[0], (intmax_t) child_pid);\n" |
| 4309 |
"\\&\n" |
| 4310 |
" /* Uppdatera UID- och GID-avbildningarna i barnet. */\n" |
| 4311 |
"\\&\n" |
| 4312 |
" if (uid_map != NULL || map_zero) {\n" |
| 4313 |
" snprintf(map_path, PATH_MAX, \"/proc/%jd/uid_map\",\n" |
| 4314 |
" (intmax_t) child_pid);\n" |
| 4315 |
" if (map_zero) {\n" |
| 4316 |
" snprintf(map_buf, MAP_BUF_SIZE, \"0 %jd 1\",\n" |
| 4317 |
" (intmax_t) getuid());\n" |
| 4318 |
" uid_map = map_buf;\n" |
| 4319 |
" }\n" |
| 4320 |
" update_map(uid_map, map_path);\n" |
| 4321 |
" }\n" |
| 4322 |
"\\&\n" |
| 4323 |
" if (gid_map != NULL || map_zero) {\n" |
| 4324 |
" proc_setgroups_write(child_pid, \"deny\");\n" |
| 4325 |
"\\&\n" |
| 4326 |
" snprintf(map_path, PATH_MAX, \"/proc/%jd/gid_map\",\n" |
| 4327 |
" (intmax_t) child_pid);\n" |
| 4328 |
" if (map_zero) {\n" |
| 4329 |
" snprintf(map_buf, MAP_BUF_SIZE, \"0 %ld 1\",\n" |
| 4330 |
" (intmax_t) getgid());\n" |
| 4331 |
" gid_map = map_buf;\n" |
| 4332 |
" }\n" |
| 4333 |
" update_map(gid_map, map_path);\n" |
| 4334 |
" }\n" |
| 4335 |
"\\&\n" |
| 4336 |
" /* Stäng skrivänden av röret för att signalera till barnet att vi\n" |
| 4337 |
" har uppdaterat UID- och GID-avbildningarna. */\n" |
| 4338 |
"\\&\n" |
| 4339 |
" close(args.pipe_fd[1]);\n" |
| 4340 |
"\\&\n" |
| 4341 |
" if (waitpid(child_pid, NULL, 0) == -1) /* Wait for child */\n" |
| 4342 |
" err(EXIT_FAILURE, \"waitpid\");\n" |
| 4343 |
"\\&\n" |
| 4344 |
" if (verbose)\n" |
| 4345 |
" printf(\"%s: avslutar\\[rs]n\", argv[0]);\n" |
| 4346 |
"\\&\n" |
| 4347 |
" exit(EXIT_SUCCESS);\n" |
| 4348 |
"}\n" |
| 4349 |
|
| 4350 |
#. type: TH |
| 4351 |
#: mageia-cauldron |
| 4352 |
#, no-wrap |
| 4353 |
msgid "Linux man-pages 6.17" |
| 4354 |
msgstr "Linux man-pages 6.17" |
| 4355 |
|
| 4356 |
#. type: TH |
| 4357 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 4358 |
#, no-wrap |
| 4359 |
msgid "Linux man-pages (unreleased)" |
| 4360 |
msgstr "Linux man-pages (outgivna)" |