dropbear は hosts.allow と hosts.deny を処理しますか?

dropbear は hosts.allow と hosts.deny を処理しますか?

私はdropbearDebian(実際はRaspbian)でSSHデーモンとして実行しています。設定を試してみました

# /etc/hosts.allow
dropbear:192.168.1.1
# my static ip from which I SSH connect to the device

そして

# /etc/hosts.deny
ALL:ALL
# block all others

その後、デバイス全体を再起動しました。別の IP アドレスから、さらにはリモートからでも、デバイスに SSH 接続できました。ファイルを間違って構成したのでしょうか、それともdropbearこれら 2 つのファイルがサポートされていないのでしょうか?

答え1

/etc/hosts.allowDropbearには、およびのサポートは含まれていません/etc/hosts.deny。これらのファイルは、TCPラッパーライブラリ ( libwrap) は、Dropbear では使用されません。一部のサードパーティ パッケージは、TCP ラッパー サポート用に Dropbear にパッチを適用しますが、Debian では適用されません。

Dropbearは以下から起動できますtcpdTCP ラッパーのサポートを取得します。

/usr/sbin/tcpd /usr/sbin/dropbear -i

IP アドレスのみでフィルタリングしたい場合は、iptables を使用できます。

iptables -A INPUT -p tcp ! --dport 22 -j DROP

答え2

試す:

# /etc/hosts.deny
sshd:ALL:spawn /bin/echo  the ip %h tried to access `/bin/date`>> /var/log/ssh.log

そして

# /etc/hosts.allow
sshd:192.168.1.1

うまくいかない場合は、この方法で Dropbear をもう一度試してください。

# /etc/hosts.deny
dropear:ALL:spawn /bin/echo  the ip %h tried to access `/bin/date`>> /var/log/ssh.log

そして

# /etc/hosts.allow
dropbear:192.168.1.1

Dropbear が tcp/wrappers をサポートしているかどうかを確認します。

ldd /path/to/dropbear

探すlibwrap.so.0 → /lib/libwrap.so.0

関連情報