UJP - 技術情報1

Life is fun and easy!

不正IP報告数

Okan Sensor
 
メイン
ログイン
ブログ カテゴリ一覧

chkconfigを使って不要なサービスを停止する

chkconfigを使って不要なサービスを停止する


0.改訂履歴

  • 2006.02.22 新規作成
  • 2006.03.08 停止するスクリプトに,rhnsdを追加.

1.はじめに

 このドキュメントでは,chkconfigコマンドを使って,不要なバックグラウンドサービスを停止する手順を説明する. gpm,kudzu,mdmonitor等のデフォルトで稼働しているサービスの簡単な説明を踏まえながら設定を選択していく. 停止不要なものを動作させないことによって,セキュリティ的に強化できる. 

 なお,使用しているOSは,RedHat Linux WS3上で稼働している.

2.稼働しているサービスの確認

  • chkconfigコマンドで,リストを取得する.
  • onで絞り込むことで,稼働設定されているものが確認できる.
[root@artemis root]# /sbin/chkconfig --list | grep on
microcode_ctl   0:off   1:off   2:on    3:on    4:on    5:on    6:off
gpm             0:off   1:off   2:on    3:on    4:on    5:on    6:off
kudzu           0:off   1:off   2:off   3:on    4:on    5:on    6:off
syslog          0:off   1:off   2:on    3:on    4:on    5:on    6:off
netfs           0:off   1:off   2:off   3:on    4:on    5:on    6:off
network         0:off   1:off   2:on    3:on    4:on    5:on    6:off
random          0:off   1:off   2:on    3:on    4:on    5:on    6:off
rawdevices      0:off   1:off   2:off   3:on    4:on    5:on    6:off
atd             0:off   1:off   2:off   3:on    4:on    5:on    6:off
apmd            0:off   1:off   2:on    3:on    4:on    5:on    6:off
isdn            0:off   1:off   2:on    3:on    4:on    5:on    6:off
iptables        0:off   1:off   2:on    3:on    4:on    5:on    6:off
ip6tables       0:off   1:off   2:on    3:on    4:on    5:on    6:off
pcmcia          0:off   1:off   2:on    3:on    4:on    5:on    6:off
irqbalance      0:off   1:off   2:off   3:on    4:on    5:on    6:off
autofs          0:off   1:off   2:off   3:on    4:on    5:on    6:off
sshd            0:off   1:off   2:on    3:on    4:on    5:on    6:off
portmap         0:off   1:off   2:off   3:on    4:on    5:on    6:off
nfslock         0:off   1:off   2:off   3:on    4:on    5:on    6:off
sendmail        0:off   1:off   2:on    3:on    4:on    5:on    6:off
mdmonitor       0:off   1:off   2:on    3:on    4:on    5:on    6:off
crond           0:off   1:off   2:on    3:on    4:on    5:on    6:off
xinetd          0:off   1:off   2:off   3:on    4:on    5:on    6:off
cups            0:off   1:off   2:on    3:on    4:on    5:on    6:off
hpoj            0:off   1:off   2:on    3:on    4:on    5:on    6:off
xfs             0:off   1:off   2:on    3:on    4:on    5:on    6:off
anacron         0:off   1:off   2:off   3:off   4:off   5:off   6:off
sysstat         0:off   1:on    2:on    3:on    4:on    5:on    6:off
canna           0:off   1:off   2:on    3:on    4:on    5:on    6:off
FreeWnn         0:off   1:off   2:on    3:on    4:on    5:on    6:off
        auth:   on
        sgi_fam:        on
[root@artemis root]#  
  • ここで,自動起動になっているサービスの説明を次の表にまとめる.
サービス名 推奨設定
microcode_ctl IA32(インテルアーキテクチャ32bit)のマイクロコードを更新する. off
gpm コンソール用のマウスサーバ.普通のターミナルでは使えない. on
kudzu ハードウェア検出ツール.USBキーボード&マウスを抜き差しする場合に便利. on
syslog システムログを追加する. on
netfs ネットワークボリュームを,マウント・アンマウントする時に使用.NFSを使うなら必要. off
network 起動時にネットワークインタフェイスを初期化すする. on
random 乱数発生機. この仕組みを使って乱数を発見させるプログラムを使っていなければ不要. on
rawdevices ローデバイスをりようするときにひふよう
atd 1回だけスケジューリングして実行するcronのようなもの.
apmd ノートPC等の電源管理.
isdn ISDN回線を利用する場合に.
iptables 簡易firwall IPv4用. 他のfirewallを利用している場合は不要. 単独でネットワークに接続している場合は必要. on/off
ip6tables 簡易firwall IPv6用を使っていなければ不要. off
pcmcia PCMCIAスロットを保有しているノートPC向け. off
irqbalance 複数CPUがある場合に,割り込み処理ができるように管理する. on/iff
autofs 自動的にファイルシステムをマウントする on
sshd セキュアshell.暗号化されたTELNET. on
portmap RPC接続を管理する. on
nfslock NFSのファイルロックを管理.NFS利用してないなら不要. off
sendmail qmailやpostfixを使うことを推奨. off
mdmonitor ソフトウェアRAIDのモニタリングツール off
crond 設定時間にプログラムを実行する. on
xinetd スーパサーバ. on
cups プリンタサーバ off
hpoj hpのプリンタ off
xfs フォントサーバ.GUIを利用しないなら不要. off
anacron crondと似ているが,予約時間にサーバが電源OFF等でも後で実行する機能を有する. off
sysstat on
canna 仮名漢字変換.GUIを利用しないなら不要. off
FreeWnn 仮名漢字変換 off

