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