a2d5aeef3d4e48c5ef18675c72eaed71f6b9a1dd
[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         file { '/srv/mirrors/debian-security':
26                 ensure => link,
27                 target => '../ftp.root/debian-security',
28         }
29
30         include apache2::expires
31         include apache2::rewrite
32
33         apache2::site { '010-security.debian.org':
34                 site   => 'security.debian.org',
35                 content => template('roles/security_mirror/security.debian.org.erb')
36         }
37
38         include ferm::ftp_conntrack
39         vsftpd::site { 'security':
40                 banner       => 'security.debian.org FTP server (vsftpd)',
41                 logfile      => '/var/log/ftp/vsftpd-security.debian.org.log',
42                 max_clients  => 200,
43                 root         => '/srv/ftp.root/',
44                 bind         => $ftp_bind,
45         }
46         if ($ftp_bind6) {
47                 vsftpd::site { 'security6':
48                         banner       => 'security.debian.org FTP server (vsftpd)',
49                         logfile      => '/var/log/ftp/vsftpd-security6.debian.org.log',
50                         max_clients  => 200,
51                         root         => '/srv/ftp.root/',
52                         bind         => $ftp_bind6,
53                 }
54         }
55
56         rsync::site { 'security':
57                 source      => 'puppet:///modules/roles/security_mirror/rsyncd.conf',
58                 max_clients => 100,
59                 bind        => $rsync_bind,
60                 bind6       => $rsync_bind6,
61         }
62
63         $onion_v4_addr = $::hostname ? {
64                 mirror-anu => '150.203.164.61',
65                 mirror-isc => '149.20.4.14',
66                 mirror-umn => '128.101.240.215',
67                 villa      => '212.211.132.32',
68                 lobos      => '212.211.132.250',
69                 default   => undef,
70         }
71         if has_role('security_mirror_onion') {
72                 if ! $onion_v4_addr {
73                         fail("Do not have an onion_v4_addr set for $::hostname.")
74                 }
75
76                 onion::service { 'security.debian.org':
77                         port => 80,
78                         target_port => 80,
79                         target_address => $onion_v4_addr,
80                 }
81         }
82 }