Skip to content

Commit b29ef6f

Browse files
authored
Merge pull request #2 from cloudlinux/KPT-1881
KPT-1881 kernelcare now supports secure boot
2 parents a29fd7e + 05998e2 commit b29ef6f

File tree

1 file changed

+1
-27
lines changed

1 file changed

+1
-27
lines changed

kc-compat.py

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -39,29 +39,6 @@ def inside_vz_container():
3939
return os.path.exists('/proc/vz/veinfo') and not os.path.exists('/proc/vz/version')
4040

4141

42-
def _get_last_byte_from(filename):
43-
""" Reading the last byte from the varfile
44-
:return: last byte in a file as unsigned int or None if file was empty
45-
"""
46-
with open(filename, 'rb') as f:
47-
last, = struct.unpack("B", f.read()[-1:])
48-
return last
49-
50-
51-
def is_secure_boot():
52-
""" Detects Secure Boot
53-
:return: True if Secure Boot is enabled, false otherwise
54-
"""
55-
efivars_location = "/sys/firmware/efi/efivars/"
56-
if not os.path.isdir(efivars_location):
57-
return False
58-
for filename in os.listdir(efivars_location):
59-
if filename.startswith('SecureBoot'):
60-
varfile = os.path.join(efivars_location, filename)
61-
return _get_last_byte_from(varfile) == 1
62-
return False
63-
64-
6542
def inside_lxc_container():
6643
return '/lxc/' in open('/proc/1/cgroup').read()
6744

@@ -87,10 +64,7 @@ def main():
8764
else exit with 0 if COMPATIBLE, 1 or more otherwise
8865
"""
8966
silent = len(sys.argv) > 1 and (sys.argv[1] == '--silent' or sys.argv[1] == '-q')
90-
if is_secure_boot():
91-
myprint(silent, "UNSUPPORTED; SECURE BOOT")
92-
return 3
93-
if inside_vz_container() or inside_lxc_container() or is_secure_boot():
67+
if inside_vz_container() or inside_lxc_container():
9468
myprint(silent, "UNSUPPORTED; INSIDE CONTAINER")
9569
return 2
9670
if is_compat():

0 commit comments

Comments
 (0)