* [Comm] IPTABLES
@ 2003-05-31 12:53 Igo-aeroflot
2003-05-31 13:34 ` Andrii Dobrovolskii
0 siblings, 1 reply; 3+ messages in thread
From: Igo-aeroflot @ 2003-05-31 12:53 UTC (permalink / raw)
To: community
Здравствуйте!
Есть скрипт, формирующий правила iptables, запрещающие обмен
ICMP-сообщениями с неким хостом. Упрощенно он выглядит так:
EXTERNAL_IFACE="ppp0"
IPTABLES="/sbin/iptables"
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT
$IPTABLES -N icmp_in_ppp
$IPTABLES -A icmp_in_ppp -p ICMP --destination 213.180.194.129 -m limit
--limit 2/minute --limit-burst 4 -j LOG --log-prefix "BAD TO YANDEX ICMP: "
$IPTABLES -A icmp_in_ppp -p ICMP --destination 213.180.194.129 -j DROP
$IPTABLES -A icmp_in_ppp -p ICMP --source 213.180.194.129 -m limit
--limit 2/minute --limit-burst 4 -j LOG --log-prefix "BAD FROM YANDEX
ICMP: "
$IPTABLES -A icmp_in_ppp -p ICMP --source 213.180.194.129 -j DROP
$IPTABLES -A INPUT -p ICMP -i $EXTERNAL_IFACE -j icmp_in_ppp
Вот что показывает iptables -L | grep "YANDEX ICMP" после запуска этого
скрипта:
LOG icmp -- anywhere yandex.ru limit: avg
2/min burst 4 LOG level warning prefix `BAD TO YANDEX ICMP: '
LOG icmp -- yandex.ru anywhere limit: avg
2/min burst 4 LOG level warning prefix `BAD FROM YANDEX ICMP: '
А вот что происходит при пинге:
ping -c 1 213.180.194.129
PING 213.180.194.129 (213.180.194.129) 56(84) bytes of data.
--- 213.180.194.129 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
При этом в логе я вижу следующее:
May 31 16:06:32 ugtovar kernel: BAD FROM YANDEX ICMP: IN=ppp0 OUT= MAC=
SRC=213.180.194.129 DST=80.80.123.168 LEN=84 TOS=0x00 PREC=0x00 TTL=54
ID=0 DF PROTO=ICMP TYPE=0 CODE=0 ID=37657 SEQ=1
Т.е. пинг вышел наружу, хост 213.180.194.129 вернул ответ, и уже ответ
был отфильтрован. А почему не был отфильтрован сам запрос?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Comm] IPTABLES
2003-05-31 12:53 [Comm] IPTABLES Igo-aeroflot
@ 2003-05-31 13:34 ` Andrii Dobrovolskii
2003-05-31 13:49 ` Igo-aeroflot
0 siblings, 1 reply; 3+ messages in thread
From: Andrii Dobrovolskii @ 2003-05-31 13:34 UTC (permalink / raw)
To: community
Igo-aeroflot wrote:
> Здравствуйте!
>
> Есть скрипт, формирующий правила iptables, запрещающие обмен
> ICMP-сообщениями с неким хостом. Упрощенно он выглядит так:
>
> EXTERNAL_IFACE="ppp0"
> IPTABLES="/sbin/iptables"
> $IPTABLES -P INPUT DROP
> $IPTABLES -P OUTPUT ACCEPT
> $IPTABLES -P FORWARD ACCEPT
> $IPTABLES -N icmp_in_ppp
> $IPTABLES -A icmp_in_ppp -p ICMP --destination 213.180.194.129 -m
> limit --limit 2/minute --limit-burst 4 -j LOG --log-prefix "BAD TO
> YANDEX ICMP: "
> $IPTABLES -A icmp_in_ppp -p ICMP --destination 213.180.194.129 -j DROP
> $IPTABLES -A icmp_in_ppp -p ICMP --source 213.180.194.129 -m limit
> --limit 2/minute --limit-burst 4 -j LOG --log-prefix "BAD FROM YANDEX
> ICMP: "
> $IPTABLES -A icmp_in_ppp -p ICMP --source 213.180.194.129 -j DROP
> $IPTABLES -A INPUT -p ICMP -i $EXTERNAL_IFACE -j icmp_in_ppp
>
> Вот что показывает iptables -L | grep "YANDEX ICMP" после запуска
> этого скрипта:
>
> LOG icmp -- anywhere yandex.ru limit: avg
> 2/min burst 4 LOG level warning prefix `BAD TO YANDEX ICMP: '
> LOG icmp -- yandex.ru anywhere limit: avg
> 2/min burst 4 LOG level warning prefix `BAD FROM YANDEX ICMP: '
>
> А вот что происходит при пинге:
>
> ping -c 1 213.180.194.129
> PING 213.180.194.129 (213.180.194.129) 56(84) bytes of data.
>
> --- 213.180.194.129 ping statistics ---
> 1 packets transmitted, 0 received, 100% packet loss, time 0ms
>
> При этом в логе я вижу следующее:
>
> May 31 16:06:32 ugtovar kernel: BAD FROM YANDEX ICMP: IN=ppp0 OUT=
> MAC= SRC=213.180.194.129 DST=80.80.123.168 LEN=84 TOS=0x00 PREC=0x00
> TTL=54 ID=0 DF PROTO=ICMP TYPE=0 CODE=0 ID=37657 SEQ=1
>
> Т.е. пинг вышел наружу, хост 213.180.194.129 вернул ответ, и уже ответ
> был отфильтрован. А почему не был отфильтрован сам запрос?
Так Вы и не просили фильтровать ничего исходящего. (Это цепочка OUTPUT)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Comm] IPTABLES
2003-05-31 13:34 ` Andrii Dobrovolskii
@ 2003-05-31 13:49 ` Igo-aeroflot
0 siblings, 0 replies; 3+ messages in thread
From: Igo-aeroflot @ 2003-05-31 13:49 UTC (permalink / raw)
To: community
Andrii Dobrovolskii пишет:
> Igo-aeroflot wrote:
>
>> Здравствуйте!
>>
>> Есть скрипт, формирующий правила iptables, запрещающие обмен
>> ICMP-сообщениями с неким хостом. Упрощенно он выглядит так:
>>
>> EXTERNAL_IFACE="ppp0"
>> IPTABLES="/sbin/iptables"
>> $IPTABLES -P INPUT DROP
>> $IPTABLES -P OUTPUT ACCEPT
>> $IPTABLES -P FORWARD ACCEPT
>> $IPTABLES -N icmp_in_ppp
>> $IPTABLES -A icmp_in_ppp -p ICMP --destination 213.180.194.129 -m
>> limit --limit 2/minute --limit-burst 4 -j LOG --log-prefix "BAD TO
>> YANDEX ICMP: "
>> $IPTABLES -A icmp_in_ppp -p ICMP --destination 213.180.194.129 -j DROP
>> $IPTABLES -A icmp_in_ppp -p ICMP --source 213.180.194.129 -m limit
>> --limit 2/minute --limit-burst 4 -j LOG --log-prefix "BAD FROM YANDEX
>> ICMP: "
>> $IPTABLES -A icmp_in_ppp -p ICMP --source 213.180.194.129 -j DROP
>> $IPTABLES -A INPUT -p ICMP -i $EXTERNAL_IFACE -j icmp_in_ppp
>>
>> Вот что показывает iptables -L | grep "YANDEX ICMP" после запуска
>> этого скрипта:
>>
>> LOG icmp -- anywhere yandex.ru limit:
>> avg 2/min burst 4 LOG level warning prefix `BAD TO YANDEX ICMP: '
>> LOG icmp -- yandex.ru anywhere limit:
>> avg 2/min burst 4 LOG level warning prefix `BAD FROM YANDEX ICMP: '
>>
>> А вот что происходит при пинге:
>>
>> ping -c 1 213.180.194.129
>> PING 213.180.194.129 (213.180.194.129) 56(84) bytes of data.
>>
>> --- 213.180.194.129 ping statistics ---
>> 1 packets transmitted, 0 received, 100% packet loss, time 0ms
>>
>> При этом в логе я вижу следующее:
>>
>> May 31 16:06:32 ugtovar kernel: BAD FROM YANDEX ICMP: IN=ppp0 OUT=
>> MAC= SRC=213.180.194.129 DST=80.80.123.168 LEN=84 TOS=0x00 PREC=0x00
>> TTL=54 ID=0 DF PROTO=ICMP TYPE=0 CODE=0 ID=37657 SEQ=1
>>
>> Т.е. пинг вышел наружу, хост 213.180.194.129 вернул ответ, и уже
>> ответ был отфильтрован. А почему не был отфильтрован сам запрос?
>
>
> Так Вы и не просили фильтровать ничего исходящего. (Это цепочка OUTPUT)
>
> _______________________________________________
> Community mailing list
> Community@altlinux.ru
> http://www.altlinux.ru/mailman/listinfo/community
Понял
Спасибо
Тема закрыта
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-05-31 13:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-31 12:53 [Comm] IPTABLES Igo-aeroflot
2003-05-31 13:34 ` Andrii Dobrovolskii
2003-05-31 13:49 ` Igo-aeroflot
ALT Linux Community general discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
public-inbox-index community
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.community
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git