1d2f731f21f339b00f9eb34576356dd3e0e9c9f5
[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-conova => '217.196.149.233',
7                 mirror-isc => '149.20.4.14',
8                 mirror-umn => '128.101.240.215',
9                 default    => '',
10         }
11         $rsync_bind6 = $::hostname ? {
12                 mirror-anu => '2001:388:1034:2900::3d',
13                 mirror-conova => '2a02:16a8:dc41:100::233',
14                 mirror-isc => '2001:4f8:1:c::14',
15                 mirror-umn => '2607:ea00:101:3c0b::1deb:215',
16                 default    => '',
17         }
18         $ftp_bind = $::hostname ? {
19                 mirror-anu => '150.203.164.61',
20                 default => '',
21         }
22         $ftp_bind6 = $::hostname ? {
23                 mirror-anu => '2001:388:1034:2900::3d',
24                 default => undef,
25         }
26
27         file { '/srv/mirrors/debian-security':
28                 ensure => link,
29                 target => '../ftp.root/debian-security',
30         }
31         file { '/srv/ftp.root/.nobackup':
32                 ensure  => present,
33                 content => '',
34         }
35
36         include apache2::expires
37         include apache2::rewrite
38
39         apache2::site { '010-security.debian.org':
40                 site   => 'security.debian.org',
41                 content => template('roles/security_mirror/security.debian.org.erb')
42         }
43
44         include ferm::ftp_conntrack
45         vsftpd::site { '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                 bind         => $ftp_bind,
51         }
52         if ($ftp_bind6) {
53                 vsftpd::site { 'security6':
54                         banner       => 'security.debian.org FTP server (vsftpd)',
55                         logfile      => '/var/log/ftp/vsftpd-security6.debian.org.log',
56                         max_clients  => 200,
57                         root         => '/srv/ftp.root/',
58                         bind         => $ftp_bind6,
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 }