031471507b691653d0f6351186593b6a103df07e
[mirror/dsa-puppet.git] / modules / ferm / templates / defs.conf.erb
1 ##
2 ## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
3 ## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
4 ##
5
6 @def &SERVICE($proto, $port) = {
7  proto $proto mod state state (NEW) dport $port ACCEPT;
8 }
9
10 @def &SERVICE_RANGE($proto, $port, $srange) = {
11  proto $proto mod state state (NEW) dport $port @subchain "$port" { saddr ($srange) ACCEPT; }"
12 }
13
14 @def &TCP_UDP_SERVICE($port) = {
15  proto (tcp udp) dport $port ACCEPT;
16 }
17
18 @def &TCP_UDP_SERVICE_RANGE($port, $srange) = {
19  proto (tcp udp) dport $port @subchain "$port" { saddr ($srange) ACCEPT; }"
20 }
21
22 <%
23   rolehost={}
24   allnodeinfo = scope.lookupvar('deprecated::allnodeinfo')
25   roles = scope.lookupvar('deprecated::roles')
26
27   %w{mailrelay nagiosmaster  muninmaster postgres_backup_server}.each do |role|
28     rolehost[role] = []
29     roles[role].each do |node|
30         next unless allnodeinfo.has_key?(node) and allnodeinfo[node].has_key?('ipHostNumber')
31         rolehost[role] << allnodeinfo[node]['ipHostNumber']
32     end
33     rolehost[role].flatten!.sort.uniq
34   end
35
36   dbs = []
37   allnodeinfo.keys.sort.each do |node|
38       next unless allnodeinfo[node].has_key?('ipHostNumber')
39       dbs << allnodeinfo[node]['ipHostNumber']
40   end
41   dbs.flatten!
42 %>
43
44 @def $HOST_MAILRELAY_V4 = (<%= scope.function_filter_ipv4([rolehost['mailrelay']]).uniq.join(' ') %>);
45 @def $HOST_MAILRELAY_V6 = (<%= scope.function_filter_ipv6([rolehost['mailrelay']]).uniq.join(' ') %>);
46 @def $HOST_MAILRELAY = ( $HOST_MAILRELAY_V4 $HOST_MAILRELAY_V6 );
47
48 @def $HOST_NAGIOS_V4 = (<%= scope.function_filter_ipv4([rolehost['nagiosmaster']]).uniq.join(' ') %>);
49 @def $HOST_NAGIOS_V6 = (<%= scope.function_filter_ipv6([rolehost['nagiosmaster']]).uniq.join(' ') %>);
50 @def $HOST_NAGIOS = ( $HOST_NAGIOS_V4 $HOST_NAGIOS_V6 );
51
52 @def $HOST_MUNIN_V4 = (<%= scope.function_filter_ipv4([rolehost['muninmaster']]).uniq.join(' ') %>);
53 @def $HOST_MUNIN_V6 = (<%= scope.function_filter_ipv6([rolehost['muninmaster']]).uniq.join(' ') %>);
54 @def $HOST_MUNIN = ( $HOST_MUNIN_V4 $HOST_MUNIN_V6 );
55
56 @def $HOST_PGBACKUPHOST_V4 = (<%= scope.function_filter_ipv4([rolehost['postgres_backup_server']]).uniq.join(' ') %>);
57 @def $HOST_PGBACKUPHOST_V6 = (<%= scope.function_filter_ipv6([rolehost['postgres_backup_server']]).uniq.join(' ') %>);
58 @def $HOST_PGBACKUPHOST = ( $HOST_PGBACKUPHOST_V4 $HOST_PGBACKUPHOST_V6 );
59
60
61 <%
62 def getfastlyranges()
63     begin
64         data = YAML.safe_load(File.open("/srv/puppet.debian.org/puppet-facts/fastly_ranges.yaml").read)
65         return data['addresses']
66     rescue
67         return []
68     end
69 end
70 %>
71 @def $HOST_FASTLY = (<%= getfastlyranges().join(' ') %>);
72
73 @def $HOST_DEBIAN_V4 = (<%= scope.function_filter_ipv4([dbs]).uniq.join(' ') %>);
74 @def $HOST_DEBIAN_V6 = (<%= scope.function_filter_ipv6([dbs]).uniq.join(' ') %>);
75 @def $HOST_DEBIAN = ($HOST_DEBIAN_V4 $HOST_DEBIAN_V6);
76
77
78 @def $weasel  = ();
79 @def $weasel  = ($weasel 86.59.118.144/28); # debian@sil
80 @def $weasel  = ($weasel 86.59.21.32/29); # anguilla1
81 @def $weasel  = ($weasel 86.59.30.32/28); # anguilla2
82 @def $weasel  = ($weasel 213.235.231.192/26); # sil-noreply
83 @def $weasel  = ($weasel 141.201.0.0/16); # uni salzburg
84 @def $weasel  = ($weasel 62.99.152.176/28); # campus sbg
85 @def $weasel  = ($weasel 194.118.0.0/16 62.46.0.0/15); # A1 Telekom
86 @def $zobel   = ();
87 @def $zobel   = ($zobel 87.139.82.80/32); # exit.credativ.com
88 @def $zobel   = ($zobel 87.193.134.192/27); # credativ qsc
89 @def $zobel   = ($zobel 94.79.138.160/29); # credativ Unitiymedia
90 @def $zobel   = ($zobel 78.47.2.104/29); # baldur, bragi, saga
91 @def $zobel   = ($zobel 217.6.179.48/29); # credativ DTAG
92 @def $zobel   = ($zobel 62.154.226.64/27); # credativ DTAG 2
93 @def $zobel   = ($zobel 92.198.42.24/29); # DG-i Office
94 @def $zobel   = ($zobel 93.94.128.0/21);  # DG-i AS
95 @def $zobel   = ($zobel 195.49.152.0/22); # DG-i AS
96 @def $zobel   = ($zobel 194.187.64.0/22); # DG-i AS
97 @def $zobel   = ($zobel 88.99.108.200/29); # buri, dag, ...
98 @def $luca    = ();
99 @def $luca    = ($luca 162.210.192.22);  # jump snafu.emyr.net
100 @def $tfheen   = ();
101 @def $tfheen   = ($tfheen 178.255.151.162); # vuizook
102 @def $tfheen   = ($tfheen 51.174.0.0/15); # Altibox
103 @def $jcristau = ();
104 @def $jcristau = ($jcristau 82.255.47.115/32); # home
105 @def $jcristau = ($jcristau 62.210.122.202/32); # topinambour
106 @def $master   = (82.195.75.110); # master.debian.org
107 @def $people   = (5.153.231.30); # paradis.debian.org
108 @def $DSA_IPS = ($weasel $zobel $luca $tfheen $jcristau $master $people);
109
110 @def $weasel6    = ();
111 @def $weasel6    = ($weasel6 2001:826:408::/48); # unisbg
112 @def $weasel6    = ($weasel6 2001:858:10f::/48); # anguilla
113 @def $zobel6     = ();
114 @def $zobel6     = ($zobel6 2001:6f8:1215::/48); # baldur
115 @def $zobel6     = ($zobel6 2001:6f8:928::/48); # WS2
116 @def $zobel6     = ($zobel6 2a01:198:549::/48); # WGS20
117 @def $zobel6     = ($zobel6 2a01:198:6b2::/48); # AdS20
118 @def $zobel6     = ($zobel6 2a02:158::/32);     # DG-i AS
119 @def $zobel6     = ($zobel6 2003:5b:203b::/48); # credativ DTAG v6
120 @def $zobel6     = ($zobel6 2a01:4f8:10a:1504::/64); # buri, dag, ....
121 @def $luca6      = ();
122 @def $luca6      = ($luca6 2604:9a00:2010:a041:4:ffff:a2d2:c016); # jump snafu.emyr.net
123 @def $tfheen6    = ();
124 @def $tfheen6    = ($tfheen6 2a02:20c8:2640::/64); # vuizook
125 @def $tfheen6    = ($tfheen6 2a01:798::/29); # Altibox
126 @def $jcristau6  = ();
127 @def $jcristau6  = ($jcristau6 2a01:e35:2ff2:f730::/61); # home
128 @def $jcristau6  = ($jcristau6 2001:bc8:3f1d::/48); # topinambour
129 @def $master6    = (2001:41b8:202:deb:216:36ff:fe40:4001); # master.debian.org
130 @def $DSA_V6_IPS = ($weasel6 $zobel6 $luca6 $tfheen6 $jcristau6 $master6);
131
132 @def $USER_joerg   = ();
133 @def $USER_joerg   = ($USER_joerg 213.146.108.160/29);
134 @def $USER_joerg   = ($USER_joerg 46.4.205.32);
135 @def $USER_joerg6  = ();
136 @def $USER_joerg6  = ($USER_joerg6 2a02:248:1005::/48);
137 @def $USER_joerg6  = ($USER_joerg6 2a01:4f8:131:1520::6667);
138
139 @def $BUILDD_SSH_ACCESS = ();
140 @def $BUILDD_SSH_ACCESS = ($BUILDD_SSH_ACCESS 209.87.16.60); # wuiet
141 @def $BUILDD_SSH_ACCESS = ($BUILDD_SSH_ACCESS 97.107.116.29); # master
142 @def $BUILDD_SSH_ACCESS = ($BUILDD_SSH_ACCESS 82.195.75.110); # new-master