Merge "Add robots.txt to our list servers"

This commit is contained in:
Zuul 2024-04-23 17:25:21 +00:00 committed by Gerrit Code Review
commit 196817156d
4 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,7 @@
User-agent: *
Disallow: /accounts/*
Allow: /archives/*
Allow: /mailman3/lists/*
Crawl-delay: 2

View File

@ -141,6 +141,22 @@
shell:
cmd: docker image prune -f
- name: Create robots.txt location dir
file:
path: /var/www/robots
state: directory
owner: root
group: root
mode: '0755'
- name: Copy the robots.txt
copy:
src: robots.txt
dest: /var/www/robots/robots.txt
owner: root
group: root
mode: '0644'
- name: Install apache2
package:
name:

View File

@ -46,6 +46,7 @@
</Location>
RewriteEngine On
RewriteRule ^/robots.txt$ /var/www/robots/robots.txt [L]
RewriteRule "/pipermail/(.*)" "/var/lib/mailman/web-data/mm2archives/%{HTTP_HOST}/public/$1"
RewriteRule "/cgi-bin/mailman/listinfo/(.*)" "https://%{HTTP_HOST}/mailman3/lists/$1.%{HTTP_HOST}/"
RewriteRule "/cgi-bin/mailman/listinfo" "https://%{HTTP_HOST}/mailman3/lists/"
@ -66,4 +67,8 @@
Allow from all
Require all granted
</Directory>
<Directory "/var/www/robots">
Require all granted
</Directory>
</VirtualHost>

View File

@ -36,6 +36,13 @@ def test_apache2_listening(host):
apache2_https = host.socket("tcp://0.0.0.0:443")
assert apache2_https.is_listening
def test_robots(host):
cmd = host.run('curl --insecure '
'--resolve lists.opendev.org:443:127.0.0.1 '
'https://lists.opendev.org/robots.txt')
assert 'Disallow: /accounts/*' in cmd.stdout
assert 'Allow: /archives/*' in cmd.stdout
def test_mailman3_screenshots(host):
shots = (
("https://lists.opendev.org:443", None, "mm3-opendev-main.png"),