-
Notifications
You must be signed in to change notification settings - Fork 70
Add whitelist feature #449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -156,6 +156,23 @@ weakdep _modulename_ _modules_ | |
| required/desired at runtime. When c is loaded and is being probed, it | ||
| may issue calls to request_module() causing a or b to also be loaded. | ||
|
|
||
| whitelist _modulename_ | ||
| Adds _modulename_ to the whitelist of modules that are permitted to | ||
| load. This command only has an effect once *whitelist-enable* is | ||
| also given (in this or any other configuration file); by itself, a | ||
| *whitelist* entry is parsed but has no effect. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not strictly related to this PR: Ideally we would have a way to validate the modulename(s) listed in the config. Think typos, people accidentally adding multiple on the same line (space, comma, other-separated), etc. None of this is a blocker for this feature, but if you feel like sending separate PR that would be really appreciated. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, yes, we had a stricter parsing and error messages and features (dangling comments) in the original code reading If this should be approved, I think that should go into a separate PR. |
||
|
|
||
| whitelist-enable | ||
| Enables whitelist enforcement, where only modules listed via | ||
| *whitelist* commands are permitted to load, and all other modules | ||
| are denied. | ||
|
|
||
| whitelist-test-mode | ||
| Used together with *whitelist-enable*. Modules that the whitelist | ||
| would otherwise deny are still permitted to load; a notice is logged | ||
| instead, reporting which module would have been denied. This allows | ||
| auditing the effect of a whitelist before enforcing it. | ||
|
|
||
| # COMPATIBILITY | ||
|
|
||
| A future version of kmod will come with a strong warning to avoid use of the | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| whitelist-enable | ||
| whitelist mod-simple |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Aliases extracted from modules themselves. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| kernel/mod-simple.ko: |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Device nodes to trigger on-demand module loading. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Soft dependencies extracted from modules themselves. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Aliases for symbols, used by symbol_request(). |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| whitelist-enable |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Aliases extracted from modules themselves. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| kernel/mod-simple.ko: |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Device nodes to trigger on-demand module loading. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Soft dependencies extracted from modules themselves. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Aliases for symbols, used by symbol_request(). |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Aliases extracted from modules themselves. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| kernel/mod-simple.ko: |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Device nodes to trigger on-demand module loading. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Soft dependencies extracted from modules themselves. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Aliases for symbols, used by symbol_request(). |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| whitelist-enable | ||
| whitelist-test-mode |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Aliases extracted from modules themselves. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| kernel/mod-simple.ko: |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Device nodes to trigger on-demand module loading. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Soft dependencies extracted from modules themselves. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Aliases for symbols, used by symbol_request(). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious about the train of thought here - do we want the check prior to any of the others - already_loaded, blacklist - or why not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The genesis of this was that we didn't want our kernel to dynamically load modules not explicitly whitelisted by us to reduce attack surface. So the simple logic was that modprobe when used by the kernel to load a module should work like this: "requested module not whitelisted? Reject". Already loaded modules are already loaded at that stage, nothing we can do about that . A module on both, blacklist and whitelist, would not be loaded, which seems to be the better of the two options (less surprising, less change of existing behavior, whitelist required is on top of the existing blacklist feature, this is a security feature so default to the fail-save position to not load a module)