Wiki » Historique » Version 5
sacha, 26/12/2022 00:27
1 | 5 | sacha | {{>toc}} |
---|---|---|---|
2 | |||
3 | 1 | sacha | # DNS récursif Ouvert DoH DoT & HA |
4 | |||
5 | Aquilenet propose deux serveurs DNS ouverts cf https://www.aquilenet.fr/services/dns/ |
||
6 | 4 | sacha | On a mis aussi un DNS ouvert sur l'IP 45.67.81.23 car facile à retenir, avec l'adresse de dns.aquilenet.fr (voir [http://dns.aquilenet.fr](http://dns.aquilenet.fr)) . Nous en avons profité pour ajouter [DoH](https://fr.wikipedia.org/wiki/DNS_over_HTTPS) et [DoT](https://fr.wikipedia.org/wiki/DNS_over_TLS) et d'avoir cette adresse en IP Virtuelle partagée entre Gaia et Hades. |
7 | Cette IP virtuelle est portée par Keepalived sur Hades le primaire et Gaia le secondaire. Si le démon Keepalived est arrêté sur Hades, l'ip bascule sur Gaia. Si on redémarre le démon sur Hades, ce dernier reprend l'IP: pratique pour les mises à jour, le service continue à fonctionner. |
||
8 | 1 | sacha | |
9 | 3 | sacha | ## Configurations communes à Gaia et Hades |
10 | 1 | sacha | |
11 | 3 | sacha | ### Apache2 |
12 | 1 | sacha | |
13 | * /etc/apache2/sites-enabled/dns.aquilenet.fr.conf |
||
14 | ~~~ |
||
15 | <VirtualHost *:80> |
||
16 | ServerAdmin webmaster@aquilenet.fr |
||
17 | ServerName dns.aquilenet.fr |
||
18 | DocumentRoot /srv/www/dns.aquilenet.fr |
||
19 | |||
20 | ErrorLog ${APACHE_LOG_DIR}/dns.aqln.error.log |
||
21 | LogLevel warn |
||
22 | CustomLog ${APACHE_LOG_DIR}/dns.aqln.access.log combined |
||
23 | |||
24 | Alias /.well-known/acme-challenge /srv/letsencrypt/challenges/dns.aquilenet.fr |
||
25 | <Directory /srv/letsencrypt/challenges/dns.aquilenet.fr> |
||
26 | Require all granted |
||
27 | </Directory> |
||
28 | <Directory /> |
||
29 | Options FollowSymLinks |
||
30 | AllowOverride None |
||
31 | Require all granted |
||
32 | </Directory> |
||
33 | </VirtualHost> |
||
34 | ~~~ |
||
35 | |||
36 | 3 | sacha | ### Bind9 |
37 | 1 | sacha | |
38 | BIND 9.17.10 implémente DoH, au jour de l'installation il n'est disponible que dans les backports bullseye (A changer quand il sera dans main). |
||
39 | |||
40 | * /etc/bind/named.conf.options |
||
41 | |||
42 | Dans la catégorie "options {" |
||
43 | ~~~ |
||
44 | listen-on-v6 { 2a0c:e300::101; }; |
||
45 | listen-on { 185.233.100.101; 45.67.81.23; }; |
||
46 | # DOH |
||
47 | listen-on port 443 tls local-tls http default { 45.67.81.23; }; |
||
48 | # DoT |
||
49 | listen-on port 853 tls local-tls { 45.67.81.23; }; |
||
50 | recursion yes; |
||
51 | dnssec-validation auto; |
||
52 | ~~~ |
||
53 | |||
54 | ~~~ |
||
55 | # DoH DoT |
||
56 | tls local-tls { |
||
57 | key-file "/etc/letsencrypt/live/dns.aquilenet.fr/privkey.pem"; |
||
58 | cert-file "/etc/letsencrypt/live/dns.aquilenet.fr/fullchain.pem"; |
||
59 | dhparam-file "/etc/bind/dhparam.pem"; |
||
60 | protocols { TLSv1.2; TLSv1.3; }; |
||
61 | prefer-server-ciphers yes; |
||
62 | session-tickets no; |
||
63 | }; |
||
64 | ~~~ |
||
65 | |||
66 | 3 | sacha | ### AppArmor |
67 | 1 | sacha | |
68 | * /etc/apparmor.d/local/usr.sbin.named |
||
69 | |||
70 | ~~~ |
||
71 | /etc/letsencrypt/** r, |
||
72 | ~~~ |
||
73 | appliquer avec: `apparmor_parser -r /etc/apparmor.d/usr.sbin.named` |
||
74 | 3 | sacha | |
75 | ## Configurations spécifiques |
||
76 | |||
77 | ### Génération du certificat SSL sur Hades |
||
78 | |||
79 | ~~~ |
||
80 | certbot --apache --agree-tos --email sysop@aquilenet.fr -d dns.aquilenet.fr |
||
81 | chgrp bind /etc/letsencrypt/live/dns.aquilenet.fr/privkey.pem |
||
82 | chmod 0640 /etc/letsencrypt/live/dns.aquilenet.fr/privkey.pem |
||
83 | openssl dhparam -out /etc/bind/dhparam.pem 4096 |
||
84 | ~~~ |
||
85 | |||
86 | Copie du certificat sur gaia |
||
87 | |||
88 | * /etc/letsencrypt/renewal-hooks/post/sync-cert.sh |
||
89 | ~~~ |
||
90 | #!/bin/bash |
||
91 | rsync -aPHSA /etc/letsencrypt/archive/dns.aquilenet.fr gaia:/etc/letsencrypt/archive/ |
||
92 | ~~~ |
||
93 | |||
94 | ### Keepalived |
||
95 | |||
96 | #### Hades Master |
||
97 | |||
98 | * /etc/keepalived/keepalived.conf |
||
99 | |||
100 | ~~~ |
||
101 | global_defs { |
||
102 | notification_email { |
||
103 | sysop@aquilenet.fr |
||
104 | } |
||
105 | notification_email_from vrrp-dns@aquilenet.fr.fr |
||
106 | smtp_server localhost |
||
107 | smtp_connect_timeout 30 |
||
108 | } |
||
109 | |||
110 | vrrp_instance DNS { |
||
111 | state MASTER |
||
112 | interface eth0 |
||
113 | virtual_router_id 101 |
||
114 | priority 100 |
||
115 | advert_int 2 |
||
116 | smtp_alert |
||
117 | unicast_src_ip 185.233.100.16 |
||
118 | unicast_peer { |
||
119 | 185.233.100.2 |
||
120 | } |
||
121 | virtual_ipaddress { |
||
122 | 45.67.81.23/32 dev eth1 scope global # VIP |
||
123 | } |
||
124 | } |
||
125 | ~~~ |
||
126 | |||
127 | #### Gaia Slave |
||
128 | |||
129 | * /etc/keepalived/keepalived.conf |
||
130 | |||
131 | ~~~ |
||
132 | global_defs { |
||
133 | notification_email { |
||
134 | sysop@aquilenet.fr |
||
135 | } |
||
136 | notification_email_from vrrp-dns@aquilenet.fr.fr |
||
137 | smtp_server localhost |
||
138 | smtp_connect_timeout 30 |
||
139 | } |
||
140 | |||
141 | vrrp_instance DNS { |
||
142 | state BACKUP |
||
143 | interface eth0 |
||
144 | virtual_router_id 101 |
||
145 | priority 50 |
||
146 | advert_int 2 |
||
147 | smtp_alert |
||
148 | unicast_src_ip 185.233.100.2 |
||
149 | unicast_peer { |
||
150 | 185.233.100.16 |
||
151 | } |
||
152 | virtual_ipaddress { |
||
153 | 45.67.81.23/32 dev eth1 scope global # VIP |
||
154 | } |
||
155 | } |
||
156 | |||
157 | 1 | sacha | ~~~ |
158 | 4 | sacha | |
159 | ## Validation |
||
160 | |||
161 | * test du service |
||
162 | ~~~ |
||
163 | dig +https +short x.org @45.67.81.23 |
||
164 | 131.252.210.176 |
||
165 | dig +tls +short x.org @45.67.81.23 |
||
166 | 131.252.210.176 |
||
167 | ~~~ |
||
168 | |||
169 | * bascule keepalived |