0f911e42a1db545c7adbd0afbaa39e2413e8e16a
[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':
28                 ensure  => directory,
29         }
30         file { '/srv/ftp.root/.nobackup':
31                 ensure  => present,
32                 content => '',
33         }
34         file { '/srv/ftp.root/debian-security':
35                 ensure => directory,
36                 owner  => 1176, # archvsync
37                 group  => 1176, # archvsync
38                 mode   => '0755',
39         }
40
41         include apache2::expires
42         include apache2::rewrite
43
44         apache2::site { '010-security.debian.org':
45                 site   => 'security.debian.org',
46                 content => template('roles/security_mirror/security.debian.org.erb')
47         }
48
49         if has_role('security_mirror_no_ftp') {
50                 vsftpd::site { [ 'security', 'security6' ]:
51                         ensure => absent,
52                 }
53         } else {
54                 include ferm::ftp_conntrack
55                 vsftpd::site { 'security':
56                         banner       => 'security.debian.org FTP server (vsftpd)',
57                         logfile      => '/var/log/ftp/vsftpd-security.debian.org.log',
58                         max_clients  => 200,
59                         root         => '/srv/ftp.root/',
60                         bind         => $ftp_bind,
61                 }
62                 if ($ftp_bind6 != '') {
63                         vsftpd::site { 'security6':
64                                 banner       => 'security.debian.org FTP server (vsftpd)',
65                                 logfile      => '/var/log/ftp/vsftpd-security6.debian.org.log',
66                                 max_clients  => 200,
67                                 root         => '/srv/ftp.root/',
68                                 bind         => $ftp_bind6,
69                         }
70                 }
71         }
72
73         rsync::site { 'security':
74                 source      => 'puppet:///modules/roles/security_mirror/rsyncd.conf',
75                 max_clients => 100,
76                 bind        => $rsync_bind,
77                 bind6       => $rsync_bind6,
78         }
79
80         $onion_v4_addr = $::hostname ? {
81                 mirror-anu => '150.203.164.61',
82                 mirror-isc => '149.20.4.14',
83                 mirror-umn => '128.101.240.215',
84                 villa      => '212.211.132.32',
85                 lobos      => '212.211.132.250',
86                 default   => undef,
87         }
88         if has_role('security_mirror_onion') {
89                 if ! $onion_v4_addr {
90                         fail("Do not have an onion_v4_addr set for $::hostname.")
91                 }
92
93                 onion::service { 'security.debian.org':
94                         port => 80,
95                         target_port => 80,
96                         target_address => $onion_v4_addr,
97                 }
98         }
99 }