Parcourir la source

Use resolvconf for dns resolution

Bob Mottram il y a 7 ans
Parent
révision
9d4858c07e

+ 4
- 1
src/freedombone-image-customise Voir le fichier

@@ -178,6 +178,8 @@ EOF
178 178
 }
179 179
 
180 180
 configure_networking() {
181
+    chroot "$rootdir" apt-get -yq install resolvconf
182
+
181 183
     if [[ "$MACHINE" == "beaglebonewifi" ]]; then
182 184
         # Allow networking over USB in order to configure the
183 185
         # wifi login settings
@@ -244,7 +246,7 @@ iface eth0 inet static
244 246
     fi
245 247
 
246 248
     # configure DNS
247
-    resolvconf=$rootdir/etc/resolv.conf
249
+    resolvconf=$rootdir/etc/resolvconf/resolv.conf.d/head
248 250
     echo 'domain localdomain' > $resolvconf
249 251
     echo 'search localdomain' >> $resolvconf
250 252
     echo "nameserver $NAMESERVER1" >> $resolvconf
@@ -253,6 +255,7 @@ iface eth0 inet static
253 255
     echo "nameserver $NAMESERVER4" >> $resolvconf
254 256
     echo "nameserver $NAMESERVER5" >> $resolvconf
255 257
     echo "nameserver $NAMESERVER6" >> $resolvconf
258
+    chroot "$rootdir" resolvconf -u
256 259
 
257 260
     if [[ $VARIANT != "meshclient" && $VARIANT != "meshusb" ]]; then
258 261
         # change the motd to show further install instructions

+ 1
- 1
src/freedombone-utils-config Voir le fichier

@@ -316,7 +316,7 @@ function read_configuration_values {
316 316
 
317 317
         if grep -q "DEBIAN_REPO" $CONFIGURATION_FILE; then
318 318
             read_config_param "DEBIAN_REPO"
319
-            CHECK_MESSAGE=$"Check your internet connection, /etc/network/interfaces and /etc/resolv.conf, then delete $COMPLETION_FILE, run 'rm -fR /var/lib/apt/lists/* && apt-get update --fix-missing' and run this script again. If hash sum mismatches persist then try setting $DEBIAN_REPO to a different mirror and also change /etc/apt/sources.list."
319
+            CHECK_MESSAGE=$"Check your internet connection, /etc/network/interfaces and /etc/resolvconf/resolv.conf.d/head, then delete $COMPLETION_FILE, run 'rm -fR /var/lib/apt/lists/* && apt-get update --fix-missing' and run this script again. If hash sum mismatches persist then try setting $DEBIAN_REPO to a different mirror and also change /etc/apt/sources.list."
320 320
         fi
321 321
     fi
322 322
 }

+ 4
- 2
src/freedombone-utils-dns Voir le fichier

@@ -196,7 +196,9 @@ function configure_dns {
196 196
         return
197 197
     fi
198 198
 
199
-    resolvconf=/etc/resolv.conf
199
+    apt-get -yq install resolvconf
200
+
201
+    resolvconf=/etc/resolvconf/resolv.conf.d/head
200 202
 
201 203
     # allow changes to resolv.conf
202 204
     chattr -i $resolvconf
@@ -211,7 +213,7 @@ function configure_dns {
211 213
     echo "nameserver $NAMESERVER6" >> $resolvconf
212 214
 
213 215
     # prevent resolv.conf from changing
214
-    chattr +i $resolvconf
216
+    resolvconf -u
215 217
 
216 218
     mark_completed $FUNCNAME
217 219
 }

+ 4
- 6
src/freedombone-utils-onion Voir le fichier

@@ -310,10 +310,9 @@ function resolve_dns_via_tor {
310 310
     sed -i 's|, domain-name-servers||g' /etc/dhcp/dhclient.conf
311 311
 
312 312
     # point resolv.conf to tor
313
-    resolvconf=/etc/resolv.conf
314
-    chattr -i $resolvconf
313
+    resolvconf=/etc/resolvconf/resolv.conf.d/head
315 314
     echo 'nameserver 127.0.0.1:53' > $resolvconf
316
-    chattr +i $resolvconf
315
+    resolvconf -u
317 316
 
318 317
     mark_completed $FUNCNAME
319 318
 }
@@ -378,12 +377,11 @@ function route_outgoing_traffic_through_tor {
378 377
         /sbin/sysctl -p -q
379 378
     fi
380 379
 
381
-    resolvconf=/etc/resolv.conf
382
-    chattr -i $resolvconf
380
+    resolvconf=/etc/resolvconf/resolv.conf.d/head
383 381
     echo 'domain localdomain' > $resolvconf
384 382
     echo 'search localdomain' >> $resolvconf
385 383
     echo 'nameserver 127.0.0.1' >> $resolvconf
386
-    chattr +i $resolvconf
384
+    resolvconf -u
387 385
 
388 386
     if ! grep -q "VirtualAddrNetworkIPv4" /etc/tor/torrc; then
389 387
         echo 'VirtualAddrNetworkIPv4 10.192.0.0/10' >> /etc/tor/torrc

+ 1
- 1
src/freedombone-utils-setup Voir le fichier

@@ -80,7 +80,7 @@ COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
80 80
 REMOTE_BACKUPS_LOG=/var/log/remotebackups.log
81 81
 
82 82
 # message if something fails to install
83
-CHECK_MESSAGE="Check your internet connection, /etc/network/interfaces and /etc/resolv.conf, then delete $COMPLETION_FILE, run 'rm -fR /var/lib/apt/lists/* && apt-get update --fix-missing' and run this script again. If hash sum mismatches persist then try setting $DEBIAN_REPO to a different mirror and also change /etc/apt/sources.list."
83
+CHECK_MESSAGE="Check your internet connection, /etc/network/interfaces and /etc/resolvconf/resolv.conf.d/head, then delete $COMPLETION_FILE, run 'rm -fR /var/lib/apt/lists/* && apt-get update --fix-missing' and run this script again. If hash sum mismatches persist then try setting $DEBIAN_REPO to a different mirror and also change /etc/apt/sources.list."
84 84
 
85 85
 # Default diffie-hellman key length in bits
86 86
 DH_KEYLENGTH=2048

+ 0
- 2
src/freedombone-utils-wifi Voir le fichier

@@ -466,8 +466,6 @@ function networks_from_file {
466 466
         fi
467 467
     done < $WIFI_NETWORKS_FILE
468 468
 
469
-    resolvconf=/etc/resolv.conf
470
-    chattr -i $resolvconf
471 469
     systemctl restart network-manager
472 470
     #ifconfig ${WIFI_INTERFACE} up
473 471
     ifup $WIFI_INTERFACE