1 class roles::snapshot_web {
3 include apache2::rewrite
6 # 61.69.254.110 - 20180705, mirroring with wget
7 # 20180821 large amount of requests way too fast from some amazon AWS instances
26 @ferm::rule { 'dsa-snapshot-abusers':
28 rule => "saddr (61.69.254.110 18.128.0.0/9 3.120.0.0/14 35.156.0.0/14 52.58.0.0/15 99.137.191.34 51.15.215.91) DROP",
32 "libapache2-mod-wsgi",
34 ensure => 'installed',
37 apache2::site { '020-snapshot.debian.org':
38 site => 'snapshot.debian.org',
39 content => template('roles/snapshot/snapshot.debian.org.conf.erb')
44 $ipv4addr = '185.17.185.185'
45 $ipv6addr = '2001:1af8:4020:b030:deb::185'
46 $ipv6addr_apache = '2001:1af8:4020:b030:deb::187'
49 $ipv4addr = '193.62.202.27'
50 $ipv6addr = '2001:630:206:4000:1a1a:0:c13e:ca1b'
51 $ipv6addr_apache = '2001:630:206:4000:1a1a:0:c13e:ca1a'
54 fail ( "unknown host $::hostname for snapshot_web." )
58 @ferm::rule { 'dsa-snapshot-connlimit':
61 rule => "proto tcp mod state state (NEW) daddr (${ipv4addr} ${ipv6addr}) mod multiport destination-ports (80 443 6081) mod connlimit connlimit-above 3 DROP",
66 @ferm::rule { 'dsa-nat-snapshot-varnish-v4':
68 chain => 'PREROUTING',
69 rule => "proto tcp daddr ${ipv4addr} dport 80 REDIRECT to-ports 6081",
72 varnish::config { 'default':
77 backend => 'file,/var/lib/varnish/varnish_storage.bin,8G',
78 content => template('roles/snapshot/snapshot.debian.org.vcl.erb'),
81 # the ipv6 port 80 is owned by varnish
82 file { '/etc/apache2/ports.conf':
85 Listen [$ipv6addr_apache]:80
87 require => Package['apache2'],
88 notify => Service['apache2'],
91 # haproxy ssl termination
92 #########################
94 file { '/etc/haproxy/haproxy.cfg':
95 content => template('roles/snapshot/haproxy.cfg.erb'),
96 require => Package['haproxy'],
97 notify => Service['haproxy'],
99 ssl::service { 'snapshot.debian.org':
100 notify => Service['haproxy'],