Browse Source

Use resolvconf for dns resolution

Bob Mottram 7 years ago
parent
commit
9d4858c07e

+ 4
- 1
src/freedombone-image-customise View File

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

+ 1
- 1
src/freedombone-utils-config View File

316
 
316
 
317
         if grep -q "DEBIAN_REPO" $CONFIGURATION_FILE; then
317
         if grep -q "DEBIAN_REPO" $CONFIGURATION_FILE; then
318
             read_config_param "DEBIAN_REPO"
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
         fi
320
         fi
321
     fi
321
     fi
322
 }
322
 }

+ 4
- 2
src/freedombone-utils-dns View File

196
         return
196
         return
197
     fi
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
     # allow changes to resolv.conf
203
     # allow changes to resolv.conf
202
     chattr -i $resolvconf
204
     chattr -i $resolvconf
211
     echo "nameserver $NAMESERVER6" >> $resolvconf
213
     echo "nameserver $NAMESERVER6" >> $resolvconf
212
 
214
 
213
     # prevent resolv.conf from changing
215
     # prevent resolv.conf from changing
214
-    chattr +i $resolvconf
216
+    resolvconf -u
215
 
217
 
216
     mark_completed $FUNCNAME
218
     mark_completed $FUNCNAME
217
 }
219
 }

+ 4
- 6
src/freedombone-utils-onion View File

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

+ 1
- 1
src/freedombone-utils-setup View File

80
 REMOTE_BACKUPS_LOG=/var/log/remotebackups.log
80
 REMOTE_BACKUPS_LOG=/var/log/remotebackups.log
81
 
81
 
82
 # message if something fails to install
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
 # Default diffie-hellman key length in bits
85
 # Default diffie-hellman key length in bits
86
 DH_KEYLENGTH=2048
86
 DH_KEYLENGTH=2048

+ 0
- 2
src/freedombone-utils-wifi View File

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