Fix multiple issues where PasswordExecCommand was not working in server mode and PasswordExecCommand was not loaded when importing servers. #6792

This commit is contained in:
Anil Sahoo 2024-02-23 14:05:26 +05:30 committed by GitHub
parent 2ab419c8a5
commit a8ab714606
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 4 deletions

View File

@ -491,7 +491,8 @@ def dump_database_servers(output_file, selected_servers,
add_value(attr_dict, "ConnectionParameters",
server.connection_params)
# if desktop mode
# if desktop mode or server mode with
# ENABLE_SERVER_PASS_EXEC_CMD flag is True
if not current_app.config['SERVER_MODE'] or \
current_app.config['ENABLE_SERVER_PASS_EXEC_CMD']:
add_value(attr_dict, "PasswordExecCommand",
@ -727,8 +728,10 @@ def load_database_servers(input_file, selected_servers,
new_server.kerberos_conn = obj.get("KerberosAuthentication", None)
# if desktop mode
if not current_app.config['SERVER_MODE']:
# if desktop mode or server mode with
# ENABLE_SERVER_PASS_EXEC_CMD flag is True
if not current_app.config['SERVER_MODE'] or \
current_app.config['ENABLE_SERVER_PASS_EXEC_CMD']:
new_server.passexec_cmd = obj.get("PasswordExecCommand", None)
new_server.passexec_expiration = obj.get(
"PasswordExecExpiration", None)

View File

@ -29,7 +29,7 @@ class PasswordExec:
self.last_result = None
def get(self):
if config.SERVER_MODE:
if config.SERVER_MODE and not config.ENABLE_SERVER_PASS_EXEC_CMD:
# Arbitrary shell execution on server is a security risk
raise NotImplementedError('Passexec not available in server mode')
with self.lock: