92cd6263e6c040a378d56ba292241a7e8fde8988
[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-bytemark => [ '5.153.231.46', '[2001:41c8:1000:21::21:46]' ],
7                 mirror-conova   => [ '217.196.149.233', '[2a02:16a8:dc41:100::233]' ],
8                 mirror-isc      => [ '149.20.4.14', '[2001:4f8:1:c::14]' ],
9                 mirror-umn      => [ '128.101.240.215', '[2607:ea00:101:3c0b::1deb:215]' ],
10                 default         => [ '[::]' ],
11         }
12
13         file { '/srv/mirrors/debian-security':
14                 ensure => link,
15                 target => '../ftp.root/debian-security',
16         }
17         file { '/srv/ftp.root':
18                 ensure  => directory,
19         }
20         file { '/srv/ftp.root/.nobackup':
21                 ensure  => present,
22                 content => '',
23         }
24         file { '/srv/ftp.root/debian-security':
25                 ensure => directory,
26                 owner  => 1176, # archvsync
27                 group  => 1176, # archvsync
28                 mode   => '0755',
29         }
30
31         include apache2::expires
32         include apache2::rewrite
33
34         apache2::site { '010-security.debian.org':
35                 site   => 'security.debian.org',
36                 content => template('roles/security_mirror/security.debian.org.erb')
37         }
38
39         if has_role('security_mirror_no_ftp') {
40                 vsftpd::site_systemd { 'security':
41                         ensure => absent,
42                         root   => '/nonexistent',
43                 }
44         } else {
45                 vsftpd::site_systemd { 'security':
46                         banner       => 'security.debian.org FTP server (vsftpd)',
47                         logfile      => '/var/log/ftp/vsftpd-security.debian.org.log',
48                         max_clients  => 200,
49                         root         => '/srv/ftp.root/',
50                         binds        => $binds,
51                 }
52         }
53
54         rsync::site_systemd { 'security':
55                 source      => 'puppet:///modules/roles/security_mirror/rsyncd.conf',
56                 max_clients => 100,
57                 binds       => $binds,
58         }
59
60         $onion_v4_addr = $::hostname ? {
61                 mirror-anu => '150.203.164.61',
62                 mirror-isc => '149.20.4.14',
63                 mirror-umn => '128.101.240.215',
64                 villa      => '212.211.132.32',
65                 lobos      => '212.211.132.250',
66                 default   => undef,
67         }
68         if has_role('security_mirror_onion') {
69                 if ! $onion_v4_addr {
70                         fail("Do not have an onion_v4_addr set for $::hostname.")
71                 }
72
73                 onion::service { 'security.debian.org':
74                         port => 80,
75                         target_port => 80,
76                         target_address => $onion_v4_addr,
77                 }
78         }
79 }