CentOS

2006/1/18 08:38 AM 更新

セキュア化(CentOS 3)

CentOSをインストールした時点では不要なサービスが複数稼動しているため、サーバ構築 前に不必要なサービスを無効にしておく。
※LISTENしているサービスについては一度全て停止するが、それ以外のサービスについて は環境により必要・不必要の判断が異なるため注意が必要。

LISTENしているサービスのランレベルを変更する。
# /sbin/chkconfig cups off
# /sbin/chkconfig nfs off
# /sbin/chkconfig nfslock off
# /sbin/chkconfig portmap off
# /sbin/chkconfig sendmail off
# /sbin/chkconfig sshd off
xinetd経由で起動している以下の二つのサービスについては、設定ファイルを編集するこ とで起動しないようにする。
  ・telnet
  ・auth
  /etc/xinetd.d/telnet&/etc/xinetd.d/auth
disable = NO
   ↓
disable = YES
また、以下のサービスについても不要なのでランレベルを変更する。
# /sbin/chkconfig apmd off
# /sbin/chkconfig gpm off
# /sbin/chkconfig isdn off
# /sbin/chkconfig ip6tables off
# /sbin/chkconfig kudzu off
# /sbin/chkconfig rhnsd off
# /sbin/chkconfig saslauthd off
一通りランレベルの変更が終了したらマシンを再起動し、サービスが起動していないこと を確認する。 このように何も表示されなければよい。
# netstat -an
Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address           Foreign Address             State
最終的なランレベルの設定は以下の通り。
# /sbin/chkconfig --list
microcode_ctl   0:オフ  1:オフ  2:オン  3:オン  4:オン  5:オン  6:オフ
gpm             0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ
kudzu           0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ
syslog          0:オフ  1:オフ  2:オン  3:オン  4:オン  5:オン  6:オフ
netfs           0:オフ  1:オフ  2:オフ  3:オン  4:オン  5:オン  6:オフ
network         0:オフ  1:オフ  2:オン  3:オン  4:オン  5:オン  6:オフ
random          0:オフ  1:オフ  2:オン  3:オン  4:オン  5:オン  6:オフ
rawdevices      0:オフ  1:オフ  2:オフ  3:オン  4:オン  5:オン  6:オフ
saslauthd       0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ
yum             0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ
atd             0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ
audit           0:オフ  1:オフ  2:オン  3:オン  4:オフ  5:オン  6:オフ
irda            0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ
psacct          0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ
apmd            0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ
diskdump        0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ
isdn            0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ
iptables        0:オフ  1:オフ  2:オン  3:オン  4:オン  5:オン  6:オフ
ip6tables       0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ
iscsi           0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ
pcmcia          0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ
irqbalance      0:オフ  1:オフ  2:オフ  3:オン  4:オン  5:オン  6:オフ
sendmail        0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ
smartd          0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ
autofs          0:オフ  1:オフ  2:オフ  3:オン  4:オン  5:オン  6:オフ
netdump         0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ
sshd            0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ
portmap         0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ
nfs             0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ
nfslock         0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ
mdmonitor       0:オフ  1:オフ  2:オン  3:オン  4:オン  5:オン  6:オフ
mdmpd           0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ
crond           0:オフ  1:オフ  2:オン  3:オン  4:オン  5:オン  6:オフ
xinetd          0:オフ  1:オフ  2:オフ  3:オン  4:オン  5:オン  6:オフ
cups            0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ
rhnsd           0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ
xinetd ベースのサービス:
        krb5-telnet:    オフ
        rsync:  オフ
        eklogin:        オフ
        gssftp: オフ
        klogin: オフ
        chargen-udp:    オフ
        kshell: オフ
        auth:   オフ
        chargen:        オフ
        daytime-udp:    オフ
        daytime:        オフ
        echo-udp:       オフ
        echo:   オフ
        services:       オフ
        time:   オフ
        time-udp:       オフ
        cups-lpd:       オフ
        telnet: オフ