more amazon networks to blacklist
[mirror/dsa-puppet.git] / modules / roles / manifests / security_mirror.pp
1 class roles::security_mirror {
2         include roles::archvsync_base
3
4         $binds = $::hostname ? {
5                 mirror-anu      => [ '150.203.164.61', '[2001:388:1034:2900::3d]' ],
6                 mirror-isc      => [ '149.20.4.14', '[2001:4f8:1:c::14]' ],
7                 mirror-umn      => [ '128.101.240.215', '[2607:ea00:101:3c0b::1deb:215]' ],
8                 schmelzer       => [ '217.196.149.233', '[2a02:16a8:dc41:100::233]' ],
9                 default         => [ '[::]' ],
10         }
11
12         include apache2::expires
13         include apache2::rewrite
14
15         apache2::site { '010-security.debian.org':
16                 site   => 'security.debian.org',
17                 content => template('roles/security_mirror/security.debian.org.erb')
18         }
19
20         $mirrors = hiera('roles.security_mirror', {})
21         $fastly_mirrors = $mirrors.filter |$h| { $h[1]['fastly-backend'] }
22         $hosts_to_check = $fastly_mirrors.map |$h| { $h[1]['service-hostname'] }
23
24         roles::mirror_health { 'security':
25                 check_hosts   => $hosts_to_check,
26                 check_service => 'security',
27                 url           => 'http://security.backend.mirrors.debian.org/debian-security/dists/stable/updates/Release',
28                 health_url    => 'http://security.backend.mirrors.debian.org/_health',
29         }
30
31         rsync::site { 'security':
32                 source      => 'puppet:///modules/roles/security_mirror/rsyncd.conf',
33                 max_clients => 100,
34                 binds       => $binds,
35         }
36
37         $onion_v4_addr = hiera("roles.security_mirror", {})
38                 .dig($::fqdn, 'onion_v4_address')
39         if $onion_v4_addr {
40                 onion::service { 'security.debian.org':
41                         port => 80,
42                         target_port => 80,
43                         target_address => $onion_v4_addr,
44                 }
45         }
46 }