Jailの設定

環境
  FreeBSD11.0

Jail設定

①設定をrootユーザで行います
su -

②HTTP_PROXYの設定(プロキシ経由でインターネット接続する場合)
setenv HTTP_PROXY 192.168.1.111:8080

③ソースコードのダウンロード
cd ~
fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/11.0-RELEASE/src.txz
tar -C / -xvzf src.txz
rm src.txz

④Jail環境の構築
setenv D /usr/jail/jorg
mkdir -p $D
cd /usr/src
make buildworld
make installworld DESTDIR=$D
make distribution DESTDIR=$D
⑤jailシステム「jorg」の初期設定用に/etc/rc.confを設定
hostname="jailBase"
ifconfig_em0="inet 192.168.1.1 netmask 255.255.255.0"
defaultrouter="192.168.1.254"
keymap="jp"
sshd_enable="YES"
dumpdev="NO"

##############################################################
### Jail Configuration     (rc.conf) #########################
##############################################################
jail_enable="YES"
jail_parallel_start="YES"
jail_list="jorg"
⑥jailシステム「jorg」の初期設定用に/etc/jail.confを新規作成
  「jorg」のIPアドレスはひとまず設定しない。
##############################################################
### Jail Configuration     (jail.conf) #######################
##############################################################
allow.raw_sockets        = 1;
allow.set_hostname       = 0;
allow.sysvipc            = 1;
allow.mount.devfs;
allow.mount;
mount.devfs              = 1;
exec.start               = "/bin/sh /etc/rc";
exec.stop                = "/bin/sh /etc/rc.shutdown";
path                     = "/usr/jail/$name";
host.hostname            = "$name.example.com";

jorg {
}
⑦jail「jorg」を起動する
service jail start
⑧jail「jorg」が起動したか確認する
jls
↓↓↓ IPアドレス無しで「jorg」が起動される
   JID  IP Address      Hostname                      Path
     1                  jorg.example.com              /usr/jail/jorg
⑨jail「jorg」に接続する
jexec jorg /bin/tcsh
↓↓↓「jorg」に接続されプロンプトが変わる
root@jorg:/ # 
⑩jail「jorg」の基本設定を行う
 ■/etc/rc.confの新規作成
network_interfaces="auto"
sshd_enable="YES"
sendmail_enable="NO" 
 ■/etc/resolv.conf.confの設定
network_interfaces="auto"
sshd_enable="YES"
sendmail_enable="NO" 
 ■bsdconfigにより次の項目を設定
    ◇rootパスワードの設定
    ◇ユーザの作成(user1)とパスワード設定
    ◇タイムゾーンの設定 ⑪jail「jorg」を停止する
service jail stop 
⑫jailの基本設定は完了!!
  jailのコピーとサーバ構築は次へ

0 件のコメント:

コメントを投稿