This is being asked because of the recent linux vulnerabilitydirty frag. Now one of the methods to mitigate this is to switch off IPv4 and IPv6 ESP along with the RxRPC protocol used in the Andrew File System (AFS). According to the recommendation it is required that a .conf file is created in the directory /etc/modprobe.d/ with the following content
There is a workaround for the behaviour described in the #alias and #blacklist notes. The install configuration command instructs modprobe to run a custom command instead of inserting the module in the kernel as normal, so you can simulate the successful module loading with:
/etc/modprobe.d/blacklist.conf
install *module_name* /bin/true
You can force the module to always fail loading with /bin/false: this will effectively prevent the module—and any other that depends on it—from loading by any means, and a log error message may be produced.
So based on that, this will disable these modules:
Okay so from what I get if install *module_name* /bin/true
is used then instead of the *module_name* a /bin/true will be loaded. Since this is /bin/true it will not be logged into the syslog or systemd-log as a failure, just that the module will not load.
On the other hand if install *module_name* /bin/false
is used then also the module will not be loaded but a error log entry will be created into the syslog or systemd-log.
So in both the cases the modules does not load in the kernel but in case of usage of /bin/false a error log entry is created which does not happen in the case of usage of /bin/true. Is this correct? Is there something more to this?
And finally about using the blacklist *module_name*
in a .conf file. How does that work? And what is its impact? Will it be of any use?
What if we have both, i.e. blacklist as well as install *module_name* /bin/true?
But with /bin/true the modules are disabled as well. Both, /bin/false and /bin/true achieve the same thing.
See step 3 in this document:
With /bin/true modprobe believes that the module was loaded successfully. With /bin/false modprobe will get an error loading the module and will pass that error on to the calling program.
If you want to prevent error log spam you should use /bin/true:
So I ran the command and this is the output. Please note that I have not created a /etc/modprobe.d/blacklist.conf nor /etc/modprobe.d/dirtyfrag.conf with blocking of modules esp4 and esp6
Thanks @mbod that cleared up a lot. If you do not mind me picking your brains for a few follow up questions.
Firstly from what I gather using /bin/false might help in troubleshooting as it will be logged into the syslog or systemd-log that the module loading failed. So in that way it might be useful while troubleshooting. But on the other hand if a malicious actor were to gain access to the system, either remotely or physically means not relevant right now, then it would help that the syslog/systemd-log not have an entry showing that the module loading failed. It will make malicious actors work harder. Is this logical and correct?
Secondly the log entry will be created only once right? While the system is booting or rebooting. Post that in normal working there will not be any log entry unless a module is loaded explicitly from the terminal. Is this correct too?
Since esp4 and esp6 are not loaded does that mean the computer running Arch Linux Kernel 7.0.3-arch1-2 G is safe from dirty frag ? Offcourse the module esp4 could be loaded via a terminal command.
No. The mechanism with “install *module_name* /bin/false” is only valid for the modprobe command. But the modul can still be loaded with the insmod command.
E.g.
I have: install algif_aead /bin/false
I try modprobe and I get:
# modprobe algif_aead
modprobe: ERROR: Error running install command ‘/bin/false’ for module algif_aead: retcode 1
modprobe: ERROR: could not insert ‘algif_aead’: Invalid argument
This is not predictable. It depends on the calling program. If a program tries to load the modul only once, there will be only one log entry. But if it tries to load the modul multiple times, e.g. every minute, you will see multiple log entries.
I couldn’t answer that since it is above my pay grade. The absence of output from lsmod only says that the modules are not currently loaded into the kernel. They do seem to exist on the disk though:
So found the answer. No if the modules are not loaded currently then they can be loaded. What is required is setting the values and a reboot.
Source 1: https://github.com/V4bel/dirtyfrag/issues/1
Source 2: What @mbod had just posted earlier in this thread.