Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kernel-hardening-checker
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-depend
kernel-hardening-checker
Commits
d9aca2d2
Commit
d9aca2d2
authored
Mar 13, 2019
by
Alexander Popov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't hide AND check results if the requirements are not met
Report them as FAIL. Thanks to @Bernhard40 for this nice idea.
parent
a6b4f7ae
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
README.md
README.md
+3
-1
kconfig-hardened-check.py
kconfig-hardened-check.py
+4
-5
No files found.
README.md
View file @
d9aca2d2
...
@@ -95,6 +95,8 @@ optional arguments:
...
@@ -95,6 +95,8 @@ optional arguments:
CONFIG_SECURITY_LOADPIN | y | my | self_protection || FAIL: "is not set"
CONFIG_SECURITY_LOADPIN | y | my | self_protection || FAIL: "is not set"
CONFIG_RESET_ATTACK_MITIGATION | y | my | self_protection || OK
CONFIG_RESET_ATTACK_MITIGATION | y | my | self_protection || OK
CONFIG_SLAB_MERGE_DEFAULT | is not set | my | self_protection || FAIL: "y"
CONFIG_SLAB_MERGE_DEFAULT | is not set | my | self_protection || FAIL: "y"
CONFIG_PAGE_POISONING_NO_SANITY | is not set | my | self_protection ||FAIL: CONFIG_PAGE_POISONING is needed
CONFIG_PAGE_POISONING_ZERO | is not set | my | self_protection ||FAIL: CONFIG_PAGE_POISONING is needed
CONFIG_SECURITY | y |defconfig | security_policy || OK
CONFIG_SECURITY | y |defconfig | security_policy || OK
CONFIG_SECURITY_YAMA | y | kspp | security_policy || OK
CONFIG_SECURITY_YAMA | y | kspp | security_policy || OK
CONFIG_SECURITY_SELINUX_DISABLE | is not set | kspp | security_policy || OK
CONFIG_SECURITY_SELINUX_DISABLE | is not set | kspp | security_policy || OK
...
@@ -151,7 +153,7 @@ optional arguments:
...
@@ -151,7 +153,7 @@ optional arguments:
CONFIG_BPF_JIT | is not set | my | cut_attack_surface || FAIL: "y"
CONFIG_BPF_JIT | is not set | my | cut_attack_surface || FAIL: "y"
CONFIG_ARCH_MMAP_RND_BITS | 32 | my |userspace_protection|| FAIL: "28"
CONFIG_ARCH_MMAP_RND_BITS | 32 | my |userspace_protection|| FAIL: "28"
[+] config check is finished: 'OK' - 43 / 'FAIL' -
58
[+] config check is finished: 'OK' - 43 / 'FAIL' -
60
```
```
__Go and fix them all!__
__Go and fix them all!__
...
...
kconfig-hardened-check.py
View file @
d9aca2d2
...
@@ -128,8 +128,8 @@ class AND(ComplexOptCheck):
...
@@ -128,8 +128,8 @@ class AND(ComplexOptCheck):
self
.
result
=
opt
.
result
self
.
result
=
opt
.
result
return
ret
,
self
.
result
return
ret
,
self
.
result
elif
not
ret
:
elif
not
ret
:
# The requirement is not met. Skip the check.
self
.
result
=
'FAIL: CONFIG_{} is needed'
.
format
(
opt
.
name
)
return
False
,
''
return
False
,
self
.
result
sys
.
exit
(
'[!] ERROR: invalid AND check'
)
sys
.
exit
(
'[!] ERROR: invalid AND check'
)
...
@@ -344,7 +344,6 @@ def print_check_results():
...
@@ -344,7 +344,6 @@ def print_check_results():
'option name'
,
'desired val'
,
'decision'
,
'reason'
,
'check result'
))
'option name'
,
'desired val'
,
'decision'
,
'reason'
,
'check result'
))
print
(
' '
+
'='
*
115
)
print
(
' '
+
'='
*
115
)
for
opt
in
checklist
:
for
opt
in
checklist
:
if
opt
.
result
:
print
(
' CONFIG_{:<32}|{:^13}|{:^10}|{:^20}||{:^28}'
.
format
(
print
(
' CONFIG_{:<32}|{:^13}|{:^10}|{:^20}||{:^28}'
.
format
(
opt
.
name
,
opt
.
expected
,
opt
.
decision
,
opt
.
reason
,
opt
.
result
))
opt
.
name
,
opt
.
expected
,
opt
.
decision
,
opt
.
reason
,
opt
.
result
))
print
()
print
()
...
@@ -422,8 +421,8 @@ if __name__ == '__main__':
...
@@ -422,8 +421,8 @@ if __name__ == '__main__':
construct_checklist
(
arch
)
construct_checklist
(
arch
)
check_config_file
(
args
.
config
)
check_config_file
(
args
.
config
)
error_count
=
len
(
list
(
filter
(
lambda
opt
:
opt
.
result
and
opt
.
result
.
startswith
(
'FAIL'
),
checklist
)))
error_count
=
len
(
list
(
filter
(
lambda
opt
:
opt
.
result
.
startswith
(
'FAIL'
),
checklist
)))
ok_count
=
len
(
list
(
filter
(
lambda
opt
:
opt
.
result
and
opt
.
result
.
startswith
(
'OK'
),
checklist
)))
ok_count
=
len
(
list
(
filter
(
lambda
opt
:
opt
.
result
.
startswith
(
'OK'
),
checklist
)))
if
debug_mode
:
if
debug_mode
:
sys
.
exit
(
0
)
sys
.
exit
(
0
)
print
(
'[+] config check is finished:
\'
OK
\'
- {} /
\'
FAIL
\'
- {}'
.
format
(
ok_count
,
error_count
))
print
(
'[+] config check is finished:
\'
OK
\'
- {} /
\'
FAIL
\'
- {}'
.
format
(
ok_count
,
error_count
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment