More Related Content
PDF
PPT
PPTX
PDF
PDF
PDF
Docker で xxxxxxサーバ を つくれませんでした PDF
PPTX
What's hot
PDF
PDF
PDF
Firefox OS + Raspberry Pi PDF
PPTX
PPT
ODP
Xen4.0 and vt-d Network Performance Benchmark PDF
/etc/network/interfaces について PDF
PDF
httpd.conf line 1 to 7, 24 PPT
PDF
Openstack calendar20141222 PDF
PDF
PDF
PPTX
PDF
PDF
Scapy presentation Remake(訂正) PDF
OpenIndiana vWire Demo (Japanese) PDF
20160827 第24回シェル芸勉強会LT Bash on Windows環境非破壊ハンズオン Jailが起動しないので調査してみた
- 1.
- 2.
- 3.
環境
• OS:FreeBSD10.3 onXenServer
– Linden 1cpu、2GByte
• この上で3つのJail環境を動かしています
– tuba、viola、pianica
• /etc/rc.conf.local
– Jail_enabled=“YES”
• /etc/jail.conf
<省略>
# each jail
tuba { ip4.addr = 192.168.1.71;}
pianica { ip4.addr = 192.168.1.72;}
viola {ip4.addr = 192.168.1.73;}
2017-6-30
3
1
- 4.
あれ?サーバ上がってない?
• Jailを確認する
* JIDIP Address Hostname Path
1 192.168.1.72 pianica /jail/pianica
2 192.168.1.71 tuba /jail/tuba
• ( ゚д゚) ・・・
• (つд⊂)ゴシゴシ
• (;゚д゚) ・・・
• なぜ、2つしか上がってない?
2017-6-30
4
1
- 5.
- 6.
- 7.
Rc_debug=“YES”でログをとる
• うん、ちゃんと動いてる
Jun 2718:47:17 linden root: /etc/rc: DEBUG: run_rc_command: doit: /usr/sbin/cron -s
Jun 27 18:47:17 linden root: /etc/rc: DEBUG: checkyesno: jail_enable is set to YES.
Jun 27 18:47:17 linden root: /etc/rc: DEBUG: run_rc_command: doit: jail_start _ALL
Jun 27 18:47:21 linden root: /etc/rc: DEBUG: run_rc_command: start_postcmd: jail_warn _ALL
Jun 27 18:47:21 linden kernel: pianica tuba viola
JID IP Address Hostname Path
1 192.168.1.72 pianica /jail/pianica
2 192.168.1.71 tuba /jail/tuba
3 192.168.1.73 viola /jail/viola
• おっとぉ
Jun 27 18:47:17 linden root: /etc/rc: DEBUG: run_rc_command: doit: /usr/sbin/cron -s
Jun 27 18:47:17 linden root: /etc/rc: DEBUG: checkyesno: jail_enable is set to YES.
Jun 27 18:47:17 linden root: /etc/rc: DEBUG: run_rc_command: doit: jail_start _ALL
Jun 27 18:47:21 linden root: /etc/rc: DEBUG: run_rc_command: start_postcmd: jail_warn _ALL
Jun 27 18:47:21 chives kernel: tuba: created
JID IP Address Hostname Path
1 192.168.1.72 pianica /jail/pianica
2 192.168.1.71 tuba /jail/tuba
2017-6-30
7
2
- 8.
- 9.
/etc/rc.d/jailを読んでみまひょ
_ALL)
command=$jail_program
rc_flags=$jail_flags
command_args="-f $jail_conf -c"
_tmp=`mktemp-t jail` || exit 3
if $command $rc_flags $command_args >> $_tmp 2>&1; then
$jail_jls jid name | while read _id _name; do
echo -n " $_name"
echo $_id > /var/run/jail_${_name}.id
done
else
tail -1 $_tmp
fi
rm -f $_tmp
echo '.'
return
;;
esac
指定なしでくるところ
2017-6-30
COPYRIGHT
9
for _j in $@; do
_j=$(echo $_j | tr /. _)
_jv=$(echo -n $_j | tr -c '[:alnum:]' _)
parse_options $_j $_jv || continue
eval rc_flags=¥${jail_${_jv}_flags:-$jail_flags}
eval command=¥${jail_${_jv}_program:-$jail_program}
command_args="-i -f $_conf -c $_j"
_tmp=`mktemp -t jail` || exit 3
if $command $rc_flags $command_args ¥
>> $_tmp 2>&1 </dev/null; then
echo -n " ${_hostname:-${_j}}"
_jid=$($jail_jls -j $_j jid)
echo $_jid > /var/run/jail_${_j}.id
else
rm -f /var/run/jail_${_j}.id
echo " cannot start jail " ¥
"¥"${_hostname:-${_j}}¥": "
cat $_tmp
fi
rm -f $_tmp
done
Jail名を指定している場合
2
- 10.
- 11.
再現するかな?
# jail -f/etc/jail.conf -c ; jls
pianica: created
tuba: created
viola: created
JID IPAddress Hostname Path
23 192.168.1.72 pianica /jail/pianica
24 192.168.1.71 tuba /jail/tuba
25 192.168.1.73 viola /jail/viola
# jail -f /etc/jail.conf -c ; jls
ifconfig: ioctl (SIOCAIFADDR): Address already in use
jail: pianica: ifconfig xn0 inet 192.168.1.72 add: failed
tuba: created
viola: created
JID IPAddress Hostname Path
26 192.168.1.71 tuba /jail/tuba
27 192.168.1.73 viola /jail/viola
2017-6-30
11
2
- 12.
一台ずつでloopと同じように起動してみる
root@linden:~ # jail-f /etc/jail.conf -c pianica
pianica: created
root@linden:~ # jail -f /etc/jail.conf -c viola
viola: created
root@linden:~ # jail -f /etc/jail.conf -c tuba ; jls;
tuba: created
JID IPAddress Hostname Path
436 192.168.1.72 pianica /jail/pianica
437 192.168.1.73 viola /jail/viola
438 192.168.1.71 tuba /jail/tuba
• まぁ回避はできたみたいだ
• 再起動でも症状は出ないみたいだ
2017-6-30
12
2
- 13.
- 14.
- 15.
jail_parallel_start=“YES”
• 再起動してJailを確認する
* JIDIP Address Hostname Path
1 192.168.1.72 pianica /jail/pianica
2 192.168.1.71 tuba /jail/tuba
• コマンドラインでも再現する
ifconfig: ioctl (SIOCAIFADDR): Address already in use
jail: pianica: ifconfig xn0 inet 192.168.1.72 add: failed
2017-6-30
15
3
- 16.
- 17.