Selaa lähdekoodia

Change location of resolv.conf

Bob Mottram 7 vuotta sitten
vanhempi
commit
a6cbf0dc65

+ 12
- 2
src/freedombone-image-customise Näytä tiedosto

@@ -239,8 +239,18 @@ iface eth0 inet static
239 239
             $rootdir/etc/network/interfaces
240 240
     fi
241 241
 
242
-    sed -i "s/nameserver.*/nameserver $NAMESERVER1/g" $rootdir/etc/resolv.conf
243
-    sed -i "/nameserver $NAMESERVER1/a\nameserver $NAMESERVER2" $rootdir/etc/resolv.conf
242
+    # configure DNS
243
+    resolvconf=$rootdir/var/run/NetworkManager/resolv.conf
244
+    chattr -i $resolvconf
245
+    echo 'domain localdomain' > $resolvconf
246
+    echo 'search localdomain' >> $resolvconf
247
+    echo "nameserver $NAMESERVER1" >> $resolvconf
248
+    echo "nameserver $NAMESERVER2" >> $resolvconf
249
+    echo "nameserver $NAMESERVER3" >> $resolvconf
250
+    echo "nameserver $NAMESERVER4" >> $resolvconf
251
+    echo "nameserver $NAMESERVER5" >> $resolvconf
252
+    echo "nameserver $NAMESERVER6" >> $resolvconf
253
+    chattr +i $resolvconf
244 254
 
245 255
     if [[ $VARIANT != "meshclient" && $VARIANT != "meshusb" ]]; then
246 256
         # change the motd to show further install instructions

+ 1
- 1
src/freedombone-utils-config Näytä tiedosto

@@ -315,7 +315,7 @@ function read_configuration_values {
315 315
 
316 316
         if grep -q "DEBIAN_REPO" $CONFIGURATION_FILE; then
317 317
             read_config_param "DEBIAN_REPO"
318
-            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."
318
+            CHECK_MESSAGE=$"Check your internet connection, /etc/network/interfaces and /var/run/NetworkManager/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 319
         fi
320 320
     fi
321 321
 }

+ 12
- 10
src/freedombone-utils-dns Näytä tiedosto

@@ -196,20 +196,22 @@ function configure_dns {
196 196
         return
197 197
     fi
198 198
 
199
+    resolvconf=/var/run/NetworkManager/resolv.conf
200
+
199 201
     # allow changes to resolv.conf
200
-    chattr -i /etc/resolv.conf
202
+    chattr -i $resolvconf
201 203
 
202
-    echo 'domain localdomain' > /etc/resolv.conf
203
-    echo 'search localdomain' >> /etc/resolv.conf
204
-    echo "nameserver $NAMESERVER1" >> /etc/resolv.conf
205
-    echo "nameserver $NAMESERVER2" >> /etc/resolv.conf
206
-    echo "nameserver $NAMESERVER3" >> /etc/resolv.conf
207
-    echo "nameserver $NAMESERVER4" >> /etc/resolv.conf
208
-    echo "nameserver $NAMESERVER5" >> /etc/resolv.conf
209
-    echo "nameserver $NAMESERVER6" >> /etc/resolv.conf
204
+    echo 'domain localdomain' > $resolvconf
205
+    echo 'search localdomain' >> $resolvconf
206
+    echo "nameserver $NAMESERVER1" >> $resolvconf
207
+    echo "nameserver $NAMESERVER2" >> $resolvconf
208
+    echo "nameserver $NAMESERVER3" >> $resolvconf
209
+    echo "nameserver $NAMESERVER4" >> $resolvconf
210
+    echo "nameserver $NAMESERVER5" >> $resolvconf
211
+    echo "nameserver $NAMESERVER6" >> $resolvconf
210 212
 
211 213
     # prevent resolv.conf from changing
212
-    chattr +i /etc/resolv.conf
214
+    chattr +i $resolvconf
213 215
 
214 216
     mark_completed $FUNCNAME
215 217
 }

+ 10
- 7
src/freedombone-utils-onion Näytä tiedosto

@@ -318,10 +318,10 @@ function resolve_dns_via_tor {
318 318
     sed -i 's|, domain-name-servers||g' /etc/dhcp/dhclient.conf
319 319
 
320 320
     # point resolv.conf to tor
321
-    echo 'nameserver 127.0.0.1:53' > /etc/resolv.conf
322
-
323
-    # prevent resolv.conf from changing
324
-    chattr +i /etc/resolv.conf
321
+    resolvconf=/var/run/NetworkManager/resolv.conf
322
+    chattr -i $resolvconf
323
+    echo 'nameserver 127.0.0.1:53' > $resolvconf
324
+    chattr +i $resolvconf
325 325
 
326 326
     mark_completed $FUNCNAME
327 327
 }
@@ -386,9 +386,12 @@ function route_outgoing_traffic_through_tor {
386 386
         /sbin/sysctl -p -q
387 387
     fi
388 388
 
389
-    echo 'domain localdomain' > /etc/resolv.conf
390
-    echo 'search localdomain' >> /etc/resolv.conf
391
-    echo 'nameserver 127.0.0.1' >> /etc/resolv.conf
389
+    resolvconf=/var/run/NetworkManager/resolv.conf
390
+    chattr -i $resolvconf
391
+    echo 'domain localdomain' > $resolvconf
392
+    echo 'search localdomain' >> $resolvconf
393
+    echo 'nameserver 127.0.0.1' >> $resolvconf
394
+    chattr +i $resolvconf
392 395
 
393 396
     if ! grep -q "VirtualAddrNetworkIPv4" /etc/tor/torrc; then
394 397
         echo 'VirtualAddrNetworkIPv4 10.192.0.0/10' >> /etc/tor/torrc

+ 1
- 1
src/freedombone-utils-setup Näytä tiedosto

@@ -76,7 +76,7 @@ COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
76 76
 REMOTE_BACKUPS_LOG=/var/log/remotebackups.log
77 77
 
78 78
 # message if something fails to install
79
-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."
79
+CHECK_MESSAGE="Check your internet connection, /etc/network/interfaces and /var/run/NetworkManager/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."
80 80
 
81 81
 # Default diffie-hellman key length in bits
82 82
 DH_KEYLENGTH=2048

+ 2
- 1
src/freedombone-utils-wifi Näytä tiedosto

@@ -447,7 +447,8 @@ function networks_from_file {
447 447
         fi
448 448
     done < $WIFI_NETWORKS_FILE
449 449
 
450
-    chattr -i /etc/resolv.conf
450
+    resolvconf=/var/run/NetworkManager/resolv.conf
451
+    chattr -i $resolvconf
451 452
     systemctl restart network-manager
452 453
     ifconfig ${WIFI_INTERFACE} up
453 454
 }