Add mailman Web redirects for the moved staff list

While the staff mailing list is hidden and private in production,
that configuration is set after creation, so in our deployment tests
we can absolutely verify that HTTP and HTTPS redirects for listinfo
and archives work anyway. This paves the way for any further
rewrites and associated testing we may need to do for other mailing
lists which move between domains, as well as testing redirects we
may set up as part of the v2 to v3 migration.

Change-Id: I68078554a72e3b59d8192ac4339e8654a8351f52
This commit is contained in:
Jeremy Stanley 2021-12-20 20:27:33 +00:00
parent 81f8cdfb7b
commit b84bdffc08
2 changed files with 43 additions and 0 deletions

View File

@ -14,6 +14,8 @@
RewriteEngine on RewriteEngine on
# TODO(fungi): convert this vhost into a blanket redirect to HTTPS when ready # TODO(fungi): convert this vhost into a blanket redirect to HTTPS when ready
RewriteRule ^/$ /cgi-bin/mailman/listinfo [R] RewriteRule ^/$ /cgi-bin/mailman/listinfo [R]
RewriteCond %{HTTP_HOST} ^lists\.openstack\.org$ [nocase]
RewriteRule /(cgi-bin/mailman/listinfo|pipermail)/(staff)(/.*|$) %{REQUEST_SCHEME}://lists.openinfra.dev/$1/$2$3 [last,redirect=permanent]
# We can find mailman here: # We can find mailman here:
ScriptAlias /cgi-bin/mailman/ /usr/lib/cgi-bin/mailman/ ScriptAlias /cgi-bin/mailman/ /usr/lib/cgi-bin/mailman/
@ -81,6 +83,8 @@ Alias /images/mailman/ /usr/share/images/mailman/
RewriteEngine on RewriteEngine on
RewriteRule ^/$ /cgi-bin/mailman/listinfo [R] RewriteRule ^/$ /cgi-bin/mailman/listinfo [R]
RewriteCond %{HTTP_HOST} ^lists\.openstack\.org$ [nocase]
RewriteRule /(cgi-bin/mailman/listinfo|pipermail)/(staff)(/.*|$) %{REQUEST_SCHEME}://lists.openinfra.dev/$1/$2$3 [last,redirect=permanent]
ScriptAlias /cgi-bin/mailman/ /usr/lib/cgi-bin/mailman/ ScriptAlias /cgi-bin/mailman/ /usr/lib/cgi-bin/mailman/
Alias /pipermail/ /srv/mailman/{{ mailman_site.name }}/archives/public/ Alias /pipermail/ /srv/mailman/{{ mailman_site.name }}/archives/public/

View File

@ -81,6 +81,45 @@ def test_mm_list_site(host):
'https://lists.zuul-ci.org/cgi-bin/mailman/listinfo') 'https://lists.zuul-ci.org/cgi-bin/mailman/listinfo')
assert '<TITLE>lists.zuul-ci.org Mailing Lists</TITLE>' in cmd.stdout assert '<TITLE>lists.zuul-ci.org Mailing Lists</TITLE>' in cmd.stdout
def test_mm_list_site_redirect_listinfo_http(host):
cmd = host.run('curl '
'--resolve lists.openstack.org:80:127.0.0.1 '
'http://lists.openstack.org/cgi-bin/mailman/listinfo/staff')
assert ('The document has moved <a href="'
'http://lists.openinfra.dev/cgi-bin/mailman/listinfo/staff'
'">here</a>') in cmd.stdout
cmd = host.run('curl --location '
'--resolve lists.openinfra.dev:80:127.0.0.1 '
'--resolve lists.openstack.org:80:127.0.0.1 '
'http://lists.openstack.org/cgi-bin/mailman/listinfo/staff')
assert '<TITLE>Staff Info Page</TITLE>' in cmd.stdout
def test_mm_list_site_redirect_archives_http(host):
cmd = host.run('curl '
'--resolve lists.openstack.org:80:127.0.0.1 '
'http://lists.openstack.org/pipermail/staff/')
assert ('The document has moved <a href="'
'http://lists.openinfra.dev/pipermail/staff/'
'">here</a>') in cmd.stdout
cmd = host.run('curl --location '
'--resolve lists.openinfra.dev:80:127.0.0.1 '
'--resolve lists.openstack.org:80:127.0.0.1 '
'http://lists.openstack.org/pipermail/staff/')
assert '<h1>The Staff Archives </h1>' in cmd.stdout
def test_mm_list_site_redirect_archives_https(host):
cmd = host.run('curl --insecure '
'--resolve lists.openstack.org:443:127.0.0.1 '
'https://lists.openstack.org/pipermail/staff/')
assert ('The document has moved <a href="'
'https://lists.openinfra.dev/pipermail/staff/'
'">here</a>') in cmd.stdout
cmd = host.run('curl --insecure --location '
'--resolve lists.openinfra.dev:443:127.0.0.1 '
'--resolve lists.openstack.org:443:127.0.0.1 '
'https://lists.openstack.org/pipermail/staff/')
assert '<h1>The Staff Archives </h1>' in cmd.stdout
def test_domain_aliases(host): def test_domain_aliases(host):
domain_aliases = host.file('/etc/aliases.domain') domain_aliases = host.file('/etc/aliases.domain')
assert domain_aliases.exists assert domain_aliases.exists