Skip to content

Commit e406441

Browse files
committed
KPT-1881 more precise compatibility check
1 parent a29fd7e commit e406441

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

kc-compat.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,27 @@ def myprint(silent, message):
8080
print(message)
8181

8282

83+
def kmod_is_signed():
84+
try:
85+
url = 'https://patches.kernelcare.com/' + get_kernel_hash() + '/latest.v2'
86+
latest = urlopen(url).read().decode('utf-8')
87+
url = 'https://patches.kernelcare.com/' + get_kernel_hash() + '/' + latest + '/kcare.ko'
88+
return urlopen(url).read()[-28:] == b'~Module signature appended~\n'
89+
except Exception:
90+
return False
91+
92+
8393
def main():
8494
"""
8595
if --silent or -q argument provided, don't print anything, just use exit code
8696
otherwise print results (COMPATIBLE or UNSUPPORTED)
8797
else exit with 0 if COMPATIBLE, 1 or more otherwise
8898
"""
8999
silent = len(sys.argv) > 1 and (sys.argv[1] == '--silent' or sys.argv[1] == '-q')
90-
if is_secure_boot():
100+
if is_secure_boot() and not kmod_is_signed():
91101
myprint(silent, "UNSUPPORTED; SECURE BOOT")
92102
return 3
93-
if inside_vz_container() or inside_lxc_container() or is_secure_boot():
103+
if inside_vz_container() or inside_lxc_container():
94104
myprint(silent, "UNSUPPORTED; INSIDE CONTAINER")
95105
return 2
96106
if is_compat():

0 commit comments

Comments
 (0)