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 # 20181222, excessive number of requests
29 # running jugdo against snapshot
33 # 20190512 tens of thousands of queries
38 @ferm::rule { 'dsa-snapshot-abusers':
40 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 208.91.68.213 198.11.128.0/18 159.226.95.0/24 84.204.194.0/24 211.13.205.0/24 63.32.0.0/14 54.72.0.0/15 95.115.66.23 52.192.0.0/11) DROP",
44 "libapache2-mod-wsgi",
46 ensure => 'installed',
49 apache2::site { '020-snapshot.debian.org':
50 site => 'snapshot.debian.org',
51 content => template('roles/snapshot/snapshot.debian.org.conf.erb')
56 $ipv4addr = '185.17.185.185'
57 $ipv6addr = '2001:1af8:4020:b030:deb::185'
58 $ipv6addr_apache = '2001:1af8:4020:b030:deb::187'
61 $ipv4addr = '193.62.202.27'
62 $ipv6addr = '2001:630:206:4000:1a1a:0:c13e:ca1b'
63 $ipv6addr_apache = '2001:630:206:4000:1a1a:0:c13e:ca1a'
66 fail ( "unknown host $::hostname for snapshot_web." )
70 @ferm::rule { 'dsa-snapshot-connlimit':
73 rule => "proto tcp mod state state (NEW) interface ! lo daddr (${ipv4addr} ${ipv6addr}) mod multiport destination-ports (80 443) mod connlimit connlimit-above 3 DROP;
74 proto tcp mod state state (NEW) interface ! lo dport 6081 mod connlimit connlimit-above 3 DROP
80 @ferm::rule { 'dsa-nat-snapshot-varnish-v4':
82 chain => 'PREROUTING',
83 rule => "proto tcp daddr ${ipv4addr} dport 80 REDIRECT to-ports 6081",
86 varnish::config { 'default':
91 backend => 'file,/var/lib/varnish/varnish_storage.bin,8G',
92 content => template('roles/snapshot/snapshot.debian.org.vcl.erb'),
95 # the ipv6 port 80 is owned by varnish
96 file { '/etc/apache2/ports.conf':
99 Listen [$ipv6addr_apache]:80
101 require => Package['apache2'],
102 notify => Service['apache2'],
105 # haproxy ssl termination
106 #########################
108 file { '/etc/haproxy/haproxy.cfg':
109 content => template('roles/snapshot/haproxy.cfg.erb'),
110 require => Package['haproxy'],
111 notify => Service['haproxy'],
113 ssl::service { 'snapshot.debian.org':
114 notify => Service['haproxy'],