Debian Codegraph @

test/20-router/foomuuri.conf

raw
1 zone {
2 localhost
3 public eth0
4 internal eth1
5 dmz eth2
6 }
7
8 snat {
9 # Masquerade traffic from internal to public.
10 saddr 10.0.0.0/8 oifname eth0 masquerade
11 }
12
13 dnat {
14 # DNAT incoming SMTP and HTTPS traffic from public to dmz server. This
15 # section is needed only if dmz server doesn't have public IP address.
16 iifname eth0 smtp dnat 10.1.0.2 # public -> dmz
17 iifname eth0 http dnat 10.1.0.2 # public -> dmz
18 iifname eth0 https dnat 10.1.0.2 # public -> dmz
19 iifname eth0 tcp 111 112 113 dnat 10.1.0.2 # set of ports
20 iifname eth1 daddr 192.0.2.32 smtp dnat 10.1.0.2 # internal -> dmz
21 iifname eth1 daddr 192.0.2.32 http dnat 10.1.0.2 # internal -> dmz
22 iifname eth1 daddr 192.0.2.32 https dnat 10.1.0.2 # internal -> dmz
23 }
24
25 macro {
26 # Define rate limits as macros as same limits are used in public-localhost
27 # and in public-dmz.
28 http_rate saddr_rate "100/second burst 400" saddr_rate_name http_limit
29 mail_rate saddr_rate "1/second burst 10"
30 ping_rate saddr_rate "5/second burst 20"
31 ssh_rate saddr_rate "5/minute burst 5"
32 }
33
34 template localhost_services {
35 # Shared list of services running on localhost. It runs DHCP server and DNS
36 # resolver for internal and dmz networks, plus basic SSH etc. rules.
37 dhcp-server
38 dhcpv6-server
39 domain
40 domain-s
41 ntp
42 ping
43 ssh
44 }
45
46 public-localhost {
47 # Allow only ping and SSH from internet to localhost.
48 ping ping_rate
49 ssh ssh_rate
50 drop log
51 }
52
53 internal-localhost {
54 # Servers on internal network can access localhost's basic services.
55 template localhost_services
56 reject log
57 }
58
59 dmz-localhost {
60 # Servers on dmz can access localhost's basic services, similar to
61 # internal-localhost.
62 template localhost_services
63 reject log
64 }
65
66 template public_services {
67 # Shared list of services that run on internet.
68 domain
69 domain-s
70 http
71 https
72 ntp
73 ping
74 ssh
75 }
76
77 localhost-public {
78 # Basic services from localhost to internet: DNS queries, HTTPS, SSH, etc.
79 template public_services
80 reject log
81 }
82
83 internal-public {
84 # Basic services from internal to internet: DNS queries, HTTPS, SSH, etc.
85 template public_services
86 googlemeet
87 reject log
88 }
89
90 dmz-public {
91 # Basic services from dmz to internet, plus SMTP for email transfer..
92 template public_services
93 smtp
94 reject log
95 }
96
97 public-internal {
98 # No traffic is allowed from internet to internal network.
99 drop log
100 }
101
102 localhost-internal {
103 # DHCP server reply packets
104 dhcp-client
105 dhcpv6-client
106 # Very limited access from localhost to internal network.
107 ping
108 ssh
109 reject log
110 }
111
112 dmz-internal {
113 # Servers on dmz don't need any access to internal network.
114 reject log
115 }
116
117 template dmz_services {
118 # Shared list of services that run on dmz.
119 http
120 https
121 ping
122 smtp
123 ssh
124 }
125
126 localhost-dmz {
127 # DHCP server reply packets
128 dhcp-client
129 dhcpv6-client
130 # localhost can access dmz server services.
131 template dmz_services
132 reject log
133 }
134
135 public-dmz {
136 # Allow traffic from internet to dmz server with rate limits.
137 http http_rate
138 https http_rate
139 smtp mail_rate
140 ping ping_rate
141 ssh ssh_rate
142 drop log
143 }
144
145 internal-dmz {
146 # Laptops and workstations in internal network can access dmz server
147 # services, plus IMAP for reading email.
148 template dmz_services
149 imap
150 reject log
151 }