Debian Codegraph @

doc/ja/pam_cgfs.sgml.in

raw
1 <!-- SPDX-License-Identifier: LGPL-2.1+ -->
2
3 <!DOCTYPE refentry PUBLIC @docdtd@ [
4
5 <!ENTITY seealso SYSTEM "@builddir@/see_also.sgml">
6 ]>
7
8 <refentry>
9
10 <docinfo><date>@LXC_GENERATE_DATE@</date></docinfo>
11
12 <refmeta>
13 <refentrytitle>pam_cgfs</refentrytitle>
14 <manvolnum>8</manvolnum>
15 </refmeta>
16
17 <refnamediv>
18 <refname>pam_cgfs</refname>
19
20 <refpurpose>
21 <!--
22 cgroup management for unprivileged LXC containers.
23 -->
24 非特権の LXC コンテナのための cgroup を管理する
25 </refpurpose>
26 </refnamediv>
27
28 <refsynopsisdiv>
29 <cmdsynopsis>
30 <command>pam_cgfs.so</command>
31 <arg choice="req">-c <replaceable>kernel_controller,name=named_controller</replaceable></arg>
32 </cmdsynopsis>
33 </refsynopsisdiv>
34
35 <refsect1>
36 <title><!-- Description -->説明</title>
37
38 <para>
39 <!--
40 LXC has supported fully unprivileged containers since LXC 1.0.
41 Fully unprivileged containers are the safest containers and are run by
42 normal (non-root) users. This is achieved by using user namespaces by
43 mapping between a range of UIDs and GIDs on the host to a different
44 (unprivileged) range of UIDs and GIDs in the container. That means the uid
45 0 (root) in the container is mapped to an unprivileged user id (something
46 like 1000000) outside of the container and only has rights on resources
47 that it owns itself.
48 -->
49 LXC は LXC 1.0 以降、完全な非特権コンテナをサポートしてきました。完全な非特権コンテナは安全なコンテナであり、一般ユーザ(非 root)で実行できます。これはホスト上の特権のない UID と GID の範囲を、それとは異なるコンテナ内の UID と GID の範囲にマッピングするユーザ名前空間を使うことで実現しています。これは、コンテナ内の UID 0 (root) が、コンテナの外では 1000000 のような特権のないユーザ ID にマッピングされ、自身の所有するリソースに対してのみ権限を有することを意味します。
50 </para>
51 <para>
52 <!--
53 Cgroup management of fully unprivileged containers means restricting the
54 resources used by these containers like limiting the CPU usage of a
55 container, or the number of processes it is allowed to spawn, or the
56 memory it is allowed to consume. It is clear that the fully
57 unprivileged containers are run by normal users and there is a need to
58 limit and manage resource consumption among the containers.
59 But unprivileged cgroup management is not easy with most init systems.
60 So, the pam_cgfs.so came into existence.
61 -->
62 完全な非特権コンテナの cgroup 管理は、このようなコンテナが使用するリソースを制限するということです。例えば、コンテナの CPU 使用量を制限したり、コンテナ内で起動するプロセスの数を制限したり、コンテナが消費できるメモリを制限したりということです。
63 完全な非特権コンテナは一般ユーザによって実行され、コンテナ間のリソース消費を制限、管理する必要があるということは明らかです。
64 しかし、非特権での cgroup 管理はほとんどの init システムでは簡単ではありません。
65 そこで、pam_cgfs.so が誕生したのです。
66 </para>
67
68 <para>
69 <!--
70 The <command>pam_cgfs.so</command> module can handle pure cgroupfs v1
71 (<filename>/sys/fs/cgroup/$controller</filename>) and mixed mounts,
72 where some controllers are mounted in a standard cgroupfs v1 hierarchy
73 (<filename>/sys/fs/cgroup/$controller</filename>) and others in
74 cgroupfs v2 hierarchy (<filename>/sys/fs/cgroup/unified</filename>).
75 Writeable cgroups are either created for all controllers or, if specified,
76 for only controllers listed as arguments on the command line.
77 Pure cgroup v2 mount is not covered by the pam_cgfs.so module.
78 -->
79 <command>pam_cgfs.so</command> モジュールは、純粋な cgroupfs v1 (<filename>/sys/fs/cgroup/$controller</filename>) ツリーと、コントローラのいくつかが cgroupfs v1 ツリー (<filename>/sys/fs/cgroup/$controller</filename>) で、それ以外が cgroupfs v2 (<filename>/sys/fs/cgroup/unified</filename>) ツリーと言ったようなミックスマウントを扱えます。
80 書き込み可能な cgroup がすべてのコントローラ用に作られます。また、引数で指定すれば、指定したコントローラのみ書き込み可能な cgroup が作られます。
81 純粋な cgroup v2 のみのマウントは pam_cgfs.so モジュールでは対象外です。
82 </para>
83
84 <para>
85 <!--
86 The cgroup created <filename>user/$user/n</filename> will be for the nth
87 session under cgroup kernel controller hierarchy.
88 -->
89 作成された cgroup <filename>user/$user/n</filename> は cgroup カーネルコントローラ階層配下の n 番目のセッション用です。
90 </para>
91
92 <para>
93 <!--
94 Systems with a systemd init system are treated specifically, both with
95 respect to cgroupfs v1 and cgroupfs v2. For both, cgroupfs v1 and
96 cgroupfs v2, the module checks whether systemd already placed the user in
97 a cgroup it created <filename>user.slice/user-$uid/session-n.scope
98 </filename> by checking whether $uid == login uid. If so, the login
99 user chown the <filename>session-n.scope</filename>, else a cgroup is
100 created as outlined above (<filename>user/$user/n</filename>) and chown it
101 to login uid. If the init system has already placed the login user inside
102 a session specific group, the <command>pam_cgfs.so</command> module is
103 smart enough to detect it and re-use the cgroup.
104 -->
105 init システムが systemd であるシステムは、cgroupfs v1 と v2 の両方が特別に扱われます。cgroupfs v1 と v2 の両方に対して、このモジュールは systemd が既に、<filename>user.slice/user-$uid/session-n.scope</filename> を cgroup 内に作成しているかどうか、$uid == login uid であるかどうかをチェックします。もし $uid == login uid であるなら、<filename>session-n.scope</filename> をユーザに chown します。そうでなければ、前述のような cgroup (<filename>user/$user/n</filename>) が作成され、ログイン uid で chown されます。
106 もし、init システムがすでにセッション特有のグループ内にログインユーザーの cgroup を配置しているなら、<command>pam_cgfs.so</command> モジュールはそれを検出して再利用する機能を持っています。
107 </para>
108
109 <para>
110 <!--
111 In essence, the <command>pam_cgfs.so</command> module takes care of
112 placing unprivileged (non-root) users into writable cgroups at login
113 and also cleaning up these cgroup hierarchies on logout, so they are free
114 to delegate resources to containers as needed that have been provided to
115 them.
116 -->
117 基本的には <command>pam_cgfs.so</command> モジュールは、ログイン時に非特権(非 root)ユーザが書き込みできる cgroup を配置し、ログアウト時にもその cgroup ツリーをクリーンアップする処理を行います。したがって、必要に応じて提供されているリソースをコンテナに自由に委譲できます。
118 </para>
119
120 </refsect1>
121
122 <refsect1>
123
124 <title><!-- Options -->オプション</title>
125
126 <variablelist>
127
128 <varlistentry>
129 <term> <option>-c <replaceable>controller-list</replaceable></option> </term>
130 <listitem>
131 <para>
132 <!--
133 Takes a string argument which sets the list of kernel controllers and
134 named controllers delimited by commas in-between “,”. Named controllers
135 need to be specified in the form “name=$namedcontroller”. Can use “all”
136 enable all cgroup resource controller hierarchies. Specifying “all” and
137 other controllers explicitly returns PAM_SESSION_ERR.
138 -->
139 カンマ(",")で区切られたカーネルコントローラと名前付きコントローラ(訳注: mount オプションとして name オプションで名前を指定してマウントした cgroup v1 ツリー)のリストを設定した文字列の引数を取ります。名前付きコントローラは "name=$namedcontroller" の形で指定する必要があります。"all" を指定して、すべての cgroup リソースコントローラーのツリーを有効にできます。"all" と他のコントローラを同時に指定すると、明確に PAM_SESSION_ERR が返ります。
140 </para>
141 </listitem>
142 </varlistentry>
143
144 </variablelist>
145
146 </refsect1>
147
148 <refsect1>
149 <title>Module types provided</title>
150 <para>
151 <!--
152 Only <option>session</option> module type is provided (and needed).
153 -->
154 モジュールタイプとして <option>session</option> のみが提供されます(そして必要です)。
155 </para>
156 </refsect1>
157
158 <refsect1>
159
160 <title><!-- Return Values -->返り値</title>
161
162 <variablelist>
163
164 <varlistentry>
165 <term>PAM_SUCCESS</term>
166 <listitem>
167 <para>
168 <!--
169 Writeable cgroups have been created for the user.
170 -->
171 ユーザ用の書き込み可能な cgroup が作成されました。
172 </para>
173 </listitem>
174 </varlistentry>
175
176 <varlistentry>
177 <term>PAM_SESSION_ERR</term>
178 <listitem>
179 <para>
180 <!--
181 Failed to create writable cgroups for the user.
182 -->
183 ユーザ用の書き込み可能な cgroup の作成が失敗しました。
184 </para>
185 </listitem>
186 </varlistentry>
187
188 </variablelist>
189
190 </refsect1>
191
192 <refsect1>
193
194 <title><!-- Files -->ファイル</title>
195
196 <variablelist>
197
198 <varlistentry>
199 <term>/etc/pam.d/common-session{,-noninteractive}</term>
200 <listitem>
201 <para>
202 <!--
203 Default configuration is added at the end of these files.
204 -->
205 これらのファイルの最後にデフォルト設定が追加されます。
206 </para>
207 </listitem>
208 </varlistentry>
209
210 </variablelist>
211
212 </refsect1>
213
214 <refsect1>
215 <title><!-- EXAMPLE -->例</title>
216 <!--
217 <programlisting>
218 session optional pam_cgfs.so -c freezer,memory,named=systemd
219 # default configuration
220 # user writable cgroups are created under freezer, memory and named cgroup systemd hierarchies.
221 # /sys/fs/cgroup/$controller/user/$user/n for freezer,memory.
222 # /sys/fs/cgroup/systemd/user.slice/user-$uid/session-n.scope for systemd.
223
224 session optional pam_cgfs.so -c all
225 # user writable cgroups are created under all cgroup controllers.
226
227 session optional pam_cgfs.so -c all,memory,freezer
228 # invalid argument and returns PAM_SESSION_ERR
229 </programlisting>
230 -->
231 <programlisting>
232 session optional pam_cgfs.so -c freezer,memory,named=systemd
233 # デフォルト設定
234 # ユーザが書き込み可能な cgroup が freezer, memory, 名前付き cgroup "systemd" ツリー以下に作成されます。
235 # freezer と memory に対しては /sys/fs/cgroup/$controller/user/$user/n
236 # systemd に対しては /sys/fs/cgroup/systemd/user.slice/user-$uid/session-n.scope
237
238 session optional pam_cgfs.so -c all
239 # すべての cgroup コントローラ以下にユーザが書き込み可能な cgroup が作成されます
240
241 session optional pam_cgfs.so -c all,memory,freezer
242 # 不正な引数なので PAM_SESSION_ERR が返ります
243 </programlisting>
244 </refsect1>
245
246 <refsect1>
247 <title>See Also</title>
248
249 <simpara>
250 <citerefentry>
251 <refentrytitle><command>lxc-cgroup</command></refentrytitle>
252 <manvolnum>1</manvolnum>
253 </citerefentry>,
254
255 <citerefentry>
256 <refentrytitle><command>cgroups</command></refentrytitle>
257 <manvolnum>7</manvolnum>
258 </citerefentry>,
259
260 <citerefentry>
261 <refentrytitle><command>user_namespaces</command></refentrytitle>
262 <manvolnum>7</manvolnum>
263 </citerefentry>,
264
265 <citerefentry>
266 <refentrytitle><command>namespaces</command></refentrytitle>
267 <manvolnum>7</manvolnum>
268 </citerefentry>,
269
270 <citerefentry>
271 <refentrytitle><command>pam</command></refentrytitle>
272 <manvolnum>8</manvolnum>
273 </citerefentry>
274 </simpara>
275
276
277 </refsect1>
278
279 </refentry>
280
281 <!-- Keep this comment at the end of the file
282 Local variables:
283 mode: sgml
284 sgml-omittag:t
285 sgml-shorttag:t
286 sgml-minimize-attributes:nil
287 sgml-always-quote-attributes:t
288 sgml-indent-step:2
289 sgml-indent-data:t
290 sgml-parent-document:nil
291 sgml-default-dtd-file:nil
292 sgml-exposed-tags:nil
293 sgml-local-catalogs:nil
294 sgml-local-ecat-files:nil
295 End:
296 -->