Debian 9 で iptables による Windows 共有を許可する

Debian 9 で iptables による Windows 共有を許可する

iptablesを使用してランプサーバー(debian 9)を保護しようとしています。

おそらくご存知のように。すべてのポートをブロックし、必要なポートのみを許可することが原則です。

これまで、ssh、http/https、icmp、dns、smtp、mysqlなど、必要なほぼすべてのポートを正常に開きました。

しかし、私のランプサーバーはCIFSを使用してWindowsサーバーから2つのWindows共有をマウントする必要があります。

mount -t cifs -o user=user,rw //<ip adresse> /share1 /var/share1

137 138 139 445iptablesを設定する前はうまくいきました。 iptablesコマンドを使用してtcpポートとudpポートを開こうとしました。

- - - 入力

---------------UDP

iptables -t filter -A INPUT -p udp --dport 137 -j ACCEPT

iptables -t filter -A INPUT -p udp --dport 139 -j ACCEPT

iptables -t filter -A INPUT -p udp --dport 445 -j ACCEPT

iptables -t filter -A INPUT -p udp --dport 138 -j ACCEPT

---------------TCP

iptables -t filter -A INPUT -p tcp --dport 137 -j ACCEPT

iptables -t filter -A INPUT -p tcp --dport 139 -j ACCEPT

iptables -t filter -A INPUT -p tcp --dport 445 -j ACCEPT

iptables -t filter -A INPUT -p tcp --dport 138 -j ACCEPT

- - - 出力

---------------UDP

iptables -t filter -A OUTPUT -p udp --sport 137 -j ACCEPT

iptables -t filter -A OUTPUT -p udp --sport 138 -j ACCEPT

iptables -t filter -A OUTPUT -p udp --sport 139 -j ACCEPT

iptables -t filter -A OUTPUT -p udp --sport 445 -j ACCEPT

---------------TCP

iptables -t filter -A OUTPUT -p tcp --sport 137 -j ACCEPT

iptables -t filter -A OUTPUT -p tcp --sport 138 -j ACCEPT

iptables -t filter -A OUTPUT -p tcp --sport 139 -j ACCEPT

iptables -t filter -A OUTPUT -p tcp --sport 445 -j ACCEPT

悲しいことに喜びはありませんが、私のiptables -Lは次のようになります。

root@Debian-VM:~# iptables -L
Chain INPUT (policy DROP)
target     prot opt source               destination
[...]
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:netbios-ns
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:netbios-dgm
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:netbios-ssn
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:microsoft-ds
ACCEPT     udp  --  anywhere             anywhere             udp dpt:netbios-ns
ACCEPT     udp  --  anywhere             anywhere             udp dpt:netbios-dgm
ACCEPT     udp  --  anywhere             anywhere             udp dpt:netbios-ssn
ACCEPT     udp  --  anywhere             anywhere             udp dpt:microsoft-ds
[...]
Chain FORWARD (policy DROP)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
[...]
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:netbios-ns
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:netbios-dgm
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:netbios-ssn
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:microsoft-ds
ACCEPT     udp  --  anywhere             anywhere             udp spt:microsoft-ds
ACCEPT     udp  --  anywhere             anywhere             udp spt:netbios-ssn
ACCEPT     udp  --  anywhere             anywhere             udp spt:netbios-dgm
ACCEPT     udp  --  anywhere             anywhere             udp spt:netbios-ns
[...]

私は何を見逃していますか?

ご回答ありがとうございます。

ニコラス

ベストアンサー1

私はcifs-utilsだけをインストールしたので、これは必要ありません138 139 137

iptables -t filter -A OUTPUT -p tcp --dport 445 -j ACCEPT
iptables -t filter -A INPUT -p tcp --sport 445 -j ACCEPT

これが他の人に役立つことを願っています:-)

おすすめ記事