よく使うLinuxコマンド

tcpdchk - ネットワーク管理でよく使うコマンド

tcp wrapper に関連する設定ファイルを検査します

■よく使う形(例)

※/etc/hosts.allowと/etc/hosts.denyの情報を参照します。

# tcpdchk -v

>> Rule /etc/hosts.allow line 13:
daemons: proftpd
clients: 127.0.0.1 192.168.0.0/24

access: granted

>>> Rule /etc/hosts.allow line 14:
daemons: sshd
clients: 127.0.0.1 192.168.0.10

access: granted

>>> Rule /etc/hosts.deny line 18:
daemons: proftpd
clients: ALL

access: denied

>>> Rule /etc/hosts.deny line 19:
daemons: sshd
clients: ALL

access: denied

※上記の例はSSHは、192.168.1.10のみ、FTPは192.168.0.0/24のネットワーク全体を許可しています。

tcp wrapper に関連する設定ファイル(/etc/hosts.allowや/etc/hosts.deny)を検査し、 トラブルにつながる可能性を調べることができます。
/etc/hosts.allowや/etc/hosts.denyを個別にエディタでオープンしてしまえば、同じことですが、非常に多くのサービスを動かしていたり、細かなIP制限をかけている場合は、 tcpdchkコマンドを使って確認するととても楽です。

また、tcpdmatchコマンドを使って、どのようなアクセスIPが通るか(通らないか)を実際にチェックできます。

■主なオプション

オプション 機能説明
-v /etc/hosts.allowや/etc/hosts.allowの情報を読み込み、権限の有無をわかりやすく表示します。
-d カレントディレクトリの hosts.allow、hosts.allowを精査する。