Skip to content

Commit 96bf54d

Browse files
huizhjonludlam
authored andcommitted
CP-18825: Remove FIST and ensure signature must be verified.
Signed-off-by: Hui Zhang <[email protected]>
1 parent e0cd26f commit 96bf54d

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

scripts/extensions/pool_update.apply

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ PATCH_ALREADY_APPLIED = 'PATCH_ALREADY_APPLIED'
1818
PATCH_APPLY_FAILED = 'PATCH_APPLY_FAILED'
1919
OTHER_OPERATION_IN_PROGRESS = 'OTHER_OPERATION_IN_PROGRESS'
2020
PATCH_PRECHECK_FAILED_UNKNOWN_ERROR = 'PATCH_PRECHECK_FAILED_UNKNOWN_ERROR'
21-
FIST_FILE = '/tmp/fist_allowed_unsigned_updates'
2221

2322

2423
class ApplyFailure(Exception):
@@ -36,10 +35,10 @@ def failure_message(code, params):
3635
return xmlrpclib.dumps((rpcparams, ), '', True)
3736

3837

39-
def execute_apply(session, update_package, yum_conf_file, nogpgcheck):
38+
def execute_apply(session, update_package, yum_conf_file):
4039
FNULL = open(os.devnull, 'w')
4140
retcode = subprocess.call('yum -c ' + yum_conf_file + ' install -y ' +
42-
nogpgcheck + update_package, shell=True, stdout=FNULL, stderr=FNULL)
41+
update_package, shell=True, stdout=FNULL, stderr=FNULL)
4342
if retcode != 0:
4443
raise ApplyFailure(
4544
'Failed to install update_package (%r).' % update_package)
@@ -85,11 +84,6 @@ if __name__ == '__main__':
8584
failure_message(PATCH_PRECHECK_FAILED_UNKNOWN_ERROR, ['%s' % str(e)]))
8685
sys.exit(0)
8786

88-
allow_unsigned = False
89-
if os.path.isfile(FIST_FILE):
90-
allow_unsigned = update_uuid in open(FIST_FILE, 'rb').read().split()
91-
nogpgcheck = ' --nogpgcheck ' if allow_unsigned else ' '
92-
9387
# Apply the update.
9488
try:
9589
yum_conf = session.xenapi.pool_update.attach(update)
@@ -103,7 +97,7 @@ if __name__ == '__main__':
10397
with open (yum_conf_file, "w+") as file:
10498
file.write("{0}".format(yum_conf))
10599

106-
execute_apply(session, update_package, yum_conf_file, nogpgcheck)
100+
execute_apply(session, update_package, yum_conf_file)
107101

108102
session.xenapi.pool_update.resync_host(host)
109103
print(success_message())

scripts/extensions/pool_update.precheck

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import ConfigParser
1717

1818
UPDATE_DIR = '/var/update/'
1919
PATCH_PRECHECK_FAILED_UNKNOWN_ERROR = 'PATCH_PRECHECK_FAILED_UNKNOWN_ERROR'
20-
FIST_FILE = '/tmp/fist_allowed_unsigned_updates'
2120

2221

2322
class PrecheckFailure(Exception):
@@ -49,10 +48,10 @@ def parse_control_package(session, yum_url):
4948
return items[0].getAttribute('control')
5049

5150

52-
def execute_precheck(session, control_package, yum_conf_file, nogpgcheck):
51+
def execute_precheck(session, control_package, yum_conf_file):
5352
FNULL = open(os.devnull, 'w')
5453
retcode = subprocess.call('yum -c ' + yum_conf_file + ' install -y ' +
55-
nogpgcheck + control_package, shell=True, stdout=FNULL, stderr=FNULL)
54+
control_package, shell=True, stdout=FNULL, stderr=FNULL)
5655
if retcode != 0:
5756
raise PrecheckFailure(
5857
'Execute control_package (%r) failed.' % control_package)
@@ -92,11 +91,7 @@ if __name__ == '__main__':
9291

9392
control_package = parse_control_package(session, yum_url)
9493

95-
allow_unsigned = False
96-
if os.path.isfile(FIST_FILE):
97-
allow_unsigned = update_uuid in open(FIST_FILE, 'rb').read().split()
98-
nogpgcheck = ' --nogpgcheck ' if allow_unsigned else ' '
99-
execute_precheck(session, control_package, yum_conf_file, nogpgcheck)
94+
execute_precheck(session, control_package, yum_conf_file)
10095

10196
print(success_message())
10297
except Exception as e:

0 commit comments

Comments
 (0)