Skip to content

Commit 677c957

Browse files
committed
Resolved #160
now checks wether the host cert is the same as server cert for sender if it is then an error message is given added sender_failed = True to an exception to properly show it failed
1 parent 6440602 commit 677c957

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ssm/agents.py

+7
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,12 @@ def run_sender(protocol, brokers, project, token, cp, log):
222222
host_dn = get_certificate_subject(_from_file(host_cert))
223223
log.info('Messages will be signed using %s', host_dn)
224224

225+
if server_cert == host_cert:
226+
raise Ssm2Exception(
227+
"server certificate is the same as host certificate in config file. "
228+
"Do you really mean to encrypt messages with this certificate?"
229+
)
230+
225231
sender = Ssm2(brokers,
226232
cp.get('messaging', 'path'),
227233
path_type=path_type,
@@ -246,6 +252,7 @@ def run_sender(protocol, brokers, project, token, cp, log):
246252
except (Ssm2Exception, CryptoException) as e:
247253
print('SSM failed to complete successfully. See log file for details.')
248254
log.error('SSM failed to complete successfully: %s', e)
255+
sender_failed = True
249256
except Exception as e:
250257
print('SSM failed to complete successfully. See log file for details.')
251258
log.exception('Unexpected exception in SSM. See traceback below.')

0 commit comments

Comments
 (0)