%

Manage ICMP through PF (Packet-Filter)

Article published the ; modified the
2 minutes to read

This article has 263 words.
RAW source of the article:
Commit version: 79c4c86

Description

Tip

Following the recommendations from my article about the rules to be put in place to allow or block ICMP messages, here are the adequate rules for PF, for *BSD that use Packet Filter, including OpenBSD:

Manage ICMP

Drop

()

icmp_block_types="{ 4 6 15 16 17 18 31 32 33 34 35 36 37 38 39 }"

()

block drop quick on egress inet proto icmp icmp-type 3 code 6
block drop in quick on egress inet proto icmp icmp-type 3 code 7
block drop quick on egress inet proto icmp icmp-type 3 code 8
block drop quick on egress inet proto icmp icmp-type $icmp_block_types

()
Warning

Pass

Info
()

icmp_types="{ 8 11 12 }"

()
block log
pass out
()

pass in quick on egress inet proto icmp from any to egress icmp-type { 3 code 3, 3 code 4 }
pass in quick on egress inet proto icmp from any to egress icmp-type $icmp_types

pass out quick on egress inet proto icmp from egress to any icmp-type { 3 code 3, 3 code 4 }
pass out quick on egress inet proto icmp from egress to any icmp-type $icmp_types

Or course, you can authorize all other codes that can be passed, and whose recommendations are to limit. The 3 highlighted codes are a minimum!