Correction for DNSDist(DoH DoT) service
This commit is contained in:
parent
9bf5f2dab4
commit
105ee89080
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
- hosts: test
|
- hosts: iloth
|
||||||
roles:
|
roles:
|
||||||
- common
|
- common
|
||||||
- ssl-cert
|
- ssl-cert
|
||||||
@ -8,9 +8,10 @@
|
|||||||
- dnsdist
|
- dnsdist
|
||||||
# déclaration de la variables globales
|
# déclaration de la variables globales
|
||||||
vars:
|
vars:
|
||||||
email: votre_email
|
email: votre_adresse_email
|
||||||
cthostname: nom_du_conteneur
|
cthostname: machine-name
|
||||||
domain: nom_de_domaine
|
domain: machine-name.domain.tld
|
||||||
create_user: false
|
create_user: False
|
||||||
installCertbot: false
|
installCertbot: True
|
||||||
|
mode: standalone # nginx or standalone
|
||||||
|
alt_domains: "" # -d sub.domain.told
|
||||||
|
@ -38,20 +38,20 @@
|
|||||||
path: /etc/dnsdist/dnsdist.conf
|
path: /etc/dnsdist/dnsdist.conf
|
||||||
regexp: '__SSL_CRT__'
|
regexp: '__SSL_CRT__'
|
||||||
replace: '/etc/ssl/{{ domain}}.crt'
|
replace: '/etc/ssl/{{ domain}}.crt'
|
||||||
when: installCertbot == false
|
when: installCertbot == False
|
||||||
|
|
||||||
- name: Add SSL keys to dnsdist.conf
|
- name: Add SSL keys to dnsdist.conf
|
||||||
ansible.builtin.replace:
|
ansible.builtin.replace:
|
||||||
path: /etc/dnsdist/dnsdist.conf
|
path: /etc/dnsdist/dnsdist.conf
|
||||||
regexp: '__SSL_KEY__'
|
regexp: '__SSL_KEY__'
|
||||||
replace: '/etc/ssl/{{ domain}}.key'
|
replace: '/etc/ssl/{{ domain}}.key'
|
||||||
when: installCertbot == false
|
when: installCertbot == False
|
||||||
|
|
||||||
- name: permission to ssl cert
|
- name: permission to ssl cert
|
||||||
shell: |
|
shell: |
|
||||||
setfacl -R -m u:_dnsdist:rx /etc/ssl/"{{ domain }}".key
|
setfacl -R -m u:_dnsdist:rx /etc/ssl/"{{ domain }}".key
|
||||||
setfacl -R -m u:_dnsdist:rx /etc/ssl/"{{ domain }}".crt
|
setfacl -R -m u:_dnsdist:rx /etc/ssl/"{{ domain }}".crt
|
||||||
when: installCertbot == false
|
when: installCertbot == False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -59,23 +59,30 @@
|
|||||||
ansible.builtin.replace:
|
ansible.builtin.replace:
|
||||||
path: /etc/dnsdist/dnsdist.conf
|
path: /etc/dnsdist/dnsdist.conf
|
||||||
regexp: '__SSL_CRT__'
|
regexp: '__SSL_CRT__'
|
||||||
replace: '/etc/letsencrypt/{{ domain}}/fullchain.pem'
|
replace: '/etc/letsencrypt/live/{{ domain}}/fullchain.pem'
|
||||||
when: installCertbot == true
|
when: installCertbot == True
|
||||||
|
|
||||||
- name: Add SSL keys to dnsdist.conf
|
- name: Add SSL keys to dnsdist.conf
|
||||||
ansible.builtin.replace:
|
ansible.builtin.replace:
|
||||||
path: /etc/dnsdist/dnsdist.conf
|
path: /etc/dnsdist/dnsdist.conf
|
||||||
regexp: '__SSL_KEY__'
|
regexp: '__SSL_KEY__'
|
||||||
replace: '/etc/letsencrypt/{{ domain}}/privkey.pem'
|
replace: '/etc/letsencrypt/live/{{ domain}}/privkey.pem'
|
||||||
when: installCertbot == true
|
when: installCertbot == True
|
||||||
|
|
||||||
- name: Set permission letsencrypt SSL keys
|
- name: Set permission letsencrypt SSL keys
|
||||||
shell: setfacl -R -m u:_dnsdist:rx /etc/letsencrypt/
|
shell: setfacl -R -m u:_dnsdist:rx /etc/letsencrypt/
|
||||||
when: installCertbot == true
|
when: installCertbot == True
|
||||||
|
|
||||||
|
|
||||||
|
- name: Disable and stop systemd-resolved
|
||||||
|
shell: |
|
||||||
|
systemctl disable systemd-resolved
|
||||||
|
systemctl stop systemd-resolved || echo "systemd-resolved is already stopped"
|
||||||
|
|
||||||
- name: Start dnsdist service
|
- name: Start dnsdist service
|
||||||
shell: "systemctl start dnsdist"
|
shell: "systemctl start dnsdist"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- name: Enable systemd service
|
- name: Enable systemd service
|
||||||
shell: "systemctl enable dnsdist"
|
shell: "systemctl enable dnsdist"
|
@ -20,6 +20,13 @@
|
|||||||
shell: openssl req -x509 -nodes -subj '/CN={{ domain }}' -days 3650 -newkey rsa:4096 -sha256 -keyout /etc/ssl/"{{ domain }}".key -out /etc/ssl/"{{ domain }}".crt
|
shell: openssl req -x509 -nodes -subj '/CN={{ domain }}' -days 3650 -newkey rsa:4096 -sha256 -keyout /etc/ssl/"{{ domain }}".key -out /etc/ssl/"{{ domain }}".crt
|
||||||
when: installCertbot == False
|
when: installCertbot == False
|
||||||
|
|
||||||
- name: Create self-signed certificate, if configured.
|
- name: Open port 80 for letsencrypt challenge
|
||||||
shell: "certbot -certonly -d {{ domain }} {{ alt_domains }} --{{ mode }} -m {{ email }} --agree-tos"
|
ufw:
|
||||||
|
rule: allow
|
||||||
|
port: 80
|
||||||
|
proto: tcp
|
||||||
|
when: installCertbot == True
|
||||||
|
|
||||||
|
- name: Create self-signed certificate, if configured.
|
||||||
|
shell: "certbot certonly --{{ mode }} -d {{ domain }} {{ alt_domains }} -m {{ email }} --agree-tos"
|
||||||
when: installCertbot == True
|
when: installCertbot == True
|
||||||
|
Loading…
Reference in New Issue
Block a user