Skip to content

Checks wether the host cert is the same as server cert for sender if it is then an error message is given #322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ssm/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@
host_dn = get_certificate_subject(_from_file(host_cert))
log.info('Messages will be signed using %s', host_dn)

if server_cert == host_cert:
raise Ssm2Exception(

Check warning on line 226 in ssm/agents.py

View check run for this annotation

Codecov / codecov/patch

ssm/agents.py#L226

Added line #L226 was not covered by tests
"server certificate is the same as host certificate in config file. "
"Do you really mean to encrypt messages with this certificate?"
)

sender = Ssm2(brokers,
cp.get('messaging', 'path'),
path_type=path_type,
Expand All @@ -246,6 +252,7 @@
except (Ssm2Exception, CryptoException) as e:
print('SSM failed to complete successfully. See log file for details.')
log.error('SSM failed to complete successfully: %s', e)
sender_failed = True

Check warning on line 255 in ssm/agents.py

View check run for this annotation

Codecov / codecov/patch

ssm/agents.py#L255

Added line #L255 was not covered by tests
except Exception as e:
print('SSM failed to complete successfully. See log file for details.')
log.exception('Unexpected exception in SSM. See traceback below.')
Expand Down
Loading