manual entries for melartin for fw, authkeys, and make-base-backup should no longer...
[mirror/dsa-puppet.git] / modules / ferm / manifests / per_host.pp
1 class ferm::per_host {
2         if $::hostname in [zandonai,zelenka] {
3                 include ferm::zivit
4         }
5
6         if (getfromhash($site::nodeinfo, 'hoster', 'name') == "aql") {
7                 include ferm::aql
8         }
9
10         case $::hostname {
11                 vittoria: {
12                         @ferm::rule { 'debconf17':
13                                 description     => 'temporarily allow DC17 access',
14                                 rule            => '&SERVICE_RANGE(tcp, 5432, ( 206.167.44.99/32 206.167.36.195/32 ))'
15                         }
16                 }
17                 czerny,clementi: {
18                         @ferm::rule { 'dsa-upsmon':
19                                 description     => 'Allow upsmon access',
20                                 rule            => '&SERVICE_RANGE(tcp, 3493, ( 82.195.75.64/26 192.168.43.0/24 ))'
21                         }
22                 }
23                 bendel: {
24                         @ferm::rule { 'listmaster-ontp-in':
25                                 description => 'ONTP has a broken mail setup',
26                                 table       => 'filter',
27                                 chain       => 'INPUT',
28                                 rule        => 'source 188.165.23.89/32 proto tcp dport 25 jump DROP',
29                         }
30                         @ferm::rule { 'listmaster-ontp-out':
31                                 description => 'ONTP has a broken mail setup',
32                                 table       => 'filter',
33                                 chain       => 'OUTPUT',
34                                 rule        => 'destination 78.8.208.246/32 proto tcp dport 25 jump DROP',
35                         }
36                 }
37                 lotti,lully,loghost-grnet-01: {
38                         @ferm::rule { 'dsa-syslog':
39                                 description     => 'Allow syslog access',
40                                 rule            => '&SERVICE_RANGE(tcp, 5140, $HOST_DEBIAN_V4)'
41                         }
42                         @ferm::rule { 'dsa-syslog-v6':
43                                 domain          => 'ip6',
44                                 description     => 'Allow syslog access',
45                                 rule            => '&SERVICE_RANGE(tcp, 5140, $HOST_DEBIAN_V6)'
46                         }
47                         @ferm::rule { 'fastly-syslog':
48                                 description     => 'Allow syslog access',
49                                 rule            => '&SERVICE_RANGE(tcp, 5141, $HOST_FASTLY)'
50                         }
51                 }
52                 kaufmann: {
53                         @ferm::rule { 'dsa-hkp':
54                                 domain          => '(ip ip6)',
55                                 description     => 'Allow hkp access',
56                                 rule            => '&SERVICE(tcp, 11371)'
57                         }
58                 }
59                 gombert: {
60                         @ferm::rule { 'dsa-infinoted':
61                                 domain          => '(ip ip6)',
62                                 description     => 'Allow infinoted access',
63                                 rule            => '&SERVICE(tcp, 6523)'
64                         }
65                 }
66                 draghi: {
67                         @ferm::rule { 'dsa-finger':
68                                 domain          => '(ip ip6)',
69                                 description     => 'Allow finger access',
70                                 rule            => '&SERVICE(tcp, 79)'
71                         }
72                         @ferm::rule { 'dsa-ldap':
73                                 domain          => '(ip ip6)',
74                                 description     => 'Allow ldap access',
75                                 rule            => '&SERVICE(tcp, 389)'
76                         }
77                         @ferm::rule { 'dsa-ldaps':
78                                 domain          => '(ip ip6)',
79                                 description     => 'Allow ldaps access',
80                                 rule            => '&SERVICE(tcp, 636)'
81                         }
82                 }
83                 sonntag: {
84                         @ferm::rule { 'dsa-bugs-search':
85                                 description  => 'port 1978 for bugs-search from bug web frontends',
86                                 rule         => '&SERVICE_RANGE(tcp, 1978, ( 140.211.166.26 209.87.16.39 ))'
87                         }
88                 }
89                 default: {}
90         }
91
92         # redirect snapshot into varnish
93         case $::hostname {
94                 sibelius: {
95                         @ferm::rule { 'dsa-snapshot-varnish':
96                                 rule            => '&SERVICE(tcp, 6081)',
97                         }
98                         @ferm::rule { 'dsa-nat-snapshot-varnish':
99                                 table           => 'nat',
100                                 chain           => 'PREROUTING',
101                                 rule            => 'proto tcp daddr 193.62.202.30 dport 80 REDIRECT to-ports 6081',
102                         }
103                 }
104                 lw07: {
105                         @ferm::rule { 'dsa-snapshot-varnish':
106                                 rule            => '&SERVICE(tcp, 6081)',
107                         }
108                         @ferm::rule { 'dsa-nat-snapshot-varnish':
109                                 table           => 'nat',
110                                 chain           => 'PREROUTING',
111                                 rule            => 'proto tcp daddr 185.17.185.185 dport 80 REDIRECT to-ports 6081',
112                         }
113                 }
114                 default: {}
115         }
116         case $::hostname {
117                 bm-bl1,bm-bl2: {
118                         @ferm::rule { 'dsa-vrrp':
119                                 rule            => 'proto vrrp daddr 224.0.0.18 jump ACCEPT',
120                         }
121                         @ferm::rule { 'dsa-conntrackd':
122                                 rule            => 'interface vlan2 daddr 225.0.0.50 jump ACCEPT',
123                         }
124                         @ferm::rule { 'dsa-bind-notrack-in':
125                                 domain      => 'ip',
126                                 description => 'NOTRACK for nameserver traffic',
127                                 table       => 'raw',
128                                 chain       => 'PREROUTING',
129                                 rule        => 'proto (tcp udp) daddr 5.153.231.24 dport 53 jump NOTRACK'
130                         }
131
132                         @ferm::rule { 'dsa-bind-notrack-out':
133                                 domain      => 'ip',
134                                 description => 'NOTRACK for nameserver traffic',
135                                 table       => 'raw',
136                                 chain       => 'OUTPUT',
137                                 rule        => 'proto (tcp udp) saddr 5.153.231.24 sport 53 jump NOTRACK'
138                         }
139
140                         @ferm::rule { 'dsa-bind-notrack-in6':
141                                 domain      => 'ip6',
142                                 description => 'NOTRACK for nameserver traffic',
143                                 table       => 'raw',
144                                 chain       => 'PREROUTING',
145                                 rule        => 'proto (tcp udp) daddr 2001:41c8:1000:21::21:24 dport 53 jump NOTRACK'
146                         }
147
148                         @ferm::rule { 'dsa-bind-notrack-out6':
149                                 domain      => 'ip6',
150                                 description => 'NOTRACK for nameserver traffic',
151                                 table       => 'raw',
152                                 chain       => 'OUTPUT',
153                                 rule        => 'proto (tcp udp) saddr 2001:41c8:1000:21::21:24 sport 53 jump NOTRACK'
154                         }
155                 }
156                 default: {}
157         }
158
159         # postgres stuff
160         case $::hostname {
161                 ullmann: {
162                         @ferm::rule { 'dsa-postgres-udd':
163                                 description     => 'Allow postgress access',
164                                 # quantz, moszumanska, master, coccia
165                                 rule            => '&SERVICE_RANGE(tcp, 5452, ( 5.153.231.28/32 5.153.231.21/32 82.195.75.110/32 5.153.231.11/32 ))'
166                         }
167                         @ferm::rule { 'dsa-postgres-udd6':
168                                 domain          => '(ip6)',
169                                 description     => 'Allow postgress access',
170                                 rule            => '&SERVICE_RANGE(tcp, 5452, ( 2001:41c8:1000:21::21:28/128 2001:41b8:202:deb:216:36ff:fe40:4001/128 2001:41c8:1000:21::21:11/32 2001:41c8:1000:21::21:21/128 ))'
171                         }
172                 }
173                 fasolo: {
174                         @ferm::rule { 'dsa-postgres-fasolo':
175                                 description     => 'Allow postgress access',
176                                 rule            => '&SERVICE_RANGE(tcp, 5433, ( 5.153.231.10/32 ))'
177                         }
178                         @ferm::rule { 'dsa-postgres-fasolo6':
179                                 domain          => 'ip6',
180                                 description     => 'Allow postgress access',
181                                 rule            => '&SERVICE_RANGE(tcp, 5433, ( 2001:41c8:1000:21::21:10/128 ))'
182                         }
183
184                         @ferm::rule { 'dsa-postgres-backup':
185                                 description     => 'Allow postgress access',
186                                 rule            => '&SERVICE_RANGE(tcp, 5433, ( $HOST_PGBACKUPHOST_V4 ))'
187                         }
188                         @ferm::rule { 'dsa-postgres-backup6':
189                                 domain          => 'ip6',
190                                 description     => 'Allow postgress access',
191                                 rule            => '&SERVICE_RANGE(tcp, 5433, ( $HOST_PGBACKUPHOST_V6 ))'
192                         }
193                 }
194                 bmdb1: {
195                         @ferm::rule { 'dsa-postgres-main':
196                                 description     => 'Allow postgress access',
197                                 rule            => '&SERVICE_RANGE(tcp, 5435, ( 5.153.231.23/32 5.153.231.25/32 209.87.16.38/32 5.153.231.26/32 5.153.231.18/32 5.153.231.28/32 5.153.231.249/32 5.153.231.29/32 5.153.231.43/32 5.153.231.33/32 ))'
198                         }
199                         @ferm::rule { 'dsa-postgres-main6':
200                                 domain          => 'ip6',
201                                 description     => 'Allow postgress access',
202                                 rule            => '&SERVICE_RANGE(tcp, 5435, ( 2001:41c8:1000:21::21:23/128 2001:41c8:1000:21::21:25/128 2607:f8f0:614:1::1274:38/128 2001:41c8:1000:21::21:26/128 2001:41c8:1000:21::21:18/128 2001:41c8:1000:21::21:28/128 2001:41c8:1000:20::20:249/128 2001:41c8:1000:21::21:29/128 2001:41c8:1000:21::21:43/128 2001:41c8:1000:21::21:33/128 ))'
203                         }
204                         @ferm::rule { 'dsa-postgres-dak':
205                                 description     => 'Allow postgress access',
206                                 rule            => '&SERVICE_RANGE(tcp, 5434, ( 5.153.231.11/32 5.153.231.28/32 209.87.16.26/32 5.153.231.21/32 5.153.231.18/32 5.153.231.29/32 128.31.0.69/32 ))'
207                         }
208                         @ferm::rule { 'dsa-postgres-dak6':
209                                 domain          => 'ip6',
210                                 description     => 'Allow postgress access',
211                                 rule            => '&SERVICE_RANGE(tcp, 5434, ( 2001:41c8:1000:21::21:11/128 2001:41c8:1000:21::21:28/128 2607:f8f0:614:1::1274:26/128 2001:41c8:1000:21::21:21/128 2001:41c8:1000:21::21:18/128 2001:41c8:1000:21::21:29/128 ))'
212                         }
213                         @ferm::rule { 'dsa-postgres-wannabuild':
214                                 # wuiet, ullmann
215                                 description     => 'Allow postgress access',
216                                 rule            => '&SERVICE_RANGE(tcp, 5436, ( 5.153.231.18/32 209.87.16.38/32 ))'
217                         }
218                         @ferm::rule { 'dsa-postgres-wannabuild6':
219                                 domain          => 'ip6',
220                                 description     => 'Allow postgress access',
221                                 rule            => '&SERVICE_RANGE(tcp, 5436, ( 2001:41c8:1000:21::21:18/128 2607:f8f0:614:1::1274:38/128 ))'
222                         }
223                         @ferm::rule { 'dsa-postgres-bacula':
224                                 # dinis
225                                 description     => 'Allow postgress access1',
226                                 rule            => '&SERVICE_RANGE(tcp, 5437, ( 5.153.231.19/32 93.94.130.161/32 ))'
227                         }
228                         @ferm::rule { 'dsa-postgres-bacula6':
229                                 domain          => 'ip6',
230                                 description     => 'Allow postgress access1',
231                                 rule            => '&SERVICE_RANGE(tcp, 5437, ( 2001:41c8:1000:21::21:19/128 2a02:158:380:280::161/128 ))'
232                         }
233
234                         @ferm::rule { 'dsa-postgres-backup':
235                                 description     => 'Allow postgress access',
236                                 rule            => '&SERVICE_RANGE(tcp, (5435 5436 5440), ( $HOST_PGBACKUPHOST_V4 ))'
237                         }
238                         @ferm::rule { 'dsa-postgres-backup6':
239                                 domain          => 'ip6',
240                                 description     => 'Allow postgress access',
241                                 rule            => '&SERVICE_RANGE(tcp, (5435 5436 5440), ( $HOST_PGBACKUPHOST_V6 ))'
242                         }
243
244                         @ferm::rule { 'dsa-postgres-dedup':
245                                 # ubc, wuit
246                                 description     => 'Allow postgress access',
247                                 rule            => '&SERVICE_RANGE(tcp, (5439), ( 5.153.231.17/32 ))'
248                         }
249                         @ferm::rule { 'dsa-postgres-dedup6':
250                                 domain          => 'ip6',
251                                 description     => 'Allow postgress access',
252                                 rule            => '&SERVICE_RANGE(tcp, (5439), ( 2001:41c8:1000:21::21:17/128 ))'
253                         }
254
255                         @ferm::rule { 'dsa-postgres-debsources':
256                                 description     => 'Allow postgress access',
257                                 rule            => '&SERVICE_RANGE(tcp, (5440), ( 5.153.231.38/32 ))'
258                         }
259                         @ferm::rule { 'dsa-postgres-debsources6':
260                                 domain          => 'ip6',
261                                 description     => 'Allow postgress access',
262                                 rule            => '&SERVICE_RANGE(tcp, (5440), ( 2001:41c8:1000:21::21:38/128 ))'
263                         }
264                 }
265                 danzi: {
266                         @ferm::rule { 'dsa-postgres-danzi':
267                                 # ubc, wuit
268                                 description     => 'Allow postgress access',
269                                 rule            => '&SERVICE_RANGE(tcp, 5433, ( 206.12.19.0/24 209.87.16.0/24 5.153.231.18/32 ))'
270                         }
271                         @ferm::rule { 'dsa-postgres-danzi6':
272                                 domain          => 'ip6',
273                                 description     => 'Allow postgress access',
274                                 rule            => '&SERVICE_RANGE(tcp, 5433, ( 2607:f8f0:610:4000::/64 2607:f8f0:614:1::/64 2001:41c8:1000:21::21:18/128 ))'
275                         }
276
277                         @ferm::rule { 'dsa-postgres2-danzi':
278                                 description     => 'Allow postgress access2',
279                                 rule            => '&SERVICE_RANGE(tcp, 5437, ( 206.12.19.0/24 209.87.16.0/24 ))'
280                         }
281                         @ferm::rule { 'dsa-postgres3-danzi':
282                                 description     => 'Allow postgress access3',
283                                 rule            => '&SERVICE_RANGE(tcp, 5436, ( 206.12.19.0/24 209.87.16.0/24 ))'
284                         }
285                         @ferm::rule { 'dsa-postgres4-danzi':
286                                 description     => 'Allow postgress access4',
287                                 rule            => '&SERVICE_RANGE(tcp, 5438, ( 206.12.19.0/24 209.87.16.0/24 ))'
288                         }
289
290                         @ferm::rule { 'dsa-postgres-backup':
291                                 description     => 'Allow postgress access',
292                                 rule            => '&SERVICE_RANGE(tcp, 5433, ( $HOST_PGBACKUPHOST_V4 ))'
293                         }
294                         @ferm::rule { 'dsa-postgres-backup6':
295                                 domain          => 'ip6',
296                                 description     => 'Allow postgress access',
297                                 rule            => '&SERVICE_RANGE(tcp, 5433, ( $HOST_PGBACKUPHOST_V6 ))'
298                         }
299                 }
300                 seger: {
301                         @ferm::rule { 'dsa-postgres-backup':
302                                 description     => 'Allow postgress access',
303                                 rule            => '&SERVICE_RANGE(tcp, 5432, ( $HOST_PGBACKUPHOST_V4 ))'
304                         }
305                         @ferm::rule { 'dsa-postgres-backup6':
306                                 domain          => 'ip6',
307                                 description     => 'Allow postgress access',
308                                 rule            => '&SERVICE_RANGE(tcp, 5432, ( $HOST_PGBACKUPHOST_V6 ))'
309                         }
310                 }
311                 sibelius: {
312                         @ferm::rule { 'dsa-postgres-backup':
313                                 description     => 'Allow postgress access',
314                                 rule            => '&SERVICE_RANGE(tcp, 5433, ( $HOST_PGBACKUPHOST_V4 ))'
315                         }
316                         @ferm::rule { 'dsa-postgres-backup6':
317                                 domain          => 'ip6',
318                                 description     => 'Allow postgress access',
319                                 rule            => '&SERVICE_RANGE(tcp, 5433, ( $HOST_PGBACKUPHOST_V6 ))'
320                         }
321                         @ferm::rule { 'dsa-postgres-replication':
322                                 description     => 'Allow postgress access',
323                                 rule            => '&SERVICE_RANGE(tcp, 5433, ( 185.17.185.187/32 ))'
324                         }
325                         @ferm::rule { 'dsa-postgres-replication6':
326                                 domain          => 'ip6',
327                                 description     => 'Allow postgress access',
328                                 rule            => '&SERVICE_RANGE(tcp, 5433, ( 2001:1af8:4020:b030:deb::187/128 ))'
329                         }
330                 }
331                 lw07: {
332                         @ferm::rule { 'dsa-postgres-snapshot':
333                                 description     => 'Allow postgress access',
334                                 rule            => '&SERVICE_RANGE(tcp, 5439, ( 185.17.185.176/28 ))'
335                         }
336                         @ferm::rule { 'dsa-postgres-snapshot6':
337                                 domain          => 'ip6',
338                                 description     => 'Allow postgress access',
339                                 rule            => '&SERVICE_RANGE(tcp, 5439, ( 2001:1af8:4020:b030::/64 ))'
340                         }
341                 }
342                 vittoria: {
343                         @ferm::rule { 'dsa-postgres-backup':
344                                 description     => 'Allow postgress access',
345                                 rule            => '&SERVICE_RANGE(tcp, 5432, ( $HOST_PGBACKUPHOST_V4 ))'
346                         }
347                         @ferm::rule { 'dsa-postgres-backup6':
348                                 domain          => 'ip6',
349                                 description     => 'Allow postgress access',
350                                 rule            => '&SERVICE_RANGE(tcp, 5432, ( $HOST_PGBACKUPHOST_V6 ))'
351                         }
352                 }
353                 buxtehude: {
354                         @ferm::rule { 'dsa-postgres-backup':
355                                 description     => 'Allow postgress access',
356                                 rule            => '&SERVICE_RANGE(tcp, (5433 5441), ( $HOST_PGBACKUPHOST_V4 ))'
357                         }
358                         @ferm::rule { 'dsa-postgres-backup6':
359                                 domain          => 'ip6',
360                                 description     => 'Allow postgress access',
361                                 rule            => '&SERVICE_RANGE(tcp, (5433 5441), ( $HOST_PGBACKUPHOST_V6 ))'
362                         }
363                 }
364                 default: {}
365         }
366         # vpn fu
367         case $::hostname {
368                 draghi: {
369                         @ferm::rule { 'dsa-vpn':
370                                 description     => 'Allow openvpn access',
371                                 rule            => '&SERVICE(udp, 17257)'
372                         }
373                         @ferm::rule { 'dsa-routing':
374                                 description     => 'forward chain',
375                                 chain           => 'FORWARD',
376                                 rule            => 'policy ACCEPT;
377 mod state state (ESTABLISHED RELATED) ACCEPT;
378 interface tun+ ACCEPT;
379 REJECT reject-with icmp-admin-prohibited
380 '
381                         }
382                         @ferm::rule { 'dsa-vpn-mark':
383                                 table           => 'mangle',
384                                 chain           => 'PREROUTING',
385                                 rule            => 'interface tun+ MARK set-mark 1',
386                         }
387                         @ferm::rule { 'dsa-vpn-nat':
388                                 table           => 'nat',
389                                 chain           => 'POSTROUTING',
390                                 rule            => 'outerface !tun+ mod mark mark 1 MASQUERADE',
391                         }
392                 }
393                 ubc-enc2bl01,ubc-enc2bl02,ubc-enc2bl09,ubc-enc2bl10: {
394                         @ferm::rule { 'dsa-luca-fixme':
395                                 description     => 'Allow ssh access from mnt and vpn networks',
396                                 rule            => '&SERVICE_RANGE(tcp, 22, ( 172.29.40.0/22 172.29.203.0/24 ))',
397                         }
398                 }
399                 default: {}
400         }
401         # tftp
402         case $::hostname {
403                 abel: {
404                         @ferm::rule { 'dsa-tftp':
405                                 description     => 'Allow tftp access',
406                                 rule            => '&SERVICE_RANGE(udp, 69, ( 172.28.17.0/24 ))'
407                         }
408                 }
409                 master: {
410                         @ferm::rule { 'dsa-tftp':
411                                 description     => 'Allow tftp access',
412                                 rule            => '&SERVICE_RANGE(udp, 69, ( 82.195.75.64/26 192.168.43.0/24 ))'
413                         }
414                 }
415         }
416 }