[Memo2011][ITPASS]サーバ交換作業(DNS, gate)

phase 1 (入替え開始)

DNS 班が行う作業は特になかった.

phase 2

tako 側の ika に対する通信許可の設定

tako の /etc/ssh/sshd_config で,

PermitRootLogin yes

となっていることを確認した.

PermitRootLogin forced-commands-only

という部分はなかった. その後,

tako# /etc/init.d/ssh restart

として設定を反映させた.

ika から tako へ各種データをコピー

  • ika の /var/spool/cron/crontabs 以下の各ファイルを tako へコピーした.

    root@ika-itpass:/var/spool/cron# scp -p -r crontabs root@tako-itpass:/var/spool/cron/
  • ika の /etc/shadow のユーザ部分を tako へコピーした.
    • ika, tako に別々の仮想端末でログインした.

tako の /etc/shadow を/etc/shadow~にバックアップした. ika の /etc/shadow を tako へ tmp ファイルとしてコピーし, diff コマンドで tmp ファイルと tako の /etc/shadow を比較し, コピーする必要がある内容がないことを確認した. その後, tmp ファイルを削除した.

  • /home ディレクトリを rsync する

前日の作業における rsync 以降に何らかの作業が行なわれ, home 以下の内容が変更されているかもしれないので, もう一度 rsync を行なう.

tako 側の ika に対する通信制限の設定

先ほど, ika から tako に rsync でファイルを転送するために, root のログインを許可したので, 設定を以下のように変更して元に戻した.

/etc/ssh/sshd_config の

PermitRootLogin yes

という部分を

PermitRootLogin no

に変更したのち,

new# /etc/init.d/ssh restart

として設定を反映させた.

ika の authorized_keys を編集

  • ika にある /root/authorized_keys(tako-itpass の公開鍵)の冒頭に以下を加えた.

    command="rsync --server -vlogDtpr --delete . /home/",no-pty,from="ika-itpass.scitec.kobe-u.ac.jp",
    no-port-forwarding,no-X11-forwarding,no-agent-forwarding
  • ファイル名を authorized_keys.bk に変更し, root ログインを完全に拒否するようにした.

phase 3

  • tako
    • bind を止めてサーバ起動時に bind が立ち上がらないように、起動スクリプトを変更した.

      root@tako-itpass:/etc/init.d# /etc/init.d/bind stop
      root@tako-itpass:/etc/init.d# update-rc.d -f bind remove
       Removing any system startup links for /etc/init.d/bind ...
        /etc/rc0.d/K20bind
        /etc/rc1.d/K20bind
        /etc/rc2.d/S20bind
        /etc/rc3.d/S20bind
        /etc/rc4.d/S20bind
        /etc/rc5.d/S20bind
        /etc/rc6.d/K20bind
  • ika
    • namedb のバックアップを作成した.

      root@ika-itpass:/usr/local/bind/etc# cp -r namedb namedb-20111104
    • サーバ起動時に bind が立ち上がるよう, 起動スクリプトを変更した.

      root@ika-itpass:/usr/local/bind/etc# update-rc.d bind defaults

ここで

insserv: warning: script 'K01tcpserver' missing LSB tags and overrides
insserv: warning: script 'tcpserver' missing LSB tags and overrides

のように tcpserver にLSBの警告が出たので, 以下を /etc/init.d/tcpserver の冒頭に追記した.

### BEGIN INIT INFO
# Provides:          tcpserver
# Required-Start:    $remote_fs
# Required-Stop:     $remote_fs
# Should-Start:      $network $syslog
# Should-Stop:       $network $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start and stop tcpserver
# Description:       tcpserver is  access control program
#        which translates ip addresses to and from internet names
### END INIT INFO

その後, update-rc.d -f bind remove を実行してから, もういちど update-rc.d bind defaults を実行したところ,

root@ika-itpass:/usr/local/bind/etc# update-rc.d -f bind defaults
update-rc.d: using dependency based boot sequencing

と表示され, 警告が出ないことを確認した.

  • resolv.conf の書き換え

/etc/resolv.conf を以下のように書き換えた.

nameserver 127.0.0.1
#nameserver 133.30.14.2
#nameserver 133.30.14.3
#nameserver 133.30.8.2
search scitec.kobe-u.ac.jp

bind の起動確認

サーバ交換作業が終わったので, ika と tako を reboot して, bind が起動するかどうかを確認した.
  • ika (bindが起動していることを確認)

    ika-itpass:$ ps ax | grep bind
    1674 ?        Ss     0:00 /usr/local/bind/sbin/named -c /usr/local/bind/etc/namedb/named.conf -u bind
    2496 pts/0    S+     0:00 grep bind
  • tako (bindを起動していないことを確認)

    tako-itpass:$ ps ax | grep bind
    3380 pts/0    R+     0:00 grep bind

phase 4

移行の最終チェック

  • tako と ika でそれぞれ問い合わせに応じるか, 正しいデータを返すかをチェックした.

    $ dig itpass.scitec.kobe-u.ac.jp 
    
    --> 133.30.109.22を返したので OK.
    
    $ dig tako-itpass.scitec.kobe-u.ac.jp 
    
    --> 133.30.109.21を返したので OK.
    
    $ dig ika-itpass.scitec.kobe-u.ac.jp 
    
    --> 133.30.109.22を返したので OK.

後日の作業

  • 要らないファイルの削除

    今回はコピーせずに行ったため, この作業は必要ない.

[ITPASSサーバ構築ドキュメント へ戻る]

Last modified:2011/12/02 11:22:02
Keyword(s):
References:[[ITPASS2011]2011年度サーバ構築ログ]