forked from p15670423/monkey
Island: Remove identification of ssh keys by username and ip
`ssh_key_exists` is identifing ssh keys based on username and ip which is wrong.
This commit is contained in:
parent
f2a8dcc908
commit
2d800e4502
|
@ -185,21 +185,13 @@ class ConfigService:
|
|||
)
|
||||
|
||||
@staticmethod
|
||||
def ssh_add_keys(public_key, private_key, user, ip):
|
||||
if not ConfigService.ssh_key_exists(
|
||||
ConfigService.get_config_value(SSH_KEYS_PATH, False, False), user, ip
|
||||
):
|
||||
def ssh_add_keys(public_key, private_key):
|
||||
ConfigService.add_item_to_config_set_if_dont_exist(
|
||||
SSH_KEYS_PATH,
|
||||
{"public_key": public_key, "private_key": private_key, "user": user, "ip": ip},
|
||||
# SSH keys already encrypted in process_ssh_info()
|
||||
should_encrypt=False,
|
||||
{"public_key": public_key, "private_key": private_key},
|
||||
should_encrypt=True,
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def ssh_key_exists(keys, user, ip):
|
||||
return [key for key in keys if key["user"] == user and key["ip"] == ip]
|
||||
|
||||
def _filter_none_values(data):
|
||||
if isinstance(data, dict):
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue