[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[plamo:28204] iptables¤ÎÀßÄê¤ò¹Ô¤¤¤Þ¤·¤¿



iptables設定用ファイルを作りました。

iptables.shの内容
#! /bin/sh

#iptablesの初期化
/usr/bin/iptables -F

#入力・出力を拒否
/usr/bin/iptables -P INPUT DROP
#/usr/bin/iptables -P OUTPUT DROP

#出力を許可
/usr/bin/iptables -P OUTPUT ACCEPT

#ローカル127.0.0.1の入出力を許可
/usr/bin/iptables -A INPUT -i lo -j ACCEPT
/usr/bin/iptables -A OUTPUT -o lo -j ACCEPT

#既にconnectionが張られている通信を許可
/usr/bin/iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
/usr/bin/iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

実行結果
bash-3.00# iptables -L
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED

設定を起動時に有効になるように、

NETFIX=/etc/network.fixed
HOSTNAME=`hostname`

DEVICES=`/usr/bin/grep -v '^#' $NETFIX`

for DEV in $DEVICES; do
/usr/lib/murasaki/bin/ifup -v $DEV
done

if [ -x /etc/iptables.sh ]; then <------この行を追加
/etc/iptables.sh <------この行を追加
fi <------この行を追加

if [ -x /etc/rc.d/rc.inet1.sub ]; then
/etc/rc.d/rc.inet1.sub
fi

元の設定ファイルの内容を真似ただけですので、
これでいいかどうかわかりませんが、とりあえず動いています。

Follow-Ups
[plamo:28206] Re: iptables¤ÎÀßÄê¤ò¹Ô¤¤¤Þ¤·¤¿, Áá´Ö

[¸¡º÷¥Ú¡¼¥¸] [¥á¡¼¥ë°ìÍ÷]
Plamo ML ¸ø³«¥·¥¹¥Æ¥à