Skip to content

Commit 32f1381

Browse files
committed
security: run kconfig for each /boot/config- file
1 parent c23c402 commit 32f1381

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

hooks/security.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def __init__(self, parameters):
2525
self.kconfig = str(self.KCONFIG_BIN)
2626

2727
self.context.subscribe('filesystem_new_file_mime', self.check_file)
28+
self.context.subscribe('filesystem_new_file', self.kconfig_check)
2829

2930
def check_file(self, event):
3031
filepath = event.filepath
@@ -51,3 +52,11 @@ def str2bool(string):
5152
inode.fortify_source = str2bool(profile['fortify_source'])
5253
inode.fortified = profile['fortified']
5354
inode.fortifyable = profile['fortify-able']
55+
56+
def kconfig_check(self, event):
57+
filepath = event.guest_filepath
58+
inode = event.inode
59+
if re.match(r'/boot/config-.*', filepath):
60+
# run kconfig-hardened-check
61+
cmdline = [self.kconfig, '--config', filepath, '--json']
62+
kconfig_data = json.loads(subprocess.check_output(cmdline).decode())

0 commit comments

Comments
 (0)