Merge ~pelpsi/launchpad:ftpmaster-publisher-configuration into launchpad:master

Proposed by Simone Pelosi
Status: Merged
Approved by: Simone Pelosi
Approved revision: 1fd3c89c123e6d9f25119bf25c7f23130217389c
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~pelpsi/launchpad:ftpmaster-publisher-configuration
Merge into: launchpad:master
Diff against target: 131 lines (+84/-2)
4 files modified
charm/launchpad-ftpmaster-publisher/config.yaml (+22/-2)
charm/launchpad-ftpmaster-publisher/reactive/launchpad-ftpmaster-publisher.py (+28/-0)
charm/launchpad-ftpmaster-publisher/templates/020-launchpad-ftpmaster-publisher.conf.j2 (+32/-0)
charm/launchpad-ftpmaster-publisher/templates/ftp.secrets.j2 (+2/-0)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+453838@code.launchpad.net

Commit message

Added rsync configuration to ftpmaster publisher

According to the legacy deployment of the publisher
we added a configuration file to configure correctly rsync

To post a comment you must log in.
Revision history for this message
Simone Pelosi (pelpsi) :
Revision history for this message
Colin Watson (cjwatson) :
review: Needs Fixing
Revision history for this message
Colin Watson (cjwatson) wrote :

Before the next attempt at switching over, we'll need to get IS to do a dry-run of the rsync behaviour from their "syncproxy" machines to make sure it all works. But this looks plausible.

review: Approve
Revision history for this message
Colin Watson (cjwatson) :
review: Approve
Revision history for this message
Simone Pelosi (pelpsi) wrote :

Squashed commits into one

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/charm/launchpad-ftpmaster-publisher/config.yaml b/charm/launchpad-ftpmaster-publisher/config.yaml
2index d871574..8548557 100644
3--- a/charm/launchpad-ftpmaster-publisher/config.yaml
4+++ b/charm/launchpad-ftpmaster-publisher/config.yaml
5@@ -7,14 +7,18 @@ options:
6 type: string
7 description: Domain name for the published Ubuntu archive.
8 default: "archive.ubuntu.test"
9- signing_client_public_key:
10+ rsync_secrets:
11 type: string
12- description: Public key for encrypting communication between client and signing service.
13+ description: Secrets for rsync
14 default: ""
15 signing_client_private_key:
16 type: string
17 description: Private key for encrypting communication between client and signing service.
18 default: ""
19+ signing_client_public_key:
20+ type: string
21+ description: Public key for encrypting communication between client and signing service.
22+ default: ""
23 signing_endpoint:
24 type: string
25 description: Endpoint for the signing service.
26@@ -23,3 +27,19 @@ options:
27 type: string
28 description: Webmaster contact address.
29 default: "webmaster@launchpad.test"
30+ ubuntu_auth_users:
31+ type: string
32+ description: Authenticated users for rsync ubuntu
33+ default: ""
34+ ubuntu_dists_hosts_allow:
35+ type: string
36+ description: IP addresses permitted to connect to ubuntu/dists.
37+ default: ""
38+ ubuntu_germinate_hosts_allow:
39+ type: string
40+ description: IP addresses permitted to connect to ubuntu-germinate.
41+ default: ""
42+ ubuntu_partner_auth_users:
43+ type: string
44+ description: Authenticated users for rsync ubuntu-partner
45+ default: ""
46\ No newline at end of file
47diff --git a/charm/launchpad-ftpmaster-publisher/reactive/launchpad-ftpmaster-publisher.py b/charm/launchpad-ftpmaster-publisher/reactive/launchpad-ftpmaster-publisher.py
48index 0342c89..1ccd609 100644
49--- a/charm/launchpad-ftpmaster-publisher/reactive/launchpad-ftpmaster-publisher.py
50+++ b/charm/launchpad-ftpmaster-publisher/reactive/launchpad-ftpmaster-publisher.py
51@@ -60,6 +60,34 @@ def configure():
52 configure_email(config, "launchpad-ftpmaster-publisher")
53 configure_logrotate(config)
54 configure_cron(config, "crontab.j2")
55+ if config["rsync_secrets"]:
56+ rsync_secrets_path = "/etc/rsyncd/ftp.secrets"
57+ templating.render(
58+ "ftp.secrets.j2",
59+ rsync_secrets_path,
60+ config,
61+ perms=0o644,
62+ )
63+ config["rsync_secrets_path"] = rsync_secrets_path
64+ elif os.path.exists("/etc/rsyncd/ftp.secrets"):
65+ os.unlink("/etc/rsyncd/ftp.secrets")
66+ if (
67+ config["ubuntu_auth_users"]
68+ and config["ubuntu_partner_auth_users"]
69+ and config["ubuntu_dists_hosts_allow"]
70+ and config["ubuntu_germinate_hosts_allow"]
71+ and config["rsync_secrets_path"]
72+ ):
73+ templating.render(
74+ "020-launchpad-ftpmaster-publisher.conf.j2",
75+ "/etc/rsync-juju.d/020-launchpad-ftpmaster-publisher.conf",
76+ config,
77+ perms=0o644,
78+ )
79+ elif os.path.exists(
80+ "/etc/rsync-juju.d/020-launchpad-ftpmaster-publisher.conf"
81+ ):
82+ os.unlink("/etc/rsync-juju.d/020-launchpad-ftpmaster-publisher.conf")
83 set_state("service.configured")
84
85
86diff --git a/charm/launchpad-ftpmaster-publisher/templates/020-launchpad-ftpmaster-publisher.conf.j2 b/charm/launchpad-ftpmaster-publisher/templates/020-launchpad-ftpmaster-publisher.conf.j2
87new file mode 100644
88index 0000000..a730bcb
89--- /dev/null
90+++ b/charm/launchpad-ftpmaster-publisher/templates/020-launchpad-ftpmaster-publisher.conf.j2
91@@ -0,0 +1,32 @@
92+max connections = 25
93+
94+[ftp]
95+ path = {{ archives_dir }}/ubuntu-archive/ubuntu
96+ comment = Ubuntu Archive
97+ list = false
98+ read only = true
99+ auth users = {{ ubuntu_auth_users }}
100+ secrets file = {{ rsync_secrets_path }}
101+
102+[partner]
103+ path = {{ archives_dir }}/ubuntu-archive/ubuntu-partner/
104+ comment = Partner
105+ list = false
106+ read only = true
107+ auth users = {{ ubuntu_partner_auth_users }}
108+ secrets file = {{ rsync_secrets_path }}
109+
110+[ubuntu-dists]
111+ path = {{ archives_dir }}/ubuntu-archive/ubuntu/dists
112+ comment = Ubuntu Archive Dists
113+ list = false
114+ read only = true
115+ hosts allow = {{ ubuntu_dists_hosts_allow }}
116+
117+[ubuntu-germinate]
118+ path = {{ archives_dir }}/ubuntu-archive/ubuntu-germinate
119+ comment = Ubuntu Archive Germinate output
120+ list = false
121+ read only = true
122+ hosts allow = {{ ubuntu_germinate_hosts_allow }}
123+
124diff --git a/charm/launchpad-ftpmaster-publisher/templates/ftp.secrets.j2 b/charm/launchpad-ftpmaster-publisher/templates/ftp.secrets.j2
125new file mode 100644
126index 0000000..1d38e7d
127--- /dev/null
128+++ b/charm/launchpad-ftpmaster-publisher/templates/ftp.secrets.j2
129@@ -0,0 +1,2 @@
130+{{ rsync_secrets }}
131+

Subscribers

People subscribed via source and target branches

to status/vote changes: