LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 10-10-2008, 04:11 AM   #1
PlatinumX
Member
 
Registered: May 2008
Location: France
Distribution: Debian / Fedora / Gentoo
Posts: 178

Rep: Reputation: 15
Question Can I deny modules loading, except my whitelist ?


Hi all,

I am wondering if there is a way to restrict modules loading on my machine, to only the one i choosed (listed in a modprobe) ?

I know I can blacklist some modules, but I need their name.

I would like to deny all other modules than the one I defined as mandatory.

Thanks
 
Old 10-11-2008, 12:06 AM   #2
smbell100
Member
 
Registered: Sep 2007
Location: Shetland, UK
Distribution: Slackware, Mandrake, LFS
Posts: 59

Rep: Reputation: 16
You could always delete all except the ones you want. This will certainly stop them loading.

To be safe, just move them at first so that they can be replaced if things stop working.
 
Old 10-11-2008, 12:44 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You can add them to the /etc/modprobe.d/blacklist file.

If there is one module you want to blacklist, you can try adding "broken-modules=<module name>" as a kernel boot option. It will be added to the blacklist file. I don't know if this is true for all kernels and distros however.

Last edited by jschiwal; 10-11-2008 at 03:42 AM.
 
Old 10-11-2008, 03:51 AM   #4
PlatinumX
Member
 
Registered: May 2008
Location: France
Distribution: Debian / Fedora / Gentoo
Posts: 178

Original Poster
Rep: Reputation: 15
Quote:
You can add them to the /etc/modprobe.d/blacklist file.
With the blacklist, I have to give the name of all the module I don't want.
It is the opposite I would like to do.
Allow some modules I explicitly know, and deny all the other that exists and that could exists.

There is no white-list ?
 
Old 10-11-2008, 09:09 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by PlatinumX View Post
There is no white-list ?
Apparently not, and if you think about it some more you might conclude it's not bad. I guess the option was meant to block loading drivers that are b0rken, malfunctioned or for other reasons say like not using IPv6. Since the kernel knows and can figure out module dependencies all by itself, overriding it could break things. Having to search a whitelist during every module op slows things down as well. The general concensus I think would be to compile a kernel with only the LKMs you need. If you have specific security-related requirements (do post) then we could possibly find a workaround but that won't be a standard solution and might require something path-based like Tomoyo or a script and relocating some modutils.
 
Old 10-11-2008, 02:48 PM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
For security, one thing to consider is recompiling a new kernel with modules you don't need unselected.
The LKMs won't be created or produced. You can even try building a flat kernel with everything compiled into the kernel and disabling loadable modules alltogether.
 
Old 10-13-2008, 02:03 AM   #7
PlatinumX
Member
 
Registered: May 2008
Location: France
Distribution: Debian / Fedora / Gentoo
Posts: 178

Original Poster
Rep: Reputation: 15
Hey,

Quote:
If you have specific security-related requirements (do post)
Yes, it is security related.
I did not mentioned it cause it did not know it would change the answer.

After reading documents, yes I think one solution is compiling in flat mode, disabling LKMs loading.

To keep flexibility of LKMs and add security, I found a solution with the GrSecurity kernel patch.

Thanks for advises.

Last edited by PlatinumX; 10-13-2008 at 02:06 AM.
 
Old 10-14-2008, 01:56 AM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by PlatinumX View Post
Yes, it is security related. I did not mentioned it cause it did not know it would change the answer.
If you don't post it you won't know. Any particular reasons you would like us to know?


Quote:
Originally Posted by PlatinumX View Post
To keep flexibility of LKMs and add security, I found a solution with the GrSecurity kernel patch.
Do you mean that GRSecurity allows you to keep LKMs from loading?
 
Old 10-15-2008, 04:51 AM   #9
PlatinumX
Member
 
Registered: May 2008
Location: France
Distribution: Debian / Fedora / Gentoo
Posts: 178

Original Poster
Rep: Reputation: 15
Quote:
If you don't post it you won't know. Any particular reasons you would like us to know?
Look, it is factual: security, availability, performance, flexibility or whatever...does it change the fact that there is a whitelist in the system ? I think no.

Quote:
Do you mean that GRSecurity allows you to keep LKMs from loading?
Yes
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
loading modules tramni1980 Slackware 15 09-12-2006 02:52 PM
Loading modules error after loading compiled kernel td0l2 Linux - Newbie 12 07-28-2004 11:10 AM
modules are loading that shouldn't in my rc.modules thrice Slackware 3 05-11-2004 10:35 PM
loading modules w/o rc.modules e1000 Slackware 3 01-09-2004 02:57 AM
Loading modules? RecoilUK Linux - General 3 12-26-2001 05:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 07:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration