Try to fix DNS (privacy) issues

This commit is contained in:
ThomasKaiser 2018-08-24 20:26:08 +02:00
parent e358089bbc
commit f10acc0080
3 changed files with 9 additions and 6 deletions

View file

@ -59,7 +59,6 @@ create_chroot()
printf '#!/bin/sh\nexit 101' > $target_dir/usr/sbin/policy-rc.d
chmod 755 $target_dir/usr/sbin/policy-rc.d
rm $target_dir/etc/resolv.conf 2>/dev/null
echo "1.1.1.1" > $target_dir/etc/resolv.conf
rm $target_dir/etc/hosts 2>/dev/null
echo "127.0.0.1 localhost" > $target_dir/etc/hosts
mkdir -p $target_dir/root/{build,overlay,sources} $target_dir/selinux

View file

@ -199,7 +199,8 @@ install_common()
# DNS fix. package resolvconf is not available everywhere
if [ -d /etc/resolvconf/resolv.conf.d ]; then
echo 'nameserver 1.1.1.1' > $SDCARD/etc/resolvconf/resolv.conf.d/head
echo -e "# In case of DNS problems, try uncommenting this and reboot for debugging\n# nameserver 1.1.1.1" \
> $SDCARD/etc/resolvconf/resolv.conf.d/head
fi
# premit root login via SSH for the first boot
@ -265,8 +266,6 @@ install_distribution_specific()
exit 0
EOF
chmod +x $SDCARD/etc/rc.local
# DNS fix
sed -i "s/#DNS=.*/DNS=1.1.1.1/g" $SDCARD/etc/systemd/resolved.conf
;;
bionic)
# remove doubled uname from motd
@ -297,8 +296,6 @@ install_distribution_specific()
version: 2
renderer: NetworkManager
EOF
# DNS fix
sed -i "s/#DNS=.*/DNS=1.1.1.1/g" $SDCARD/etc/systemd/resolved.conf
# Journal service adjustements
sed -i "s/#Storage=.*/Storage=volatile/g" $SDCARD/etc/systemd/journald.conf
sed -i "s/#Compress=.*/Compress=yes/g" $SDCARD/etc/systemd/journald.conf

View file

@ -56,6 +56,13 @@ case "$1" in
/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml
fi
# check whether DNS resolution works, if not switch to Cloudflare DNS
fping cloudflare.com >/dev/null 2>&1
if [ $? -ne 0 ]; then
sed -i "s/#DNS=.*/DNS=1.1.1.1/" /etc/systemd/resolved.conf
sed -i "s/# nameserver.*/nameserver 1.1.1.1/" /etc/resolvconf/resolv.conf.d/head
fi
# some hardware workarounds
case $LINUXFAMILY in
sun7i|sun8i)