web-dev-qa-db-ja.com

信頼できるクライアントがMacに接続できるようにするIPFW設定(例:ssh経由)

Mac OS X 10.4Tigerには次のipfw設定があります。

00100 allow ip from any to 123.123.123.123
00110 allow tcp from any to 123.123.123.123
00120 allow udp from any to 123.123.123.123
00130 allow ip from 123.123.123.123 to any
00140 allow tcp from 123.123.123.123 to any
00150 allow udp from 123.123.123.123 to any
65534 deny ip from any to any
65535 allow ip from any to any

IPアドレス123.123.123.123のLinuxコンピューターからMacにSSHで接続しようとしていますが、Macでsshdが実行されています。ただし、sshクライアントは次を出力します。

ssh [email protected] -v

OpenSSH_5.5p1, OpenSSL 1.0.0d-fips 8 Feb 2011
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to mac.example.com [10.10.10.10] port 22.
debug1: Connection established.
debug1: identity file /home/me/.ssh/id_rsa type -1
debug1: identity file /home/me/.ssh/id_rsa-cert type -1
debug1: identity file /home/me/.ssh/id_dsa type -1
debug1: identity file /home/me/.ssh/id_dsa-cert type -1
ssh_exchange_identification: Connection closed by remote Host

パスワードを要求する前にMacが突然接続を閉じる原因は何でしょうか?

IPFW設定として65535 allow ip from any to anyを使用しただけでsshが機能したため、IPFW設定に関係していると思います。たとえば、DNSの逆引き参照のルールが必要ですか?

2
cm007

まず、最初にすべてのipを許可する場合は、tcpとudpを指定する必要はありません。また、通常はallow ip from me to anyでルールを開始して、すべてのアウトバウンド接続を許可する方が簡単です。

このルールセットを試して、何が起こるかを確認してください。

00100 allow ip from me to any
00200 allow ip from 123.123.123.123 to me ssh
01000 allow icmp from any to any
01001 allow igmp from any to any
65534 deny ip from any to any

改善されたステートフルバージョン:

00060 check-state
00100 allow ip from me to any keep-state
00200 allow ip from 123.123.123.123 to me ssh setup keep-state
01000 allow icmp from any to any
01001 allow igmp from any to any
65534 deny ip from any to any
1
Chris S