Browse Source

Update xmpp role for LE certificate

Mike Ashley 9 years ago
parent
commit
65729d12f8
3 changed files with 18 additions and 7 deletions
  1. 4
    2
      roles/common/DESIGN.md
  2. 12
    3
      roles/xmpp/tasks/prosody.yml
  3. 2
    2
      roles/xmpp/templates/prosody.cfg.lua.j2

+ 4
- 2
roles/common/DESIGN.md View File

@@ -8,11 +8,13 @@ The Let's Encrypt service uses DNS to look up domains being registered and then
8 8
 
9 9
 A single certificate is created using Let's Encrypt with SANs used for the subdomains. The user must configure the list of subdomains to register in `vars/user.yml` unless they are installing all services, i.e., the default list of subdomains is everything.
10 10
 
11
-Certificate renewal is done automatically using cron.
11
+The role is designed to fail if a certificate cannot be generated for all subdomains listed.  This catches DNS configuration errors where a subdomain should have a record but does not.  Errors in the other direction (not all subdomains are listed in the SANs) can be addressed after detection by fixing the configuration and rerunning the role.
12
+
13
+Several packages need access to the private key. Not all are run as root. Examples include Prosody (XMPP) and ZNC (IRC bouncer). The approach in these cases is to copy the certificates and manage ownership and mode for them separately. This is to avoid stomping on directory ownership and modes in /etc/letsencrypt.
12 14
 
13 15
 Certificates and private keys are backed up using tarsnap.
14 16
 
15
-The role is designed to fail if a certificate cannot be generated for all subdomains listed.  This catches DNS configuration errors where a subdomain should have a record but does not.  Errors in the other direction (not all subdomains are listed in the SANs) can be addressed after detection by fixing the configuration and rerunning the role.
17
+Certificate renewal is done automatically using cron. The cron script must be aware of private key copies and update them as well. Services that depend on new keys must also be bounced. It is up to roles that rely on keys to modify the cron script (preferably using `linein` or similar games) to accomplish this.
16 18
 
17 19
 ### Alternative approaches
18 20
 

+ 12
- 3
roles/xmpp/tasks/prosody.yml View File

@@ -16,9 +16,6 @@
16 16
   tags:
17 17
     - dependencies
18 18
 
19
-- name: Add prosody user to ssl-cert group
20
-  user: name=prosody groups=ssl-cert append=yes
21
-
22 19
 - name: Create Prosody data directory
23 20
   file: state=directory path=/decrypted/prosody owner=prosody group=prosody
24 21
 
@@ -26,6 +23,18 @@
26 23
   template: src=prosody.cfg.lua.j2 dest=/etc/prosody/prosody.cfg.lua group=root owner=root
27 24
   notify: restart prosody
28 25
 
26
+- name: Copy SSL private key and cert
27
+  shell: cp /etc/letsencrypt/live/{{ domain }}/{{ item }} /etc/prosody/certs
28
+  with_items:
29
+    - privkey.pem
30
+    - cert.pem
31
+
32
+- name: Assert mode and ownership on SSL private key and cert
33
+  file: dest=/etc/prosody/certs/{{ item }} owner=root group=prosody mode=0640
34
+  with_items:
35
+    - privkey.pem
36
+    - cert.pem
37
+
29 38
 - name: Create Prosody accounts
30 39
   command: prosodyctl register {{ item.name }} {{ prosody_virtual_domain }} "{{ item.password }}"
31 40
   with_items: prosody_accounts

+ 2
- 2
roles/xmpp/templates/prosody.cfg.lua.j2 View File

@@ -86,8 +86,8 @@ allow_registration = false;
86 86
 -- These are the SSL/TLS-related settings. If you don't want
87 87
 -- to use SSL/TLS, you may comment or remove this
88 88
 ssl = {
89
-	key = "/etc/ssl/private/wildcard_private.key";
90
-	certificate = "/etc/ssl/certs/wildcard_public_cert.crt";
89
+	key = "/etc/prosody/certs/privkey.pem";
90
+	certificate = "/etc/prosody/certs/cert.pem";
91 91
 }
92 92
 
93 93
 -- Force clients to use encrypted connections? This option will

Loading…
Cancel
Save