プロが教える店舗&オフィスのセキュリティ対策術

CENTOS5を使っております。
FIREWALL 有効 SELINUX 有効
server1 リモートホスト server2 SSHサービス稼動中。
============================================
ここで、制御ファイルにて下記のようにしていますが、
server2側でアクセス拒否されてしまいます。

1. /etc/hosts.allow
# hosts.allow This file describes the names of the hosts which are
# allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
ALL:127.0.0.1
sshd: alex@192.168.10.62

2 /etc/hosts.deny

# hosts.deny This file describes the names of the hosts which are
# *not* allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow. In particular
# you should know that NFS uses portmap!
sshd: ALL

[root@server1 ssh]# ssh alex@server2
ssh_exchange_identification: Connection closed by remote host

私の認識では、allow→denyの読み取りで判断されるので許可されると
考えています。
それともUSER@を指定した記述が違うのでしょうか。

deny にて、sshd : ALL EXCEPT alex@192とも指定したがぺけでした。

どなたかご指摘お願いします。
P.S
グーグルでもUSER@指定の場合を検索してみました。
http://www.cromwell-intl.com/unix/ssh.html
sshd_config にてAllowUsers alexもぺけでした。。。

よろしくご指摘お願いいたします。

A 回答 (3件)

もし、inetd経由のsshdでしたら、設定方法が下記のページが参考になると思います。



---------------------------------------------------
inetd.confの記述として、
ssh stream tcp nowait root /usr/sbin/tcpd sshd -i

参考URL:http://oshiete1.goo.ne.jp/qa1115157.html
    • good
    • 0
この回答へのお礼

autyさん、

参考情報ありがとうございます。自己解決できました。

#man sshd_configにしたがって、
AllowUsers alex 
を追記して、/etc/hosts.deny allow 双方の設定を取り払いましたところ、
認証ログインできました。AllowUsers を設定すると指定したユーザーのみのログイン可能となります。この辺はtail -f /var/log/secureでトレースすると見えてきました。
AllowUsers と /etc/hosts.deny all の組み合わせはぺけなようです。

お礼日時:2008/02/22 09:21

opsさん



私にも大変参考になりました。
なるほどそういうことかと納得させられました。
どうもありがとう。ございました。
    • good
    • 0

実際に確かめていないので間違っているかも知れませんが、


IPアドレス192.168.10.62のユーザalexからのssh接続を許すのであれば、次になるのではないでしょうか。
 server2:/etc/hosts.deny に "sshd: ALL" を記述する。
 server2:/etc/hosts.allow に "sshd: 192.168.10.62" を記述する。
 server2:/etc/ssh/sshd_config に "AllowUsers alex" を記述する。

どのIPアドレスからでもユーザalexからのssh接続を許すのであれば、次になるのではないでしょうか。
 server2:/etc/hosts.deny に "sshd: ALL" が記述されていても記述されていなくてもよい。
 server2:/etc/hosts.allow に "sshd: ALL" を記述する。
 server2:/etc/ssh/sshd_config に "AllowUsers alex" を記述する。

2008年2月23日

この回答への補足

RASUM2さん、

アドバイスありがとうございます。
どのIPアドレスからの件ですが、
denyにて sshd:ALLが記載されているとやはりぺけにされます。
(VMワークステーションVER6にインストールされている双方RHEL5でGA番)
このあたりはソースをおかっけないとわかりませんね。。

補足日時:2008/02/23 18:26
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!