News for hackers. Stuff that matters.
Re:How to take back control of /etc/resolv.conf on Linux (2018) by amaccuish on Tuesday March 19, 2019 @05:22PM (#19436059)
On my domain controllers (where I absolutely cannot have anyone touching the conf), I just chattr +i /etc/resolv.conf.

That prevents anything, even root, from changing the file, unless chattr -i is called first.

Re:How to take back control of /etc/resolv.conf on Linux (2018) by ktpsns on Tuesday March 19, 2019 @05:32PM (#19436172)
Wow, I wasn't aware of the chattr command at all. Here is a list of available: https://en.wikipedia.org/wiki/Chattr

Apparently, they are very file system specific. That's why they are not widely used. I guess a chmod 0444 would not do it, as system tools tend to "fix" wrong permissions automatically (but not permissive attributes).

Re:How to take back control of /etc/resolv.conf on Linux (2018) by j7k6 on Tuesday March 19, 2019 @06:17PM (#19436646)
I use `chattr +i` with NFS mountpoints for backups, it prevents the local harddrive from filling up when a network share fails to mount on boot.
Re:How to take back control of /etc/resolv.conf on Linux (2018) by muxator on Tuesday March 19, 2019 @07:02PM (#19437038)
Totally. If something is meant to be a mount point, a chattr +i on the underlying directory is a godsend, because it gives you an immediate error in case the mount should fail for whatever reason.
Re:How to take back control of /etc/resolv.conf on Linux (2018) by larkeith on Tuesday March 19, 2019 @06:54PM (#19436980)
You might be able to do it in a more system-agnostic manner with SELinux.
Re:How to take back control of /etc/resolv.conf on Linux (2018) by cyphar on Wednesday March 20, 2019 @07:23AM (#19440965)
That would be less system-agnostic because you have to be running with SELinux as the LSM. The immutable attribute is supported on almost all filesystems.