Debian Codegraph @

test/20-router/golden.txt

raw
1 table inet foomuuri
2 delete table inet foomuuri
3
4 table inet foomuuri {
5
6 chain allow_icmp_4 {
7 icmp type {
8 destination-unreachable, # 3, Destination Unreachable
9 time-exceeded, # 11, Time Exceeded
10 parameter-problem # 12, Parameter Problem
11 } accept
12 }
13
14 chain allow_icmp_6 {
15 icmpv6 type {
16 destination-unreachable, # 1, Destination Unreachable
17 packet-too-big, # 2, Packet Too Big
18 time-exceeded, # 3, Time Exceeded
19 parameter-problem, # 4, Parameter Problem
20 nd-router-solicit, # 133, Router Solicitation
21 nd-neighbor-solicit, # 135, Neighbor Solicitation
22 nd-neighbor-advert, # 136, Neighbor Advertisement
23 ind-neighbor-solicit, # 141, Inverse Neighbor Discovery Solicitation Message
24 ind-neighbor-advert # 142, Inverse Neighbor Discovery Advertisement Message
25 } accept
26 icmpv6 type . ip6 saddr {
27 nd-router-advert . fe80::/10, # 134, Router Advertisement
28 mld-listener-query . fe80::/10, # 130, Multicast Listener Query
29 mld-listener-report . fe80::/10, # 131, Multicast Listener Report
30 mld-listener-done . fe80::/10, # 132, Multicast Listener Done
31 149 . fe80::/10, # 149, Certification Path Advertisement Message
32 151 . fe80::/10, # 151, Multicast Router Advertisement
33 152 . fe80::/10, # 152, Multicast Router Solicitation
34 153 . fe80::/10, # 153, Multicast Router Termination
35 mld2-listener-report . fe80::/10, # 143, Version 2 Multicast Listener Report
36 mld2-listener-report . ::,
37 148 . fe80::/10, # 148, Certification Path Solicitation Message
38 148 . ::
39 } accept
40 }
41
42 chain smurfs_4 {
43 ip saddr 0.0.0.0 return
44 fib saddr type { broadcast, multicast } jump smurfs_drop
45 }
46
47 chain smurfs_6 {
48 fib saddr type multicast jump smurfs_drop
49 }
50
51 chain invalid_drop {
52 drop
53 }
54
55 chain smurfs_drop {
56 drop
57 }
58
59 chain rpfilter_drop {
60 udp sport 67 udp dport 68 return
61 update @_lograte_set_4 { ip saddr limit rate 1/second burst 3 packets } log prefix "RPFILTER DROP " level info flags skuid
62 update @_lograte_set_6 { ip6 saddr limit rate 1/second burst 3 packets } log prefix "RPFILTER DROP " level info flags skuid
63 drop
64 }
65
66 chain input {
67 type filter hook input priority filter + 5
68 iifname vmap @input_zones
69 update @_lograte_set_4 { ip saddr limit rate 1/second burst 3 packets } log prefix "INPUT DROP " level info flags skuid
70 update @_lograte_set_6 { ip6 saddr limit rate 1/second burst 3 packets } log prefix "INPUT DROP " level info flags skuid
71 drop
72 }
73
74 chain output {
75 type filter hook output priority filter + 5
76 oifname vmap @output_zones
77 ip protocol igmp ip daddr 224.0.0.22 accept
78 ip6 saddr :: icmpv6 type mld2-listener-report accept
79 update @_lograte_set_4 { ip saddr limit rate 1/second burst 3 packets } log prefix "OUTPUT REJECT " level info flags skuid
80 update @_lograte_set_6 { ip6 saddr limit rate 1/second burst 3 packets } log prefix "OUTPUT REJECT " level info flags skuid
81 reject with icmpx admin-prohibited
82 }
83
84 chain forward {
85 type filter hook forward priority filter + 5
86 iifname . oifname vmap @forward_zones
87 update @_lograte_set_4 { ip saddr limit rate 1/second burst 3 packets } log prefix "FORWARD DROP " level info flags skuid
88 update @_lograte_set_6 { ip6 saddr limit rate 1/second burst 3 packets } log prefix "FORWARD DROP " level info flags skuid
89 drop
90 }
91
92 set _rate_set_1_4 {
93 type ipv4_addr
94 size 65535
95 flags dynamic,timeout
96 timeout 1m
97 }
98
99 set _rate_set_1_6 {
100 type ipv6_addr
101 size 65535
102 flags dynamic,timeout
103 timeout 1m
104 }
105
106 set _rate_set_2_4 {
107 type ipv4_addr
108 size 65535
109 flags dynamic,timeout
110 timeout 1m
111 }
112
113 set _rate_set_2_6 {
114 type ipv6_addr
115 size 65535
116 flags dynamic,timeout
117 timeout 1m
118 }
119
120 set _rate_set_3_4 {
121 type ipv4_addr
122 size 65535
123 flags dynamic,timeout
124 timeout 1m
125 }
126
127 set _rate_set_3_6 {
128 type ipv6_addr
129 size 65535
130 flags dynamic,timeout
131 timeout 1m
132 }
133
134 set http_limit_4 {
135 type ipv4_addr
136 size 65535
137 flags dynamic,timeout
138 timeout 1m
139 }
140
141 set http_limit_6 {
142 type ipv6_addr
143 size 65535
144 flags dynamic,timeout
145 timeout 1m
146 }
147
148 set _rate_set_4_4 {
149 type ipv4_addr
150 size 65535
151 flags dynamic,timeout
152 timeout 1m
153 }
154
155 set _rate_set_4_6 {
156 type ipv6_addr
157 size 65535
158 flags dynamic,timeout
159 timeout 1m
160 }
161
162 set _rate_set_5_4 {
163 type ipv4_addr
164 size 65535
165 flags dynamic,timeout
166 timeout 1m
167 }
168
169 set _rate_set_5_6 {
170 type ipv6_addr
171 size 65535
172 flags dynamic,timeout
173 timeout 1m
174 }
175
176 set _rate_set_6_4 {
177 type ipv4_addr
178 size 65535
179 flags dynamic,timeout
180 timeout 1m
181 }
182
183 set _rate_set_6_6 {
184 type ipv6_addr
185 size 65535
186 flags dynamic,timeout
187 timeout 1m
188 }
189
190 set _rate_set_7_4 {
191 type ipv4_addr
192 size 65535
193 flags dynamic,timeout
194 timeout 1m
195 }
196
197 set _rate_set_7_6 {
198 type ipv6_addr
199 size 65535
200 flags dynamic,timeout
201 timeout 1m
202 }
203
204 map input_zones {
205 type ifname : verdict
206 elements = {
207 "lo" : accept,
208 "eth0" : jump public-localhost,
209 "eth1" : jump internal-localhost,
210 "eth2" : jump dmz-localhost,
211 }
212 }
213
214 map output_zones {
215 type ifname : verdict
216 elements = {
217 "lo" : accept,
218 "eth0" : jump localhost-public,
219 "eth1" : jump localhost-internal,
220 "eth2" : jump localhost-dmz,
221 }
222 }
223
224 map forward_zones {
225 type ifname . ifname : verdict
226 elements = {
227 "lo" . "lo" : accept,
228 "eth0" . "eth0" : jump public-public,
229 "eth0" . "eth1" : jump public-internal,
230 "eth0" . "eth2" : jump public-dmz,
231 "eth1" . "eth0" : jump internal-public,
232 "eth1" . "eth1" : jump internal-internal,
233 "eth1" . "eth2" : jump internal-dmz,
234 "eth2" . "eth0" : jump dmz-public,
235 "eth2" . "eth1" : jump dmz-internal,
236 "eth2" . "eth2" : jump dmz-dmz,
237 }
238 }
239
240 chain public-localhost {
241 meta nfproto vmap {
242 ipv4 : jump public-localhost_4,
243 ipv6 : jump public-localhost_6
244 }
245 }
246
247 chain public-localhost_4 {
248 icmp type echo-request update @_rate_set_1_4 { ip saddr limit rate 5/second burst 20 packets } accept
249 icmp type echo-request drop
250 jump allow_icmp_4
251 ct state vmap {
252 established : accept,
253 related : accept,
254 invalid : jump invalid_drop,
255 new : jump smurfs_4,
256 untracked : jump smurfs_4
257 }
258 ip protocol igmp ip daddr 224.0.0.1 accept
259 fib daddr type { broadcast, multicast } drop
260 tcp dport 22 update @_rate_set_3_4 { ip saddr limit rate 5/minute burst 5 packets } accept
261 update @_lograte_set_4 { ip saddr limit rate 1/second burst 3 packets } log prefix "public-localhost DROP " level info flags skuid
262 drop
263 }
264
265 chain public-localhost_6 {
266 icmpv6 type echo-request update @_rate_set_2_6 { ip6 saddr limit rate 5/second burst 20 packets } accept
267 icmpv6 type echo-request drop
268 jump allow_icmp_6
269 ct state vmap {
270 established : accept,
271 related : accept,
272 invalid : jump invalid_drop,
273 new : jump smurfs_6,
274 untracked : jump smurfs_6
275 }
276 fib daddr type multicast drop
277 tcp dport 22 update @_rate_set_3_6 { ip6 saddr limit rate 5/minute burst 5 packets } accept
278 update @_lograte_set_6 { ip6 saddr limit rate 1/second burst 3 packets } log prefix "public-localhost DROP " level info flags skuid
279 drop
280 }
281
282 chain internal-localhost {
283 meta nfproto vmap {
284 ipv4 : jump internal-localhost_4,
285 ipv6 : jump internal-localhost_6
286 }
287 }
288
289 chain internal-localhost_4 {
290 icmp type echo-request accept
291 jump allow_icmp_4
292 ct state vmap {
293 established : accept,
294 related : accept,
295 invalid : jump invalid_drop,
296 new : jump smurfs_4,
297 untracked : jump smurfs_4
298 }
299 fib daddr type broadcast udp dport 67 accept
300 ip protocol igmp ip daddr 224.0.0.1 accept
301 fib daddr type { broadcast, multicast } drop
302 udp dport { 123, 53, 67, 853 } accept
303 tcp dport { 22, 53, 853 } accept
304 update @_lograte_set_4 { ip saddr limit rate 1/second burst 3 packets } log prefix "internal-localhost REJECT " level info flags skuid
305 reject with icmpx admin-prohibited
306 }
307
308 chain internal-localhost_6 {
309 icmpv6 type echo-request accept
310 jump allow_icmp_6
311 ct state vmap {
312 established : accept,
313 related : accept,
314 invalid : jump invalid_drop,
315 new : jump smurfs_6,
316 untracked : jump smurfs_6
317 }
318 fib daddr type multicast ip6 daddr ff02::1:2 udp sport 546 udp dport 547 accept
319 fib daddr type multicast drop
320 udp dport { 123, 53, 853 } accept
321 tcp dport { 22, 53, 853 } accept
322 update @_lograte_set_6 { ip6 saddr limit rate 1/second burst 3 packets } log prefix "internal-localhost REJECT " level info flags skuid
323 reject with icmpx admin-prohibited
324 }
325
326 chain dmz-localhost {
327 meta nfproto vmap {
328 ipv4 : jump dmz-localhost_4,
329 ipv6 : jump dmz-localhost_6
330 }
331 }
332
333 chain dmz-localhost_4 {
334 icmp type echo-request accept
335 jump allow_icmp_4
336 ct state vmap {
337 established : accept,
338 related : accept,
339 invalid : jump invalid_drop,
340 new : jump smurfs_4,
341 untracked : jump smurfs_4
342 }
343 fib daddr type broadcast udp dport 67 accept
344 ip protocol igmp ip daddr 224.0.0.1 accept
345 fib daddr type { broadcast, multicast } drop
346 udp dport { 123, 53, 67, 853 } accept
347 tcp dport { 22, 53, 853 } accept
348 update @_lograte_set_4 { ip saddr limit rate 1/second burst 3 packets } log prefix "dmz-localhost REJECT " level info flags skuid
349 reject with icmpx admin-prohibited
350 }
351
352 chain dmz-localhost_6 {
353 icmpv6 type echo-request accept
354 jump allow_icmp_6
355 ct state vmap {
356 established : accept,
357 related : accept,
358 invalid : jump invalid_drop,
359 new : jump smurfs_6,
360 untracked : jump smurfs_6
361 }
362 fib daddr type multicast ip6 daddr ff02::1:2 udp sport 546 udp dport 547 accept
363 fib daddr type multicast drop
364 udp dport { 123, 53, 853 } accept
365 tcp dport { 22, 53, 853 } accept
366 update @_lograte_set_6 { ip6 saddr limit rate 1/second burst 3 packets } log prefix "dmz-localhost REJECT " level info flags skuid
367 reject with icmpx admin-prohibited
368 }
369
370 chain localhost-public {
371 meta nfproto vmap {
372 ipv4 : jump localhost-public_4,
373 ipv6 : jump localhost-public_6
374 }
375 }
376
377 chain localhost-public_4 {
378 icmp type echo-request accept
379 jump allow_icmp_4
380 ct state vmap {
381 established : accept,
382 related : accept,
383 invalid : jump invalid_drop,
384 new : jump smurfs_4,
385 untracked : jump smurfs_4
386 }
387 udp dport { 123, 443, 53, 853 } accept
388 tcp dport { 22, 443, 53, 80, 853 } accept
389 ip protocol igmp ip daddr 224.0.0.22 accept
390 update @_lograte_set_4 { ip saddr limit rate 1/second burst 3 packets } log prefix "localhost-public REJECT " level info flags skuid
391 reject with icmpx admin-prohibited
392 }
393
394 chain localhost-public_6 {
395 icmpv6 type echo-request accept
396 jump allow_icmp_6
397 ct state vmap {
398 established : accept,
399 related : accept,
400 invalid : jump invalid_drop,
401 new : jump smurfs_6,
402 untracked : jump smurfs_6
403 }
404 udp dport { 123, 443, 53, 853 } accept
405 tcp dport { 22, 443, 53, 80, 853 } accept
406 update @_lograte_set_6 { ip6 saddr limit rate 1/second burst 3 packets } log prefix "localhost-public REJECT " level info flags skuid
407 reject with icmpx admin-prohibited
408 }
409
410 chain internal-public {
411 meta nfproto vmap {
412 ipv4 : jump internal-public_4,
413 ipv6 : jump internal-public_6
414 }
415 }
416
417 chain internal-public_4 {
418 icmp type echo-request accept
419 jump allow_icmp_4
420 ct state vmap {
421 established : accept,
422 related : accept,
423 invalid : jump invalid_drop,
424 new : jump smurfs_4,
425 untracked : jump smurfs_4
426 }
427 fib daddr type { broadcast, multicast } drop
428 udp dport { 123, 19302-19309, 3478, 443, 53, 853 } accept
429 tcp dport { 22, 443, 53, 80, 853 } accept
430 update @_lograte_set_4 { ip saddr limit rate 1/second burst 3 packets } log prefix "internal-public REJECT " level info flags skuid
431 reject with icmpx admin-prohibited
432 }
433
434 chain internal-public_6 {
435 icmpv6 type echo-request accept
436 jump allow_icmp_6
437 ct state vmap {
438 established : accept,
439 related : accept,
440 invalid : jump invalid_drop,
441 new : jump smurfs_6,
442 untracked : jump smurfs_6
443 }
444 fib daddr type multicast drop
445 udp dport { 123, 19302-19309, 3478, 443, 53, 853 } accept
446 tcp dport { 22, 443, 53, 80, 853 } accept
447 update @_lograte_set_6 { ip6 saddr limit rate 1/second burst 3 packets } log prefix "internal-public REJECT " level info flags skuid
448 reject with icmpx admin-prohibited
449 }
450
451 chain dmz-public {
452 meta nfproto vmap {
453 ipv4 : jump dmz-public_4,
454 ipv6 : jump dmz-public_6
455 }
456 }
457
458 chain dmz-public_4 {
459 icmp type echo-request accept
460 jump allow_icmp_4
461 ct state vmap {
462 established : accept,
463 related : accept,
464 invalid : jump invalid_drop,
465 new : jump smurfs_4,
466 untracked : jump smurfs_4
467 }
468 fib daddr type { broadcast, multicast } drop
469 udp dport { 123, 443, 53, 853 } accept
470 tcp dport { 22, 25, 443, 53, 80, 853 } accept
471 update @_lograte_set_4 { ip saddr limit rate 1/second burst 3 packets } log prefix "dmz-public REJECT " level info flags skuid
472 reject with icmpx admin-prohibited
473 }
474
475 chain dmz-public_6 {
476 icmpv6 type echo-request accept
477 jump allow_icmp_6
478 ct state vmap {
479 established : accept,
480 related : accept,
481 invalid : jump invalid_drop,
482 new : jump smurfs_6,
483 untracked : jump smurfs_6
484 }
485 fib daddr type multicast drop
486 udp dport { 123, 443, 53, 853 } accept
487 tcp dport { 22, 25, 443, 53, 80, 853 } accept
488 update @_lograte_set_6 { ip6 saddr limit rate 1/second burst 3 packets } log prefix "dmz-public REJECT " level info flags skuid
489 reject with icmpx admin-prohibited
490 }
491
492 chain public-internal {
493 meta nfproto vmap {
494 ipv4 : jump public-internal_4,
495 ipv6 : jump public-internal_6
496 }
497 }
498
499 chain public-internal_4 {
500 jump allow_icmp_4
501 ct state vmap {
502 established : accept,
503 related : accept,
504 invalid : jump invalid_drop,
505 new : jump smurfs_4,
506 untracked : jump smurfs_4
507 }
508 fib daddr type { broadcast, multicast } drop
509 update @_lograte_set_4 { ip saddr limit rate 1/second burst 3 packets } log prefix "public-internal DROP " level info flags skuid
510 drop
511 }
512
513 chain public-internal_6 {
514 jump allow_icmp_6
515 ct state vmap {
516 established : accept,
517 related : accept,
518 invalid : jump invalid_drop,
519 new : jump smurfs_6,
520 untracked : jump smurfs_6
521 }
522 fib daddr type multicast drop
523 update @_lograte_set_6 { ip6 saddr limit rate 1/second burst 3 packets } log prefix "public-internal DROP " level info flags skuid
524 drop
525 }
526
527 chain localhost-internal {
528 meta nfproto vmap {
529 ipv4 : jump localhost-internal_4,
530 ipv6 : jump localhost-internal_6
531 }
532 }
533
534 chain localhost-internal_4 {
535 icmp type echo-request accept
536 jump allow_icmp_4
537 ct state vmap {
538 established : accept,
539 related : accept,
540 invalid : jump invalid_drop,
541 new : jump smurfs_4,
542 untracked : jump smurfs_4
543 }
544 udp dport 68 accept
545 tcp dport 22 accept
546 ip protocol igmp ip daddr 224.0.0.22 accept
547 update @_lograte_set_4 { ip saddr limit rate 1/second burst 3 packets } log prefix "localhost-internal REJECT " level info flags skuid
548 reject with icmpx admin-prohibited
549 }
550
551 chain localhost-internal_6 {
552 icmpv6 type echo-request accept
553 jump allow_icmp_6
554 ct state vmap {
555 established : accept,
556 related : accept,
557 invalid : jump invalid_drop,
558 new : jump smurfs_6,
559 untracked : jump smurfs_6
560 }
561 tcp dport 22 accept
562 ip6 daddr fe80::/10 udp sport 547 udp dport 546 accept
563 update @_lograte_set_6 { ip6 saddr limit rate 1/second burst 3 packets } log prefix "localhost-internal REJECT " level info flags skuid
564 reject with icmpx admin-prohibited
565 }
566
567 chain dmz-internal {
568 meta nfproto vmap {
569 ipv4 : jump dmz-internal_4,
570 ipv6 : jump dmz-internal_6
571 }
572 }
573
574 chain dmz-internal_4 {
575 jump allow_icmp_4
576 ct state vmap {
577 established : accept,
578 related : accept,
579 invalid : jump invalid_drop,
580 new : jump smurfs_4,
581 untracked : jump smurfs_4
582 }
583 fib daddr type { broadcast, multicast } drop
584 update @_lograte_set_4 { ip saddr limit rate 1/second burst 3 packets } log prefix "dmz-internal REJECT " level info flags skuid
585 reject with icmpx admin-prohibited
586 }
587
588 chain dmz-internal_6 {
589 jump allow_icmp_6
590 ct state vmap {
591 established : accept,
592 related : accept,
593 invalid : jump invalid_drop,
594 new : jump smurfs_6,
595 untracked : jump smurfs_6
596 }
597 fib daddr type multicast drop
598 update @_lograte_set_6 { ip6 saddr limit rate 1/second burst 3 packets } log prefix "dmz-internal REJECT " level info flags skuid
599 reject with icmpx admin-prohibited
600 }
601
602 chain localhost-dmz {
603 meta nfproto vmap {
604 ipv4 : jump localhost-dmz_4,
605 ipv6 : jump localhost-dmz_6
606 }
607 }
608
609 chain localhost-dmz_4 {
610 icmp type echo-request accept
611 jump allow_icmp_4
612 ct state vmap {
613 established : accept,
614 related : accept,
615 invalid : jump invalid_drop,
616 new : jump smurfs_4,
617 untracked : jump smurfs_4
618 }
619 udp dport { 443, 68 } accept
620 tcp dport { 22, 25, 443, 80 } accept
621 ip protocol igmp ip daddr 224.0.0.22 accept
622 update @_lograte_set_4 { ip saddr limit rate 1/second burst 3 packets } log prefix "localhost-dmz REJECT " level info flags skuid
623 reject with icmpx admin-prohibited
624 }
625
626 chain localhost-dmz_6 {
627 icmpv6 type echo-request accept
628 jump allow_icmp_6
629 ct state vmap {
630 established : accept,
631 related : accept,
632 invalid : jump invalid_drop,
633 new : jump smurfs_6,
634 untracked : jump smurfs_6
635 }
636 udp dport 443 accept
637 tcp dport { 22, 25, 443, 80 } accept
638 ip6 daddr fe80::/10 udp sport 547 udp dport 546 accept
639 update @_lograte_set_6 { ip6 saddr limit rate 1/second burst 3 packets } log prefix "localhost-dmz REJECT " level info flags skuid
640 reject with icmpx admin-prohibited
641 }
642
643 chain public-dmz {
644 meta nfproto vmap {
645 ipv4 : jump public-dmz_4,
646 ipv6 : jump public-dmz_6
647 }
648 }
649
650 chain public-dmz_4 {
651 icmp type echo-request update @_rate_set_5_4 { ip saddr limit rate 5/second burst 20 packets } accept
652 icmp type echo-request drop
653 jump allow_icmp_4
654 ct state vmap {
655 established : accept,
656 related : accept,
657 invalid : jump invalid_drop,
658 new : jump smurfs_4,
659 untracked : jump smurfs_4
660 }
661 fib daddr type { broadcast, multicast } drop
662 tcp dport 80 update @http_limit_4 { ip saddr limit rate 100/second burst 400 packets } accept
663 tcp dport 443 update @http_limit_4 { ip saddr limit rate 100/second burst 400 packets } accept
664 udp dport 443 update @http_limit_4 { ip saddr limit rate 100/second burst 400 packets } accept
665 tcp dport 25 update @_rate_set_4_4 { ip saddr limit rate 1/second burst 10 packets } accept
666 tcp dport 22 update @_rate_set_7_4 { ip saddr limit rate 5/minute burst 5 packets } accept
667 update @_lograte_set_4 { ip saddr limit rate 1/second burst 3 packets } log prefix "public-dmz DROP " level info flags skuid
668 drop
669 }
670
671 chain public-dmz_6 {
672 icmpv6 type echo-request update @_rate_set_6_6 { ip6 saddr limit rate 5/second burst 20 packets } accept
673 icmpv6 type echo-request drop
674 jump allow_icmp_6
675 ct state vmap {
676 established : accept,
677 related : accept,
678 invalid : jump invalid_drop,
679 new : jump smurfs_6,
680 untracked : jump smurfs_6
681 }
682 fib daddr type multicast drop
683 tcp dport 80 update @http_limit_6 { ip6 saddr limit rate 100/second burst 400 packets } accept
684 tcp dport 443 update @http_limit_6 { ip6 saddr limit rate 100/second burst 400 packets } accept
685 udp dport 443 update @http_limit_6 { ip6 saddr limit rate 100/second burst 400 packets } accept
686 tcp dport 25 update @_rate_set_4_6 { ip6 saddr limit rate 1/second burst 10 packets } accept
687 tcp dport 22 update @_rate_set_7_6 { ip6 saddr limit rate 5/minute burst 5 packets } accept
688 update @_lograte_set_6 { ip6 saddr limit rate 1/second burst 3 packets } log prefix "public-dmz DROP " level info flags skuid
689 drop
690 }
691
692 chain internal-dmz {
693 meta nfproto vmap {
694 ipv4 : jump internal-dmz_4,
695 ipv6 : jump internal-dmz_6
696 }
697 }
698
699 chain internal-dmz_4 {
700 icmp type echo-request accept
701 jump allow_icmp_4
702 ct state vmap {
703 established : accept,
704 related : accept,
705 invalid : jump invalid_drop,
706 new : jump smurfs_4,
707 untracked : jump smurfs_4
708 }
709 fib daddr type { broadcast, multicast } drop
710 udp dport 443 accept
711 tcp dport { 143, 22, 25, 443, 80 } accept
712 update @_lograte_set_4 { ip saddr limit rate 1/second burst 3 packets } log prefix "internal-dmz REJECT " level info flags skuid
713 reject with icmpx admin-prohibited
714 }
715
716 chain internal-dmz_6 {
717 icmpv6 type echo-request accept
718 jump allow_icmp_6
719 ct state vmap {
720 established : accept,
721 related : accept,
722 invalid : jump invalid_drop,
723 new : jump smurfs_6,
724 untracked : jump smurfs_6
725 }
726 fib daddr type multicast drop
727 udp dport 443 accept
728 tcp dport { 143, 22, 25, 443, 80 } accept
729 update @_lograte_set_6 { ip6 saddr limit rate 1/second burst 3 packets } log prefix "internal-dmz REJECT " level info flags skuid
730 reject with icmpx admin-prohibited
731 }
732
733 chain localhost-localhost {
734 meta nfproto vmap {
735 ipv4 : jump localhost-localhost_4,
736 ipv6 : jump localhost-localhost_6
737 }
738 }
739
740 chain localhost-localhost_4 {
741 jump allow_icmp_4
742 ct state vmap {
743 established : accept,
744 related : accept,
745 invalid : jump invalid_drop,
746 new : jump smurfs_4,
747 untracked : jump smurfs_4
748 }
749 accept
750 }
751
752 chain localhost-localhost_6 {
753 jump allow_icmp_6
754 ct state vmap {
755 established : accept,
756 related : accept,
757 invalid : jump invalid_drop,
758 new : jump smurfs_6,
759 untracked : jump smurfs_6
760 }
761 accept
762 }
763
764 chain public-public {
765 meta nfproto vmap {
766 ipv4 : jump public-public_4,
767 ipv6 : jump public-public_6
768 }
769 }
770
771 chain public-public_4 {
772 jump allow_icmp_4
773 ct state vmap {
774 established : accept,
775 related : accept,
776 invalid : jump invalid_drop,
777 new : jump smurfs_4,
778 untracked : jump smurfs_4
779 }
780 fib daddr type { broadcast, multicast } drop
781 update @_lograte_set_4 { ip saddr limit rate 1/second burst 3 packets } log prefix "public-public DROP " level info flags skuid
782 drop
783 }
784
785 chain public-public_6 {
786 jump allow_icmp_6
787 ct state vmap {
788 established : accept,
789 related : accept,
790 invalid : jump invalid_drop,
791 new : jump smurfs_6,
792 untracked : jump smurfs_6
793 }
794 fib daddr type multicast drop
795 update @_lograte_set_6 { ip6 saddr limit rate 1/second burst 3 packets } log prefix "public-public DROP " level info flags skuid
796 drop
797 }
798
799 chain internal-internal {
800 meta nfproto vmap {
801 ipv4 : jump internal-internal_4,
802 ipv6 : jump internal-internal_6
803 }
804 }
805
806 chain internal-internal_4 {
807 jump allow_icmp_4
808 ct state vmap {
809 established : accept,
810 related : accept,
811 invalid : jump invalid_drop,
812 new : jump smurfs_4,
813 untracked : jump smurfs_4
814 }
815 fib daddr type { broadcast, multicast } drop
816 update @_lograte_set_4 { ip saddr limit rate 1/second burst 3 packets } log prefix "internal-internal DROP " level info flags skuid
817 drop
818 }
819
820 chain internal-internal_6 {
821 jump allow_icmp_6
822 ct state vmap {
823 established : accept,
824 related : accept,
825 invalid : jump invalid_drop,
826 new : jump smurfs_6,
827 untracked : jump smurfs_6
828 }
829 fib daddr type multicast drop
830 update @_lograte_set_6 { ip6 saddr limit rate 1/second burst 3 packets } log prefix "internal-internal DROP " level info flags skuid
831 drop
832 }
833
834 chain dmz-dmz {
835 meta nfproto vmap {
836 ipv4 : jump dmz-dmz_4,
837 ipv6 : jump dmz-dmz_6
838 }
839 }
840
841 chain dmz-dmz_4 {
842 jump allow_icmp_4
843 ct state vmap {
844 established : accept,
845 related : accept,
846 invalid : jump invalid_drop,
847 new : jump smurfs_4,
848 untracked : jump smurfs_4
849 }
850 fib daddr type { broadcast, multicast } drop
851 update @_lograte_set_4 { ip saddr limit rate 1/second burst 3 packets } log prefix "dmz-dmz DROP " level info flags skuid
852 drop
853 }
854
855 chain dmz-dmz_6 {
856 jump allow_icmp_6
857 ct state vmap {
858 established : accept,
859 related : accept,
860 invalid : jump invalid_drop,
861 new : jump smurfs_6,
862 untracked : jump smurfs_6
863 }
864 fib daddr type multicast drop
865 update @_lograte_set_6 { ip6 saddr limit rate 1/second burst 3 packets } log prefix "dmz-dmz DROP " level info flags skuid
866 drop
867 }
868
869 chain nat_postrouting_srcnat {
870 type nat hook postrouting priority srcnat + 5
871 oifname "eth0" ip saddr 10.0.0.0/8 masquerade
872 }
873
874 chain nat_prerouting_dstnat {
875 type nat hook prerouting priority dstnat + 5
876 iifname "eth0" tcp dport 25 dnat ip to 10.1.0.2
877 iifname "eth0" tcp dport 80 dnat ip to 10.1.0.2
878 iifname "eth0" tcp dport 443 dnat ip to 10.1.0.2
879 iifname "eth0" udp dport 443 dnat ip to 10.1.0.2
880 iifname "eth0" tcp dport { 111, 112, 113 } dnat ip to 10.1.0.2
881 iifname "eth1" ip daddr 192.0.2.32 tcp dport 25 dnat ip to 10.1.0.2
882 iifname "eth1" ip daddr 192.0.2.32 tcp dport 80 dnat ip to 10.1.0.2
883 iifname "eth1" ip daddr 192.0.2.32 tcp dport 443 dnat ip to 10.1.0.2
884 iifname "eth1" ip daddr 192.0.2.32 udp dport 443 dnat ip to 10.1.0.2
885 }
886
887 set _lograte_set_4 {
888 type ipv4_addr
889 size 65535
890 flags dynamic,timeout
891 timeout 1m
892 }
893
894 set _lograte_set_6 {
895 type ipv6_addr
896 size 65535
897 flags dynamic,timeout
898 timeout 1m
899 }
900
901 chain rpfilter {
902 type filter hook prerouting priority filter + 5
903 fib saddr . mark . iif oif 0 meta ipsec missing jump rpfilter_drop
904 }
905
906 }