etc/resolv.conf-generate.bash: also be verbose with chattr & chmod

This commit is contained in:
Aminda Suomalainen 2024-04-24 12:08:05 +03:00
parent 9b01bc5260
commit 32c5da4422
Signed by: Mikaela
SSH Key Fingerprint: SHA256:CXLULpqNBdUKB6E6fLA1b/4SzG0HvKD19PbIePU175Q
1 changed files with 4 additions and 4 deletions

View File

@ -9,8 +9,8 @@ fi
# In case I am behind the /etc/resolv.conf, it's immutable and read-only,
# which won't allow it to be rewritten.
chattr -i /etc/resolv.conf
chmod +w /etc/resolv.conf
chattr -V -i /etc/resolv.conf
chmod -v +w /etc/resolv.conf
# Or it's a symlink to e.g. /run/systemd/resolve/stub-resolv.conf
rm -v /etc/resolv.conf
@ -20,9 +20,9 @@ rm -v /etc/resolv.conf
printf 'nameserver ::1\nnameserver 127.0.0.1\nnameserver 127.0.0.53\noptions edns0 trust-ad timeout:1 attempts:5\nsearch .\n' | tee -p /etc/resolv.conf
# Remove all other permissions than everyone reading resolv.conf
chmod a=r /etc/resolv.conf
chmod -v a=r /etc/resolv.conf
# Make resolv.conf immutable again so it's pretty sure nothing else edits it.
chattr +i /etc/resolv.conf
chattr -V +i /etc/resolv.conf
# Let's just see it's ok
ls -l /etc/resolv.conf