3.不要なサービスを停止する

  • chkconfigコマンドを使って,不要なサービスを停止する.
[root@artemis root]# /sbin/chkconfig --level 12345 anacron off
[root@artemis root]# /sbin/chkconfig --level 12345 apmd off
[root@artemis root]# /sbin/chkconfig --level 12345 atd off
[root@artemis root]# /sbin/chkconfig --level 12345 canna off
[root@artemis root]# /sbin/chkconfig --level 12345 cups off
[root@artemis root]# /sbin/chkconfig --level 12345 FreeWnn off
[root@artemis root]# /sbin/chkconfig --level 12345 gpm off
[root@artemis root]# /sbin/chkconfig --level 12345 hpoj off
[root@artemis root]# /sbin/chkconfig --level 12345 ip6tables off
[root@artemis root]# /sbin/chkconfig --level 12345 iptables off
[root@artemis root]# /sbin/chkconfig --level 12345 irqbalance off
[root@artemis root]# /sbin/chkconfig --level 12345 isdn off
[root@artemis root]# /sbin/chkconfig --level 12345 mdmonitor off
[root@artemis root]# /sbin/chkconfig --level 12345 microcode_ctl off 
[root@artemis root]# /sbin/chkconfig --level 12345 netfs off
[root@artemis root]# /sbin/chkconfig --level 12345 nfslock off
[root@artemis root]# /sbin/chkconfig --level 12345 pcmcia off
[root@artemis root]# /sbin/chkconfig --level 12345 rawdevices off
[root@artemis root]# sbin/chkconfig --level 12345 sendmail off
[root@artemis root]# /sbin/chkconfig --level 12345 xfs off
[root@artemis root]#
  • 以下をコピペすればよい.
コピペ用
/sbin/chkconfig --level 12345 anacron off
/sbin/chkconfig --level 12345 apmd off
/sbin/chkconfig --level 12345 atd off
/sbin/chkconfig --level 12345 canna off
/sbin/chkconfig --level 12345 cups off
/sbin/chkconfig --level 12345 FreeWnn off
/sbin/chkconfig --level 12345 gpm off
/sbin/chkconfig --level 12345 hpoj off
/sbin/chkconfig --level 12345 ip6tables off
/sbin/chkconfig --level 12345 iptables off
/sbin/chkconfig --level 12345 irqbalance off
/sbin/chkconfig --level 12345 isdn off
/sbin/chkconfig --level 12345 mdmonitor off
/sbin/chkconfig --level 12345 microcode_ctl off 
/sbin/chkconfig --level 12345 netfs off
/sbin/chkconfig --level 12345 nfslock off
/sbin/chkconfig --level 12345 pcmcia off
/sbin/chkconfig --level 12345 rawdevices off
/sbin/chkconfig --level 12345 sendmail off
/sbin/chkconfig --level 12345 xfs off
/sbin/chkconfig --level 12345 rhnsd off 
  • 現在の設定を確認する.
[root@artemis root]# /sbin/chkconfig --list | grep ':on'
kudzu           0:off   1:off   2:off   3:on    4:on    5:on    6:off
syslog          0:off   1:off   2:on    3:on    4:on    5:on    6:off
network         0:off   1:off   2:on    3:on    4:on    5:on    6:off
random          0:off   1:off   2:on    3:on    4:on    5:on    6:off
autofs          0:off   1:off   2:off   3:on    4:on    5:on    6:off
sshd            0:off   1:off   2:on    3:on    4:on    5:on    6:off
portmap         0:off   1:off   2:off   3:on    4:on    5:on    6:off
crond           0:off   1:off   2:on    3:on    4:on    5:on    6:off
xinetd          0:off   1:off   2:off   3:on    4:on    5:on    6:off
sysstat         0:off   1:on    2:on    3:on    4:on    5:on    6:off
[root@artemis root]#  
  • これで最低限のサービスが稼働している状況となった.


広告スペース
Google