Merge ~cjwatson/launchpad:charm-ftpmaster-top-level-directory-index into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 2ba595c6c1321fd58aad48fed705a309c1794213
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:charm-ftpmaster-top-level-directory-index
Merge into: launchpad:master
Diff against target: 26 lines (+8/-3)
1 file modified
charm/launchpad-ftpmaster-publisher/templates/vhost.conf.j2 (+8/-3)
Reviewer Review Type Date Requested Status
Simone Pelosi Approve
Review via email: mp+454137@code.launchpad.net

Commit message

charm: Enable a top-level directory index on ftpmaster-publish

Description of the change

Although it doesn't strictly break anything if http://ftpmaster.internal/ returns 403 (as opposed to http://ftpmaster.internal/ubuntu/ etc.), it's a bit ugly and makes it look as though things are broken. Restructure the Apache configuration so that requests for a top-level directory index return 200 with a filtered index showing only the permitted subdirectories.

To post a comment you must log in.
Revision history for this message
Simone Pelosi (pelpsi) wrote :

thank you Colin for this fix, LGTM!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/charm/launchpad-ftpmaster-publisher/templates/vhost.conf.j2 b/charm/launchpad-ftpmaster-publisher/templates/vhost.conf.j2
2index 169ff83..b24e533 100644
3--- a/charm/launchpad-ftpmaster-publisher/templates/vhost.conf.j2
4+++ b/charm/launchpad-ftpmaster-publisher/templates/vhost.conf.j2
5@@ -6,14 +6,19 @@
6 CustomLog /var/log/apache2/{{ domain_ftpmaster }}-access.log combined
7 ErrorLog /var/log/apache2/{{ domain_ftpmaster }}-error.log
8
9-{% for distribution in ("ubuntu", "ubuntu-partner") %}
10- <Directory "{{ archives_dir }}/ubuntu-archive/{{ distribution }}/">
11+ <Directory "{{ archives_dir }}/ubuntu-archive/">
12 IndexOptions NameWidth=* +SuppressDescription
13 Options +Indexes +FollowSymLinks
14 IndexIgnore favicon.ico
15 AllowOverride None
16 Require all granted
17 </Directory>
18-{% endfor %}
19+
20+ # Deny access to subdirectories other than "ubuntu" and
21+ # "ubuntu-partner". (This also has the effect of including only those
22+ # subdirectories in the top-level directory index.)
23+ <DirectoryMatch "{{ archives_dir }}/ubuntu-archive/[^/]+(?<!/ubuntu|/ubuntu-partner)/">
24+ Require all denied
25+ </DirectoryMatch>
26 </VirtualHost>
27

Subscribers

People subscribed via source and target branches

to status/vote changes: