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