Setup /srv/mirrors on all (archvsync-based) mirrors
[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-isc => '149.20.4.14',
7                 mirror-umn => '128.101.240.215',
8                 default    => '',
9         }
10         $rsync_bind6 = $::hostname ? {
11                 mirror-anu => '2001:388:1034:2900::3d',
12                 mirror-isc => '2001:4f8:1:c::14',
13                 mirror-umn => '2607:ea00:101:3c0b::1deb:215',
14                 default    => '',
15         }
16         $ftp_bind = $::hostname ? {
17                 mirror-anu => '150.203.164.61',
18                 default => '',
19         }
20         $ftp_bind6 = $::hostname ? {
21                 mirror-anu => '2001:388:1034:2900::3d',
22                 default => undef,
23         }
24
25         include apache2::expires
26         include apache2::rewrite
27
28         apache2::site { '010-security.debian.org':
29                 site   => 'security.debian.org',
30                 content => template('roles/security_mirror/security.debian.org.erb')
31         }
32
33         include ferm::ftp_conntrack
34         vsftpd::site { 'security':
35                 banner       => 'security.debian.org FTP server (vsftpd)',
36                 logfile      => '/var/log/ftp/vsftpd-security.debian.org.log',
37                 max_clients  => 200,
38                 root         => '/srv/ftp.root/',
39                 bind         => $ftp_bind,
40         }
41         if ($ftp_bind6) {
42                 vsftpd::site { 'security6':
43                         banner       => 'security.debian.org FTP server (vsftpd)',
44                         logfile      => '/var/log/ftp/vsftpd-security6.debian.org.log',
45                         max_clients  => 200,
46                         root         => '/srv/ftp.root/',
47                         bind         => $ftp_bind6,
48                 }
49         }
50
51         rsync::site { 'security':
52                 source      => 'puppet:///modules/roles/security_mirror/rsyncd.conf',
53                 max_clients => 100,
54                 bind        => $rsync_bind,
55                 bind6       => $rsync_bind6,
56         }
57
58         $onion_v4_addr = $::hostname ? {
59                 mirror-anu => '150.203.164.61',
60                 mirror-isc => '149.20.4.14',
61                 mirror-umn => '128.101.240.215',
62                 villa      => '212.211.132.32',
63                 lobos      => '212.211.132.250',
64                 default   => undef,
65         }
66         if has_role('security_mirror_onion') {
67                 if ! $onion_v4_addr {
68                         fail("Do not have an onion_v4_addr set for $::hostname.")
69                 }
70
71                 onion::service { 'security.debian.org':
72                         port => 80,
73                         target_port => 80,
74                         target_address => $onion_v4_addr,
75                 }
76         }
77 }