]>
Commit | Line | Data |
---|---|---|
57da8c32 KY |
1 | <!-- |
2 | ||
3 | lxc: linux Container library | |
4 | ||
5 | (C) Copyright IBM Corp. 2007, 2008 | |
6 | ||
7 | Authors: | |
8 | Daniel Lezcano <daniel.lezcano at free.fr> | |
9 | ||
10 | This library is free software; you can redistribute it and/or | |
11 | modify it under the terms of the GNU Lesser General Public | |
12 | License as published by the Free Software Foundation; either | |
13 | version 2.1 of the License, or (at your option) any later version. | |
14 | ||
15 | This library is distributed in the hope that it will be useful, | |
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | Lesser General Public License for more details. | |
19 | ||
20 | You should have received a copy of the GNU Lesser General Public | |
21 | License along with this library; if not, write to the Free Software | |
a5ba9671 | 22 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
57da8c32 | 23 | |
8900b9eb | 24 | Translated into Japanese |
57da8c32 KY |
25 | by KATOH Yasufumi <karma at jazz.email.ne.jp> |
26 | ||
27 | --> | |
28 | ||
faefa7f8 | 29 | <!DOCTYPE refentry PUBLIC @docdtd@ [ |
57da8c32 KY |
30 | |
31 | <!ENTITY commonoptions SYSTEM "@builddir@/common_options.sgml"> | |
32 | <!ENTITY seealso SYSTEM "@builddir@/see_also.sgml"> | |
33 | ]> | |
34 | ||
35 | <refentry> | |
36 | ||
37 | <docinfo><date>@LXC_GENERATE_DATE@</date></docinfo> | |
38 | ||
39 | <refmeta> | |
40 | <refentrytitle>lxc-attach</refentrytitle> | |
41 | <manvolnum>1</manvolnum> | |
42 | </refmeta> | |
43 | ||
44 | <refnamediv> | |
45 | <refname>lxc-attach</refname> | |
46 | ||
47 | <refpurpose> | |
48 | <!-- | |
49 | start a process inside a running container. | |
50 | --> | |
6127da6b | 51 | 実行中のコンテナ内でプロセスの開始 |
57da8c32 KY |
52 | </refpurpose> |
53 | </refnamediv> | |
54 | ||
55 | <refsynopsisdiv> | |
56 | <cmdsynopsis> | |
57 | <command>lxc-attach</command> | |
c91e90b5 KY |
58 | <arg choice="req">-n, --name <replaceable>name</replaceable></arg> |
59 | <arg choice="opt">-f, --rcfile <replaceable>config_file</replaceable></arg> | |
60 | <arg choice="opt">-a, --arch <replaceable>arch</replaceable></arg> | |
61 | <arg choice="opt">-e, --elevated-privileges <replaceable>privileges</replaceable></arg> | |
62 | <arg choice="opt">-s, --namespaces <replaceable>namespaces</replaceable></arg> | |
63 | <arg choice="opt">-R, --remount-sys-proc</arg> | |
57da8c32 KY |
64 | <arg choice="opt">--keep-env</arg> |
65 | <arg choice="opt">--clear-env</arg> | |
c91e90b5 KY |
66 | <arg choice="opt">-v, --set-var <replaceable>variable</replaceable></arg> |
67 | <arg choice="opt">--keep-var <replaceable>variable</replaceable></arg> | |
a4a0bba4 KY |
68 | <arg choice="opt">-u, --uid <replaceable>uid</replaceable></arg> |
69 | <arg choice="opt">-g, --gid <replaceable>gid</replaceable></arg> | |
57da8c32 KY |
70 | <arg choice="opt">-- <replaceable>command</replaceable></arg> |
71 | </cmdsynopsis> | |
72 | </refsynopsisdiv> | |
73 | ||
74 | <refsect1> | |
75 | <title><!-- Description -->説明</title> | |
76 | ||
77 | <para> | |
78 | <!-- | |
79 | <command>lxc-attach</command> runs the specified | |
80 | <replaceable>command</replaceable> inside the container | |
81 | specified by <replaceable>name</replaceable>. The container | |
82 | has to be running already. | |
83 | --> | |
dc421f3a KY |
84 | <command>lxc-attach</command> は <replaceable>name</replaceable> で指定したコンテナ内で指定した <replaceable>command</replaceable> を実行します。 |
85 | 実行する時点でコンテナが実行中でなければなりません。 | |
57da8c32 KY |
86 | </para> |
87 | <para> | |
88 | <!-- | |
89 | If no <replaceable>command</replaceable> is specified, the | |
90 | current default shell of the user running | |
91 | <command>lxc-attach</command> will be looked up inside the | |
92 | container and executed. This will fail if no such user exists | |
93 | inside the container or the container does not have a working | |
94 | nsswitch mechanism. | |
95 | --> | |
dc421f3a KY |
96 | もし <replaceable>command</replaceable> が指定されていない場合、<command>lxc-attach</command> コマンドを実行したユーザのデフォルトシェルをコンテナ内で調べて実行します。 |
97 | もしコンテナ内にユーザが存在しない場合や、コンテナで nsswitch 機構が働いていない場合はこの動作は失敗します。 | |
57da8c32 | 98 | </para> |
b6acc629 KY |
99 | <para> |
100 | <!-- | |
101 | Previous versions of <command>lxc-attach</command> simply attached to the | |
f025e648 KY |
102 | specified namespaces of a container and ran a shell or the specified command |
103 | without first allocating a pseudo terminal. This made them vulnerable to | |
b6acc629 KY |
104 | input faking via a TIOCSTI <command>ioctl</command> call after switching |
105 | between userspace execution contexts with different privilege levels. Newer | |
106 | versions of <command>lxc-attach</command> will try to allocate a pseudo | |
08401048 CB |
107 | terminal file descriptor pair on the host and attach any standard file |
108 | descriptors which refer to a terminal to the container side of the pseudo | |
f025e648 KY |
109 | terminal before executing a shell or command. Note, that if none of the |
110 | standard file descriptors refer to a terminal <command>lxc-attach</command> | |
111 | will not try to allocate a pseudo terminal. Instead it will simply attach | |
112 | to the containers namespaces and run a shell or the specified command. | |
b6acc629 | 113 | --> |
f025e648 | 114 | 前のバージョンの <command>lxc-attach</command> は、単に指定したコンテナの名前空間にアタッチし、最初に擬似端末 (pseudo terminal) を割り当てないで、シェルもしくは指定したコマンドを実行しました。 |
b6acc629 | 115 | これは、異なる特権レベルを持つユーザ空間の実行コンテキストを切り替えた後に、TIOCSTI <command>ioctl</command> の呼び出し経由で擬似入力を行うことに対して脆弱となります。 |
a4a0bba4 | 116 | 新しいバージョンの <command>lxc-attach</command> は、ホスト上の擬似端末のファイルディスクリプタのペアを割り当てようとします。そしてシェルやコマンドを実行する前に、擬似端末のコンテナ側に対して、ターミナルを参照する標準ファイルディスクリプタをアタッチします。 |
b6acc629 KY |
117 | ターミナルを参照する標準ファイルディスクリプタがない場合は、<command>lxc-attach</command> は擬似端末の割り当てを行わないことに注意してください。代わりに、単にコンテナの名前空間にアタッチし、シェルや指定したコマンドを実行します。 |
118 | </para> | |
57da8c32 KY |
119 | |
120 | </refsect1> | |
121 | ||
122 | <refsect1> | |
123 | ||
124 | <title><!-- Options -->オプション</title> | |
125 | ||
126 | <variablelist> | |
127 | ||
c91e90b5 KY |
128 | <varlistentry> |
129 | <term> | |
130 | <option>-f, --rcfile <replaceable>config_file</replaceable></option> | |
131 | </term> | |
132 | <listitem> | |
133 | <para> | |
134 | <!-- | |
135 | Specify the configuration file to configure the virtualization | |
136 | and isolation functionalities for the container. | |
137 | --> | |
138 | コンテナの仮想化、隔離機能の設定のための設定ファイルを指定します。 | |
139 | </para> | |
140 | <para> | |
141 | <!-- | |
142 | This configuration file if present will be used even if there is | |
143 | already a configuration file present in the previously created | |
144 | container (via lxc-create). | |
145 | --> | |
146 | (lxc-create 経由で) 前もってコンテナが作られた際の設定ファイルが既にあった場合でも、このオプションが指定された場合は、指定した設定ファイルが使用されます。 | |
147 | </para> | |
148 | </listitem> | |
149 | </varlistentry> | |
150 | ||
57da8c32 KY |
151 | <varlistentry> |
152 | <term> | |
153 | <option>-a, --arch <replaceable>arch</replaceable></option> | |
154 | </term> | |
155 | <listitem> | |
156 | <para> | |
157 | <!-- | |
158 | Specify the architecture which the kernel should appear to be | |
159 | running as to the command executed. This option will accept the | |
160 | same settings as the <option>lxc.arch</option> option in | |
161 | container configuration files, see | |
162 | <citerefentry> | |
163 | <refentrytitle><filename>lxc.conf</filename></refentrytitle> | |
164 | <manvolnum>5</manvolnum> | |
a1e0e6df | 165 | </citerefentry>. By default, the current architecture of the |
57da8c32 KY |
166 | running container will be used. |
167 | --> | |
dc421f3a KY |
168 | コマンドを実行するコンテナのアーキテクチャを指定します。 |
169 | このオプションは、コンテナの設定ファイルで指定する <option>lxc.arch</option> オプションと同じものが使用可能です。 | |
57da8c32 KY |
170 | <citerefentry> |
171 | <refentrytitle><filename>lxc.conf</filename></refentrytitle> | |
172 | <manvolnum>5</manvolnum> | |
dc421f3a | 173 | </citerefentry> を参照してください。デフォルトでは、実行しているコンテナのアーキテクチャになります。 |
57da8c32 KY |
174 | </para> |
175 | </listitem> | |
176 | </varlistentry> | |
177 | ||
178 | <varlistentry> | |
179 | <term> | |
1b29d73c KY |
180 | <option> |
181 | -e, --elevated-privileges <replaceable>privileges</replaceable> | |
182 | </option> | |
57da8c32 KY |
183 | </term> |
184 | <listitem> | |
185 | <para> | |
186 | <!-- | |
187 | Do not drop privileges when running | |
188 | <replaceable>command</replaceable> inside the container. If | |
189 | this option is specified, the new process will | |
190 | <emphasis>not</emphasis> be added to the container's cgroup(s) | |
191 | and it will not drop its capabilities before executing. | |
192 | --> | |
dc421f3a KY |
193 | コンテナの内部で <replaceable>command</replaceable> を実行する時に特権を削除しません。 |
194 | もしこのオプションが指定された場合、新しいプロセスはコンテナの cgroup に追加 <emphasis>されず</emphasis>、実行する前にケーパビリティ (capability) も削除しません。 | |
57da8c32 | 195 | </para> |
1b29d73c KY |
196 | <para> |
197 | <!-- | |
198 | You may specify privileges, in case you do not want to elevate all of | |
199 | them, as a pipe-separated list, e.g. | |
200 | <replaceable>CGROUP|LSM</replaceable>. Allowed values are | |
201 | <replaceable>CGROUP</replaceable>, <replaceable>CAP</replaceable> and | |
202 | <replaceable>LSM</replaceable> representing cgroup, capabilities and | |
35247006 KY |
203 | restriction privileges respectively. (The pipe symbol needs to be escaped, |
204 | e.g. <replaceable>CGROUP\|LSM</replaceable> or quoted, e.g. | |
205 | <replaceable>"CGROUP|LSM"</replaceable>.) | |
1b29d73c | 206 | --> |
dc421f3a KY |
207 | 全ての特権の取得したくない場合は、パイプで連結したリストとして、例えば <replaceable>CGROUP|LSM</replaceable> のように、特権を指定することが可能です。 |
208 | 指定できる値は、それぞれ cgroup、ケーパビリティ、特権の制限を表す <replaceable>CGROUP</replaceable>、<replaceable>CAP</replaceable>、<replaceable>LSM</replaceable> です。 | |
35247006 | 209 | (パイプ記号を <replaceable>CGROUP\|LSM</replaceable> のようにエスケープするか、<replaceable>"CGROUP|LSM"</replaceable> のように引用符号を付ける必要があります。) |
1b29d73c | 210 | </para> |
57da8c32 KY |
211 | <para> |
212 | <!-- | |
213 | <emphasis>Warning:</emphasis> This may leak privileges into the | |
214 | container if the command starts subprocesses that remain active | |
215 | after the main process that was attached is terminated. The | |
216 | (re-)starting of daemons inside the container is problematic, | |
217 | especially if the daemon starts a lot of subprocesses such as | |
218 | <command>cron</command> or <command>sshd</command>. | |
219 | <emphasis>Use with great care.</emphasis> | |
220 | --> | |
9a97d4e4 | 221 | <emphasis>警告:</emphasis> |
dc421f3a KY |
222 | もし実行するコマンドが、アタッチするメインプロセスが終了した後も実行されたままのサブプロセスを開始するような場合、このオプションの指定はコンテナ内への特権のリークとなる可能性があります。 |
223 | コンテナ内でのデーモンの開始(もしくは再起動)は問題となります。 | |
224 | デーモンが多数のサブプロセスを開始する <command>cron</command> や <command>sshd</command> のような場合は特に問題となります。 | |
225 | <emphasis>充分な注意を払って使用してください。</emphasis> | |
57da8c32 KY |
226 | </para> |
227 | </listitem> | |
228 | </varlistentry> | |
229 | ||
230 | <varlistentry> | |
231 | <term> | |
232 | <option>-s, --namespaces <replaceable>namespaces</replaceable></option> | |
233 | </term> | |
234 | <listitem> | |
235 | <para> | |
236 | <!-- | |
237 | Specify the namespaces to attach to, as a pipe-separated list, | |
238 | e.g. <replaceable>NETWORK|IPC</replaceable>. Allowed values are | |
239 | <replaceable>MOUNT</replaceable>, <replaceable>PID</replaceable>, | |
240 | <replaceable>UTSNAME</replaceable>, <replaceable>IPC</replaceable>, | |
241 | <replaceable>USER </replaceable> and | |
242 | <replaceable>NETWORK</replaceable>. This allows one to change | |
243 | the context of the process to e.g. the network namespace of the | |
244 | container while retaining the other namespaces as those of the | |
35247006 KY |
245 | host. (The pipe symbol needs to be escaped, e.g. |
246 | <replaceable>MOUNT\|PID</replaceable> or quoted, e.g. | |
247 | <replaceable>"MOUNT|PID"</replaceable>.) | |
57da8c32 | 248 | --> |
dc421f3a KY |
249 | アタッチする名前空間をパイプで連結したリストで指定します。 |
250 | 例えば <replaceable>NETWORK|IPC</replaceable> のようにです。 | |
251 | ここで使用可能な値は <replaceable>MOUNT</replaceable>, <replaceable>PID</replaceable>, <replaceable>UTSNAME</replaceable>, <replaceable>IPC</replaceable>, <replaceable>USER </replaceable>, <replaceable>NETWORK</replaceable> です。 | |
252 | これにより指定した名前空間にプロセスのコンテキストを変更できます。 | |
253 | 例えばコンテナのネットワーク名前空間に変更する一方で、他の名前空間はホストの名前空間のままにするというような事が可能です。 | |
35247006 | 254 | (パイプ記号を <replaceable>MOUNT\|PID</replaceable> のようにエスケープするか、<replaceable>"MOUNT|PID"</replaceable> のように引用符号を付ける必要があります。) |
57da8c32 KY |
255 | </para> |
256 | <para> | |
257 | <!-- | |
258 | <emphasis>Important:</emphasis> This option implies | |
259 | <option>-e</option>. | |
260 | --> | |
dc421f3a | 261 | <emphasis>重要:</emphasis> このオプションは <option>-e</option> オプションを指定しなくても指定している場合と同様の動作をします。 |
57da8c32 KY |
262 | </para> |
263 | </listitem> | |
264 | </varlistentry> | |
265 | ||
266 | <varlistentry> | |
267 | <term> | |
268 | <option>-R, --remount-sys-proc</option> | |
269 | </term> | |
270 | <listitem> | |
271 | <para> | |
272 | <!-- | |
273 | When using <option>-s</option> and the mount namespace is not | |
274 | included, this flag will cause <command>lxc-attach</command> | |
275 | to remount <replaceable>/proc</replaceable> and | |
276 | <replaceable>/sys</replaceable> to reflect the current other | |
277 | namespace contexts. | |
278 | --> | |
dc421f3a KY |
279 | <option>-s</option> を指定し、そこにマウント名前空間が含まれない時、このオプションにより <command>lxc-attach</command> は <replaceable>/proc</replaceable> と <replaceable>/sys</replaceable> をリマウントします。 |
280 | これは現在の他の名前空間のコンテキストを反映させるためです。 | |
57da8c32 KY |
281 | </para> |
282 | <para> | |
283 | <!-- | |
284 | Please see the <emphasis>Notes</emphasis> section for more | |
285 | details. | |
286 | --> | |
dc421f3a | 287 | もっと詳細な説明は <emphasis>注意</emphasis> を参照してください。 |
57da8c32 KY |
288 | </para> |
289 | <para> | |
290 | <!-- | |
291 | This option will be ignored if one tries to attach to the | |
292 | mount namespace anyway. | |
293 | --> | |
dc421f3a | 294 | このオプションは、マウント名前空間へのアタッチが行われる場合は無視されます。 |
57da8c32 KY |
295 | </para> |
296 | </listitem> | |
297 | </varlistentry> | |
298 | ||
299 | <varlistentry> | |
300 | <term> | |
301 | <option>--keep-env</option> | |
302 | </term> | |
303 | <listitem> | |
304 | <para> | |
305 | <!-- | |
306 | Keep the current environment for attached programs. This is | |
307 | the current default behaviour (as of version 0.9), but is | |
308 | is likely to change in the future, since this may leak | |
309 | undesirable information into the container. If you rely on | |
310 | the environment being available for the attached program, | |
311 | please use this option to be future-proof. In addition to | |
312 | current environment variables, container=lxc will be set. | |
313 | --> | |
dc421f3a KY |
314 | アタッチされるプログラムに対して現在の環境を保持したままにします。 |
315 | これは現在 (バージョン 0.9 時点) のデフォルトの動作ですが、将来は変更される予定です。 | |
316 | この動作がコンテナ内への望ましくない情報の漏洩につながる可能性があるためです。 | |
317 | アタッチするプログラムで環境変数が利用可能であることを期待している場合、将来的にもそれが保証されるようにこのオプションを使用するようにしてください。 | |
318 | 現在の環境変数に加えて、container=lxc が設定されます。 | |
57da8c32 KY |
319 | </para> |
320 | </listitem> | |
321 | </varlistentry> | |
322 | ||
323 | <varlistentry> | |
324 | <term> | |
325 | <option>--clear-env</option> | |
326 | </term> | |
327 | <listitem> | |
328 | <para> | |
329 | <!-- | |
330 | Clear the environment before attaching, so no undesired | |
331 | environment variables leak into the container. The variable | |
332 | container=lxc will be the only environment with which the | |
333 | attached program starts. | |
334 | --> | |
dc421f3a KY |
335 | アタッチする前に環境変数をクリアします。 |
336 | これによりコンテナへの不要な環境変数の漏洩が起こらなくなります。 | |
337 | 変数 container=lxc のみがアタッチするプログラムの開始の時の環境変数となります。 | |
57da8c32 KY |
338 | </para> |
339 | </listitem> | |
340 | </varlistentry> | |
341 | ||
c91e90b5 KY |
342 | <varlistentry> |
343 | <term> | |
344 | <option>-v, --set-var <replaceable>variable</replaceable></option> | |
345 | </term> | |
346 | <listitem> | |
347 | <para> | |
348 | <!-- | |
349 | Set an additional environment variable that is seen by the | |
350 | attached program in the container. It is specified in the | |
351 | form of "VAR=VALUE", and can be specified multiple times. | |
352 | --> | |
353 | コンテナにアタッチしたプログラムから見える環境変数を追加します。このオプションは "VAR=VALUE" の形式で指定し、複数回指定できます。 | |
354 | </para> | |
355 | </listitem> | |
356 | </varlistentry> | |
357 | ||
358 | <varlistentry> | |
359 | <term> | |
360 | <option>--keep-var <replaceable>variable</replaceable></option> | |
361 | </term> | |
362 | <listitem> | |
363 | <para> | |
364 | <!-- | |
365 | Keep a specified environment variable. It can only be | |
366 | specified in conjunction | |
367 | with <replaceable>\-\-clear-env</replaceable>, and can be | |
368 | specified multiple times. | |
369 | --> | |
370 | <replaceable>--clear-env</replaceable> を指定した際に、クリアせずに保持したままにしたい環境変数を指定します。<replaceable>--clear-env</replaceable> と同時にしか使えません。複数回指定できます。 | |
371 | </para> | |
372 | </listitem> | |
373 | </varlistentry> | |
374 | ||
a4a0bba4 KY |
375 | <varlistentry> |
376 | <term> | |
377 | <option>--u, --uid <replaceable>uid</replaceable></option> | |
378 | </term> | |
379 | <listitem> | |
380 | <para> | |
381 | <!-- | |
382 | Executes the <replaceable>command</replaceable> with user ID | |
383 | <replaceable>uid</replaceable> inside the container. | |
384 | --> | |
385 | コンテナ内で、ユーザ ID <replaceable>uid</replaceable> で <replaceable>command</replaceable> を実行します。 | |
386 | </para> | |
387 | </listitem> | |
388 | </varlistentry> | |
389 | ||
390 | <varlistentry> | |
391 | <term> | |
392 | <option>--g, --gid <replaceable>gid</replaceable></option> | |
393 | </term> | |
394 | <listitem> | |
395 | <para> | |
396 | <!-- | |
397 | Executes the <replaceable>command</replaceable> with group ID | |
398 | <replaceable>gid</replaceable> inside the container. | |
399 | --> | |
400 | コンテナ内で、グループ ID <replaceable>gid</replaceable> で <replaceable>command</replaceable> を実行します。 | |
401 | </para> | |
402 | </listitem> | |
403 | </varlistentry> | |
404 | ||
57da8c32 KY |
405 | </variablelist> |
406 | ||
407 | </refsect1> | |
408 | ||
409 | &commonoptions; | |
410 | ||
411 | <refsect1> | |
412 | <title><!-- Examples -->例</title> | |
413 | <para> | |
414 | <!-- | |
415 | To spawn a new shell running inside an existing container, use | |
416 | <programlisting> | |
417 | lxc-attach -n container | |
418 | </programlisting> | |
419 | --> | |
dc421f3a | 420 | 存在するコンテナ内で新しいシェルを生成するには、以下のようにします。 |
57da8c32 KY |
421 | <programlisting> |
422 | lxc-attach -n container | |
423 | </programlisting> | |
424 | </para> | |
425 | <para> | |
426 | <!-- | |
427 | To restart the cron service of a running Debian container, use | |
428 | <programlisting> | |
429 | lxc-attach -n container -- /etc/init.d/cron restart | |
430 | </programlisting> | |
431 | --> | |
dc421f3a | 432 | 実行中の Debian コンテナの cron サービスを再起動するには、以下のように実行します。 |
57da8c32 KY |
433 | <programlisting> |
434 | lxc-attach -n container -- /etc/init.d/cron restart | |
435 | </programlisting> | |
436 | </para> | |
437 | <para> | |
438 | <!-- | |
439 | To deactivate the network link eth1 of a running container that | |
440 | does not have the NET_ADMIN capability, use either the | |
441 | <option>-e</option> option to use increased capabilities, | |
442 | assuming the <command>ip</command> tool is installed: | |
443 | <programlisting> | |
444 | lxc-attach -n container -e -- /sbin/ip link delete eth1 | |
445 | </programlisting> | |
446 | --> | |
dc421f3a | 447 | NET_ADMIN ケーパビリティを持たない実行中のコンテナのネットワークインターフェース eth1 の動作を停止させるには、ケーパビリティを増加させるために <option>-e</option> オプションを指定し、<command>ip</command> ツールがインストールされていることを前提に、以下のように実行します。 |
57da8c32 KY |
448 | <programlisting> |
449 | lxc-attach -n container -e -- /sbin/ip link delete eth1 | |
450 | </programlisting> | |
451 | </para> | |
452 | </refsect1> | |
453 | ||
454 | <refsect1> | |
455 | <title><!-- Compatibility -->互換性</title> | |
456 | <para> | |
457 | <!-- | |
458 | Attaching completely (including the pid and mount namespaces) to a | |
a600d021 KY |
459 | container requires a kernel of version 3.8 or higher, or a |
460 | patched kernel, please see the lxc website for | |
57da8c32 | 461 | details. <command>lxc-attach</command> will fail in that case if |
a600d021 | 462 | used with an unpatched kernel of version 3.7 and prior. |
57da8c32 | 463 | --> |
dc421f3a KY |
464 | (pid とマウント名前空間を含む) コンテナに対する完全なアタッチを行うには 3.8 以上、もしくはパッチを適用したカーネルが必要となります。 |
465 | 詳しくは lxc のウェブサイトを参照してください。 | |
466 | パッチが当たっていない 3.8 より小さなバージョンのカーネルを使った場合は、<command>lxc-attach</command> の実行は失敗するでしょう。 | |
57da8c32 KY |
467 | </para> |
468 | <para> | |
469 | <!-- | |
470 | Nevertheless, it will succeed on an unpatched kernel of version 3.0 | |
471 | or higher if the <option>-s</option> option is used to restrict the | |
472 | namespaces that the process is to be attached to to one or more of | |
473 | <replaceable>NETWORK</replaceable>, <replaceable>IPC</replaceable> | |
474 | and <replaceable>UTSNAME</replaceable>. | |
475 | --> | |
dc421f3a | 476 | しかし、もし <option>-s</option> を使用して、アタッチするものを <replaceable>NETWORK</replaceable>, <replaceable>IPC</replaceable>, <replaceable>UTSNAME</replaceable> の 1 つか複数の名前空間に限定して使用すれば、バージョン 3.0 以上のパッチを適用していないカーネルでもアタッチが成功するでしょう。 |
57da8c32 KY |
477 | </para> |
478 | <para> | |
479 | <!-- | |
a600d021 KY |
480 | Attaching to user namespaces is supported by kernel 3.8 or higher |
481 | with enabling user namespace. | |
57da8c32 | 482 | --> |
dc421f3a | 483 | ユーザ名前空間へのアタッチは、ユーザ名前空間機能を有効にした 3.8 以上のカーネルでサポートされます。 |
57da8c32 KY |
484 | </para> |
485 | </refsect1> | |
486 | ||
487 | <refsect1> | |
488 | <title><!-- Notes -->注意</title> | |
489 | <para> | |
490 | <!-- | |
491 | The Linux <replaceable>/proc</replaceable> and | |
492 | <replaceable>/sys</replaceable> filesystems contain information | |
493 | about some quantities that are affected by namespaces, such as | |
494 | the directories named after process ids in | |
36b33520 | 495 | <replaceable>/proc</replaceable> or the network interface information |
57da8c32 KY |
496 | in <replaceable>/sys/class/net</replaceable>. The namespace of the |
497 | process mounting the pseudo-filesystems determines what information | |
498 | is shown, <emphasis>not</emphasis> the namespace of the process | |
499 | accessing <replaceable>/proc</replaceable> or | |
500 | <replaceable>/sys</replaceable>. | |
501 | --> | |
dc421f3a KY |
502 | Linux の <replaceable>/proc</replaceable> と <replaceable>/sys</replaceable> ファイルシステムは名前空間によって影響を受けるある程度の情報を持っています。 |
503 | これは <replaceable>/proc</replaceable> 内のプロセス ID の名前のディレクトリや、<replaceable>/sys/class/net</replaceable> 内のネットワークインターフェース名のディレクトリなどです。 | |
504 | 擬似ファイルシステムをマウントしているプロセスの名前空間が、どのような情報を表示するかを決定します。 | |
505 | <replaceable>/proc</replaceable> や <replaceable>/sys</replaceable> にアクセスしているプロセスの名前空間が決定するのではありません。 | |
57da8c32 KY |
506 | </para> |
507 | <para> | |
508 | <!-- | |
509 | If one uses the <option>-s</option> option to only attach to | |
510 | the pid namespace of a container, but not its mount namespace | |
511 | (which will contain the <replaceable>/proc</replaceable> of the | |
512 | container and not the host), the contents of <option>/proc</option> | |
513 | will reflect that of the host and not the container. Analogously, | |
514 | the same issue occurs when reading the contents of | |
515 | <replaceable>/sys/class/net</replaceable> and attaching to just | |
516 | the network namespace. | |
517 | --> | |
dc421f3a KY |
518 | <option>-s</option> を使ってコンテナの pid 名前空間のみをアタッチし、マウント名前空間 (これはコンテナの <replaceable>/proc</replaceable> を含み、ホストのは含まないでしょう) はアタッチしない場合、<option>/proc</option> のコンテンツはコンテナのものではなく、ホストのものとなります。 |
519 | 似たような事例として、ネットワーク名前空間のみをアタッチして、<replaceable>/sys/class/net</replaceable> のコンテンツを読んだ場合も同じような事が起こるでしょう。 | |
57da8c32 KY |
520 | </para> |
521 | <para> | |
522 | <!-- | |
523 | To work around this problem, the <option>-R</option> flag provides | |
524 | the option to remount <replaceable>/proc</replaceable> and | |
525 | <replaceable>/sys</replaceable> in order for them to reflect the | |
526 | network/pid namespace context of the attached process. In order | |
527 | not to interfere with the host's actual filesystem, the mount | |
528 | namespace will be unshared (like <command>lxc-unshare</command> | |
e9555a6b | 529 | does) before this is done, essentially giving the process a new |
57da8c32 KY |
530 | mount namespace, which is identical to the hosts's mount namespace |
531 | except for the <replaceable>/proc</replaceable> and | |
532 | <replaceable>/sys</replaceable> filesystems. | |
533 | --> | |
dc421f3a KY |
534 | この問題への対処のために、<option>-R</option> オプションが <replaceable>/proc</replaceable> と <replaceable>/sys</replaceable> が提供されています。 |
535 | これにより、アタッチするプロセスのネットワーク/pid 名前空間のコンテキストを反映させることができます。ホストの実際のファイルシステムに影響を与えないために、実行前にはマウント名前空間は unshare されます (<command>lxc-unshare</command> のように)。 | |
536 | これは、<replaceable>/proc</replaceable> と <replaceable>/sys</replaceable> ファイルシステム以外はホストのマウント名前空間と同じである、新しいマウント名前空間がプロセスに与えられるということです。 | |
57da8c32 | 537 | </para> |
b6acc629 KY |
538 | <para> |
539 | <!-- | |
540 | Previous versions of <command>lxc-attach</command> suffered a bug whereby | |
541 | a user could attach to a containers namespace without being placed in a | |
542 | writeable cgroup for some critical subsystems. Newer versions of | |
543 | <command>lxc-attach</command> will check whether a user is in a writeable | |
544 | cgroup for those critical subsystems. <command>lxc-attach</command> might | |
545 | thus fail unexpectedly for some users (E.g. on systems where an | |
546 | unprivileged user is not placed in a writeable cgroup in critical | |
547 | subsystems on login.). However, this behavior is correct and more secure. | |
548 | --> | |
549 | 以前のバージョンの <command>lxc-attach</command> は、いくつかの重要なサブシステムに対して、書き込み可能な cgroup 内に配置することなしに、ユーザがコンテナの名前空間にアタッチできたバグがありました。 | |
550 | 新しいバージョンの <command>lxc-attach</command> は、このような重要なサブシステムに対して、ユーザが書き込み可能な cgroup 内にいるかどうかをチェックします。 | |
551 | したがって、ユーザによっては <command>lxc-attach</command> は不意に失敗するかもしれません (例えば、非特権ユーザが、ログイン時に重要であるサブシステムの書き込み可能な cgroup に配置されていないようなシステムで)。しかし、この振る舞いは正しく、よりセキュアです。 | |
552 | </para> | |
57da8c32 KY |
553 | </refsect1> |
554 | ||
555 | <refsect1> | |
556 | <title><!-- Security -->セキュリティ</title> | |
557 | <para> | |
558 | <!-- | |
559 | The <option>-e</option> and <option>-s</option> options should | |
560 | be used with care, as it may break the isolation of the containers | |
561 | if used improperly. | |
562 | --> | |
dc421f3a KY |
563 | <option>-e</option> と <option>-s</option> オプションの使用には注意を払うべきです。 |
564 | 不適切に使用した場合、コンテナの隔離を破壊してしまう可能性があります。 | |
57da8c32 KY |
565 | </para> |
566 | </refsect1> | |
567 | ||
568 | &seealso; | |
569 | ||
570 | <refsect1> | |
571 | <title><!-- Author -->作者</title> | |
572 | <para>Daniel Lezcano <email>daniel.lezcano@free.fr</email></para> | |
573 | </refsect1> | |
574 | ||
575 | </refentry> | |
576 | ||
577 | <!-- Keep this comment at the end of the file | |
578 | Local variables: | |
579 | mode: sgml | |
580 | sgml-omittag:t | |
581 | sgml-shorttag:t | |
582 | sgml-minimize-attributes:nil | |
583 | sgml-always-quote-attributes:t | |
584 | sgml-indent-step:2 | |
585 | sgml-indent-data:t | |
586 | sgml-parent-document:nil | |
587 | sgml-default-dtd-file:nil | |
588 | sgml-exposed-tags:nil | |
589 | sgml-local-catalogs:nil | |
590 | sgml-local-ecat-files:nil | |
591 | End: | |
592 | --> |