[inspircd] Enable multiple certificate support

main
_shirenn 2022-11-15 16:00:59 +01:00
parent a9d0769fe8
commit 79eebe3de5
5 changed files with 56 additions and 14 deletions

View File

@ -41,18 +41,30 @@ loc_inspircd:
name: Pierre-Elliott Bécue name: Pierre-Elliott Bécue
nick: PEB nick: PEB
email: root@crans.org email: root@crans.org
ssl:
- name: crans.org
- name: adm.crans.org
bind: bind:
- address: "{{ query('ldap', 'ip4', 'irc', 'srv') }}" - address: "{{ query('ldap', 'ip4', 'irc', 'srv') }}"
type: clients type: clients
clair: 6667 clair: 6667
ssl: 6697 ssl: 6697
certificate: crans.org
- address: "{{ query('ldap', 'ip6', 'irc', 'srv') }}" - address: "{{ query('ldap', 'ip6', 'irc', 'srv') }}"
type: clients type: clients
clair: 6667 clair: 6667
ssl: 6697 ssl: 6697
certificate: crans.org
- address: "{{ query('ldap', 'ip4', 'irc', 'adm') }}" - address: "{{ query('ldap', 'ip4', 'irc', 'adm') }}"
type: clients type: clients
clair: 6667 clair: 6667
ssl: 6697
certificate: adm.crans.org
- address: "{{ query('ldap', 'ip6', 'irc', 'adm') }}"
type: clients
clair: 6667
ssl: 6697
certificate: adm.crans.org
- address: 127.0.0.1 - address: 127.0.0.1
type: servers type: servers
clair: 6668 clair: 6668
@ -93,3 +105,30 @@ loc_anope:
options_seed: "{{ vault.anope.options_seed }}" options_seed: "{{ vault.anope.options_seed }}"
services_roots: "{{ vault.anope.services_roots }}" services_roots: "{{ vault.anope.services_roots }}"
services_host: "services.irc.crans.org" services_host: "services.irc.crans.org"
loc_certbot:
- mail: root@crans.org
certname: crans.org
domains: "*.crans.org"
- mail: root@crans.org
certname: adm.crans.org
domains: "*.adm.crans.org"
loc_service_certbot:
config:
"crans.org":
zone: _acme-challenge.crans.org
server: "{{ query('ldap', 'ip4', 'silice', 'adm') }}"
port: 53
key:
name: certbot_challenge.
secret: "{{ vault.bind.rfc2136_keys['certbot_challenge.'].secret }}"
algorithm: HMAC-SHA512
"adm.crans.org":
zone: _acme-challenge.adm.crans.org
server: "{{ query('ldap', 'ip4', 'silice', 'adm') }}"
port: 53
key:
name: certbot_adm_challenge.
secret: "{{ vault.bind.rfc2136_keys['certbot_adm_challenge.'].secret }}"
algorithm: HMAC-SHA512

View File

@ -15,8 +15,8 @@
- { dest: inspircd.motd, mode: "0644" } - { dest: inspircd.motd, mode: "0644" }
notify: Reload InspIRCd notify: Reload InspIRCd
- name: Deploy certificate refresh CRON - name: Deploy certificate deploy hook
template: template:
src: cron.monthly/irc-certs.j2 src: letsencrypt/renewal-hooks/deploy/inspircd.j2
dest: /etc/cron.monthly/irc-certs dest: /etc/letsencrypt/renewal-hooks/deploy/inspircd
mode: 0755 mode: 0755

View File

@ -1,7 +0,0 @@
#!/bin/sh
{{ ansible_header | comment }}
cp /etc/letsencrypt/live/crans.org/fullchain.pem /etc/inspircd/fullchain.pem
cp /etc/letsencrypt/live/crans.org/privkey.pem /etc/inspircd/privkey.pem
chown irc:irc /etc/inspircd/fullchain.pem /etc/inspircd/privkey.pem
kill -USR1 $(cat /var/run/inspircd/inspircd.pid)

View File

@ -21,17 +21,19 @@
{% for bind in inspircd.bind %} {% for bind in inspircd.bind %}
<bind address="{{ bind.address }}" port="{{ bind.clair }}" type="{{ bind.type }}"> <bind address="{{ bind.address }}" port="{{ bind.clair }}" type="{{ bind.type }}">
{% if bind.ssl is defined %} {% if bind.ssl is defined %}
<bind address="{{ bind.address }}" port="{{ bind.ssl }}" type="{{ bind.type }}" ssl="openssl"> <bind address="{{ bind.address }}" port="{{ bind.ssl }}" type="{{ bind.type }}" ssl="{{ bind.certificate }}">
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% for ssl in inspircd.ssl %}
<sslprofile <sslprofile
name="openssl" name="{{ ssl.name }}"
provider="openssl" provider="openssl"
certfile="/etc/inspircd/fullchain.pem" certfile="/etc/inspircd/fullchain.{{ ssl.name }}.pem"
keyfile="/etc/inspircd/privkey.pem" keyfile="/etc/inspircd/privkey.{{ ssl.name }}.pem"
hash="sha1" hash="sha1"
> >
{% endfor %}
<include file="/etc/inspircd/power.conf"> <include file="/etc/inspircd/power.conf">

View File

@ -0,0 +1,8 @@
#!/bin/sh
{{ ansible_header | comment }}
CERTNAME=$(basename ${RENEWED_LINEAGE})
install -o root -g irc -m 0644 ${RENEWED_LINEAGE}/fullchain.pem /etc/inspircd/fullchain.${CERTNAME}.pem
install -o root -g irc -m 0640 ${RENEWED_LINEAGE}/privkey.pem /etc/inspircd/privkey.${CERTNAME}.pem
kill -USR1 $(cat /var/run/inspircd/inspircd.pid)