RedHat7.2にTELNETできるようにする 〜ipchains〜
RedHat7.2にTELNETできるようにする
〜ipchains〜
0.更新履歴
- 2002.01.31 新規作成
- 2002.02.01 設定を保存する方法を追加
- 2003.01.15 xinetd.d以下のファイルについて追記.
1.はじめに
このドキュメントでは,カスタムでインストールしたRedHat7.2のマシンに,他のマシンから接続(TELNET)する為の手順をしめす.
2.パッケージのインストール
[root@gx150 xinetd.d]# pwd
/etc/xinetd.d
[root@gx150 xinetd.d]#
[root@gx150 xinetd.d]# ls
chargen chargen-udp daytime daytime-udp echo echo-udp sgi_fam time
time-udp
[root@gx150 xinetd.d]#
|
- パッケージが入っていないので,CD-ROMからrpmでインストールする.
[root@gx150 RPMS]# rpm -ihv telnet-server-0.17-20.i386.rpm
Preparing... ########################################### [100%]
1:telnet-server ########################################### [100%]
[root@gx150 RPMS]
|
[root@jp1agent root]# cd /etc/xinetd.d
[root@jp1agent xinetd.d]# ls -la
total 80
drwxr-xr-x 2 root root 4096 Jan 15 19:21 .
drwxr-xr-x 40 root root 4096 Jan 15 19:35 ..
-rw-r--r-- 1 root root 297 Apr 5 2002 chargen
-rw-r--r-- 1 root root 317 Apr 5 2002 chargen-udp
-rw-r--r-- 1 root root 297 Apr 5 2002 daytime
-rw-r--r-- 1 root root 317 Apr 5 2002 daytime-udp
-rw-r--r-- 1 root root 289 Apr 5 2002 echo
-rw-r--r-- 1 root root 308 Apr 5 2002 echo-udp
-rw-r--r-- 1 root root 318 Jun 25 2001 finger
-rw-r--r-- 1 root root 259 Jul 24 2001 ntalk
-rw-r--r-- 1 root root 361 Jul 24 2001 rexec
-rw-r--r-- 1 root root 378 Jul 24 2001 rlogin
-rw-r--r-- 1 root root 431 Jul 24 2001 rsh
-rw-r--r-- 1 root root 317 Apr 11 2002 rsync
-rw-r--r-- 1 root root 314 Apr 5 2002 servers
-rw-r--r-- 1 root root 312 Apr 5 2002 services
-rw-r--r-- 1 root root 247 Jul 24 2001 talk
-rw-r--r-- 1 root root 304 Jan 15 19:21 telnet
-rw-r--r-- 1 root root 321 Apr 5 2002 time
-rw-r--r-- 1 root root 317 Apr 5 2002 time-udp
[root@jp1agent xinetd.d]#
|
変更前
[root@jp1agent xinetd.d]# cat telnet
# default: on
# description: The telnet server serves telnet sessions; it uses \
# unencrypted username/password pairs for authentication.
service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
disable = yes
}
[root@jp1agent xinetd.d]#
|
- disable(使いません)がyesになっているのでnoに修正する.
変更後
[root@jp1agent xinetd.d]# cat telnet
# default: on
# description: The telnet server serves telnet sessions; it uses \
# unencrypted username/password pairs for authentication.
service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
disable = no
}
[root@jp1agent xinetd.d]#
|
[root@gx150 root]# /etc/rc.d/init.d/xinetd restart
xinetdを停止中: [ OK ]
xinetdを起動中:
[root@gx150 root]#
|
3.ipchainsで接続を許可する
- まだよくわかっていないが,,,RedHat7.2では,FireWall機能が入っているようで,ipchainsという管理用コマンドで制御することができる.
- デフォルトのままだと,TELNETポートが届かないような設定になっているらしく,とりあえず穴をあける.
- ipchains -Lで,現在の設定状態を見る.
root@gx150 root]# ipchains -L
Chain input (policy ACCEPT):
target prot opt source destination ports
ACCEPT udp ------ exasvr anywhere domain -> 1025:65535
ACCEPT all ------ anywhere anywhere n/a
REJECT tcp -y---- anywhere anywhere any -> 0:1023
REJECT tcp -y---- anywhere anywhere any -> nfs
REJECT udp ------ anywhere anywhere any -> 0:1023
REJECT udp ------ anywhere anywhere any -> nfs
REJECT tcp -y---- anywhere anywhere any -> x11:6009
REJECT tcp -y---- anywhere anywhere any -> xfs
Chain forward (policy ACCEPT):
Chain output (policy ACCEPT):
[root@gx150 root]#
|
- リストの3行目をみると,REJECT(不許可)されている事がわかる.
- 3行目は,anywhereからの0〜1023版番のポートアクセスが禁止されていることを示している.
- それを消す.
root@gx150 root]# ipchains -D input 3
|
[root@gx150 root]# ipchains -L
Chain input (policy ACCEPT):
target prot opt source destination ports
ACCEPT udp ------ exasvr anywhere domain -> 1025:65535
ACCEPT all ------ anywhere anywhere n/a
REJECT tcp -y---- anywhere anywhere any -> nfs
REJECT udp ------ anywhere anywhere any -> 0:1023
REJECT udp ------ anywhere anywhere any -> nfs
REJECT tcp -y---- anywhere anywhere any -> x11:6009
REJECT tcp -y---- anywhere anywhere any -> xfs
Chain forward (policy ACCEPT):
Chain output (policy ACCEPT):
[root@gx150 root]#
|
- 先ほどの3行目が消されたことがわかる.
- これでTELNETができるはず.
4.設定した内容を保存する
- このままだと,OSをリブートすると設定内容が消えてしまう.
- よって,現在の設定内容を保存する.
[root@gx150 etc]# /etc/rc.d/init.d/ipchains save
現在のルールを/etc/sysconfig/ipchainsに保存中: [ OK ]
[root@gx150 etc]# cd
|