From f7820b840c75e9f045e9fec841433ea60143ae21 Mon Sep 17 00:00:00 2001 From: Shreya Date: Fri, 27 Nov 2020 14:12:24 +0530 Subject: [PATCH] Change in PostgreSQL communication encryption result: only selected hosts --- .../infection_monkey/network/postgresql_fingerprint.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/monkey/infection_monkey/network/postgresql_fingerprint.py b/monkey/infection_monkey/network/postgresql_fingerprint.py index 45bc362f0..c696d561f 100644 --- a/monkey/infection_monkey/network/postgresql_fingerprint.py +++ b/monkey/infection_monkey/network/postgresql_fingerprint.py @@ -47,7 +47,8 @@ class PostgreSQLFinger(HostFinger): 'selected_ssl': "SSL connections can be made by selected hosts only OR " "non-SSL usage is forced.\n", 'selected_non_ssl': "Non-SSL connections can be made by selected hosts only OR " - "SSL usage is forced.\n"} + "SSL usage is forced.\n", + 'only_selected': "Only selected hosts can make connections (SSL or non-SSL).\n"} ssl_connection_details = [] ssl_conf_on_server = self.is_ssl_configured(exceptions) @@ -56,15 +57,20 @@ class PostgreSQLFinger(HostFinger): if ssl_conf_on_server: ssl_connection_details.append(connection_details['ssl_conf']) # SSL + ssl_selected_comms_only = False if self.found_entry_for_host_but_pwd_auth_failed(exceptions[0]): ssl_connection_details.append(connection_details['all_ssl']) else: ssl_connection_details.append(connection_details['selected_ssl']) + ssl_selected_comms_only = True # non-SSL if self.found_entry_for_host_but_pwd_auth_failed(exceptions[1]): ssl_connection_details.append(connection_details['all_non_ssl']) else: - ssl_connection_details.append(connection_details['selected_non_ssl']) + if ssl_selected_comms_only: # if only selected SSL allowed and only selected non-SSL allowed + ssl_connection_details[-1] = connection_details['only_selected'] + else: + ssl_connection_details.append(connection_details['selected_non_ssl']) # SSL not configured else: