1cda924c6d3c65b8cf1f29bb97c34d0300fc0aa1
[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          # nop
42         } else {
43                 include ferm::ftp_conntrack
44                 vsftpd::site { 'security':
45                         banner       => 'security.debian.org FTP server (vsftpd)',
46                         logfile      => '/var/log/ftp/vsftpd-security.debian.org.log',
47                         max_clients  => 200,
48                         root         => '/srv/ftp.root/',
49                         bind         => $ftp_bind,
50                 }
51                 if ($ftp_bind6) {
52                         vsftpd::site { 'security6':
53                                 banner       => 'security.debian.org FTP server (vsftpd)',
54                                 logfile      => '/var/log/ftp/vsftpd-security6.debian.org.log',
55                                 max_clients  => 200,
56                                 root         => '/srv/ftp.root/',
57                                 bind         => $ftp_bind6,
58                         }
59                 }
60         }
61
62         rsync::site { 'security':
63                 source      => 'puppet:///modules/roles/security_mirror/rsyncd.conf',
64                 max_clients => 100,
65                 bind        => $rsync_bind,
66                 bind6       => $rsync_bind6,
67         }
68
69         $onion_v4_addr = $::hostname ? {
70                 mirror-anu => '150.203.164.61',
71                 mirror-isc => '149.20.4.14',
72                 mirror-umn => '128.101.240.215',
73                 villa      => '212.211.132.32',
74                 lobos      => '212.211.132.250',
75                 default   => undef,
76         }
77         if has_role('security_mirror_onion') {
78                 if ! $onion_v4_addr {
79                         fail("Do not have an onion_v4_addr set for $::hostname.")
80                 }
81
82                 onion::service { 'security.debian.org':
83                         port => 80,
84                         target_port => 80,
85                         target_address => $onion_v4_addr,
86                 }
87         }
88 }