c6019a86877bc1e96c0c64b1160f851bf1aaef8a
[mirror/dsa-puppet.git] / modules / roles / manifests / security_mirror.pp
1 class roles::security_mirror {
2         include roles::archvsync_base
3
4         $rsync_bind = $::hostname ? {
5                 mirror-anu => '150.203.164.61',
6                 mirror-bytemark => '5.153.231.46',
7                 mirror-conova => '217.196.149.233',
8                 mirror-isc => '149.20.4.14',
9                 mirror-umn => '128.101.240.215',
10                 default    => '',
11         }
12         $rsync_bind6 = $::hostname ? {
13                 mirror-anu => '2001:388:1034:2900::3d',
14                 mirror-bytemark => '2001:41c8:1000:21::21:46',
15                 mirror-conova => '2a02:16a8:dc41:100::233',
16                 mirror-isc => '2001:4f8:1:c::14',
17                 mirror-umn => '2607:ea00:101:3c0b::1deb:215',
18                 default    => '',
19         }
20         $ftp_bind = $rsync_bind
21         $ftp_bind6 = $rsync_bind6
22
23         file { '/srv/mirrors/debian-security':
24                 ensure => link,
25                 target => '../ftp.root/debian-security',
26         }
27         file { '/srv/ftp.root/.nobackup':
28                 ensure  => present,
29                 content => '',
30         }
31
32         include apache2::expires
33         include apache2::rewrite
34
35         apache2::site { '010-security.debian.org':
36                 site   => 'security.debian.org',
37                 content => template('roles/security_mirror/security.debian.org.erb')
38         }
39
40         if has_role('security_mirror_no_ftp') {
41                 vsftpd::site { [ 'security', 'security6' ]:
42                         ensure => absent,
43                 }
44         } else {
45                 include ferm::ftp_conntrack
46                 vsftpd::site { 'security':
47                         banner       => 'security.debian.org FTP server (vsftpd)',
48                         logfile      => '/var/log/ftp/vsftpd-security.debian.org.log',
49                         max_clients  => 200,
50                         root         => '/srv/ftp.root/',
51                         bind         => $ftp_bind,
52                 }
53                 if ($ftp_bind6 != '') {
54                         vsftpd::site { 'security6':
55                                 banner       => 'security.debian.org FTP server (vsftpd)',
56                                 logfile      => '/var/log/ftp/vsftpd-security6.debian.org.log',
57                                 max_clients  => 200,
58                                 root         => '/srv/ftp.root/',
59                                 bind         => $ftp_bind6,
60                         }
61                 }
62         }
63
64         rsync::site { 'security':
65                 source      => 'puppet:///modules/roles/security_mirror/rsyncd.conf',
66                 max_clients => 100,
67                 bind        => $rsync_bind,
68                 bind6       => $rsync_bind6,
69         }
70
71         $onion_v4_addr = $::hostname ? {
72                 mirror-anu => '150.203.164.61',
73                 mirror-isc => '149.20.4.14',
74                 mirror-umn => '128.101.240.215',
75                 villa      => '212.211.132.32',
76                 lobos      => '212.211.132.250',
77                 default   => undef,
78         }
79         if has_role('security_mirror_onion') {
80                 if ! $onion_v4_addr {
81                         fail("Do not have an onion_v4_addr set for $::hostname.")
82                 }
83
84                 onion::service { 'security.debian.org':
85                         port => 80,
86                         target_port => 80,
87                         target_address => $onion_v4_addr,
88                 }
89         }
90 }