xinetdでアクセス制限
xinetdが起動しているか確認
xinetd (pid 13285) を実行中…起動中
xinetd: unrecognized service動いてない
動いてなければインストール
xinetdバージョンを確認
xinetd-2.3.14-10.el5
2.1.8.8p3、2.1.8.9pre6、xinetd-2.3.1には、セキュリティホールがあるので、バージョンアップとのこと。
自動起動
httpd 0:off 1:off 2:off 3:on 4:off 5:off 6:off
# chkconfig xinetd on自動起動をON
chkconfig –list xinetd
xinetd 0:off 1:off 2:on 3:on 4:on 5:on 6:off2~5がonに
/etc/xinetd.conf の内容(CentOs5)
各項目ともそれぞれのファイルで設定するのでここではあまりいじらないでいいのかな
# This is the master xinetd configuration file. Settings in the
# default section will be inherited by all service configurations
# unless explicitly overridden in the service configuration. See
# xinetd.conf in the man pages for a more detailed explanation of
# these attributes.
defaults
{
# The next two items are intended to be a quick access place to
# temporarily enable or disable services.
#
# enabled =
# disabled =
# Define general logging characteristics.
log_type = SYSLOG authpriv ログ出力authprivで出力指定
log_on_failure = HOSTログイン失敗の場合にログに記録する内容
log_on_success = PID HOST DURATION EXITログイン成功の場合にログに記録する内容
# Define access restriction defaults
#
# no_access =
# only_from =
# max_load = 0
cps = 50 10 1秒あたりの最大接続数 再接続まで
instances = 50 最大同時接続数
per_source = 10
# Address and networking defaults
#
# bind =
# mdns = yes
v6only = no
# setup environmental attributes
#
# passenv =
groups = yes
umask = 002
# Generally, banners are not used. This sets up their global defaults
#
# banner =
# banner_fail =
# banner_success =
}
includedir /etc/xinetd.d設定ファイル置く場所
設定ファイル作成 FTPの場合
設定例
{
disable = yes
socket_type = stream
protocol = tcp
wait = no
user = root
server = /usr/sbin/in.ftpd
server_args = -l -a
log_on_success += DURATION USERID
log_on_failure += USERID
nice = 10
no_access += IPやホスト名接続拒否設定
only_from = IPやホスト名接続許可設定
access_times = 18:00-2359 0:00-5:00接続許可時間この場合18時から翌5時
}
再起動
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
<<参考サイト>>
xinetd の設定方法