浏览代码

Update xmpp role for LE certificate

Mike Ashley 9 年前
父节点
当前提交
65729d12f8
共有 3 个文件被更改,包括 18 次插入7 次删除
  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 查看文件

8
 
8
 
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.
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
 Certificates and private keys are backed up using tarsnap.
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
 ### Alternative approaches
19
 ### Alternative approaches
18
 
20
 

+ 12
- 3
roles/xmpp/tasks/prosody.yml 查看文件

16
   tags:
16
   tags:
17
     - dependencies
17
     - dependencies
18
 
18
 
19
-- name: Add prosody user to ssl-cert group
20
-  user: name=prosody groups=ssl-cert append=yes
21
-
22
 - name: Create Prosody data directory
19
 - name: Create Prosody data directory
23
   file: state=directory path=/decrypted/prosody owner=prosody group=prosody
20
   file: state=directory path=/decrypted/prosody owner=prosody group=prosody
24
 
21
 
26
   template: src=prosody.cfg.lua.j2 dest=/etc/prosody/prosody.cfg.lua group=root owner=root
23
   template: src=prosody.cfg.lua.j2 dest=/etc/prosody/prosody.cfg.lua group=root owner=root
27
   notify: restart prosody
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
 - name: Create Prosody accounts
38
 - name: Create Prosody accounts
30
   command: prosodyctl register {{ item.name }} {{ prosody_virtual_domain }} "{{ item.password }}"
39
   command: prosodyctl register {{ item.name }} {{ prosody_virtual_domain }} "{{ item.password }}"
31
   with_items: prosody_accounts
40
   with_items: prosody_accounts

+ 2
- 2
roles/xmpp/templates/prosody.cfg.lua.j2 查看文件

86
 -- These are the SSL/TLS-related settings. If you don't want
86
 -- These are the SSL/TLS-related settings. If you don't want
87
 -- to use SSL/TLS, you may comment or remove this
87
 -- to use SSL/TLS, you may comment or remove this
88
 ssl = {
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
 -- Force clients to use encrypted connections? This option will
93
 -- Force clients to use encrypted connections? This option will

正在加载...
取消
保存