Fix env variables inherited by SSH

This commit is contained in:
allegroai 2023-02-11 23:14:44 +02:00
parent d961c4b83d
commit 2ce7e3fabd

View File

@ -460,6 +460,12 @@ def setup_ssh_server(hostname, hostnames, param, task, env):
if not param.get("ssh_server"): if not param.get("ssh_server"):
return return
# make sure we do not pass it along to others, work on a copy
env = deepcopy(env)
env.pop('LOCAL_PYTHON', None)
env.pop('PYTHONPATH', None)
env.pop('DEBIAN_FRONTEND', None)
print("Installing SSH Server on {} [{}]".format(hostname, hostnames)) print("Installing SSH Server on {} [{}]".format(hostname, hostnames))
ssh_password = param.get("ssh_password", "training") ssh_password = param.get("ssh_password", "training")
# noinspection PyBroadException # noinspection PyBroadException
@ -601,8 +607,7 @@ def setup_ssh_server(hostname, hostnames, param, task, env):
except Exception: except Exception:
pass pass
proc_args = [sshd_path, "dropbear", "-e", "-K", "30", "-I", "0", "-F", "-p", str(port)] + dropbear_key_files proc_args = [sshd_path, "dropbear", "-e", "-K", "30", "-I", "0", "-F", "-p", str(port)] + dropbear_key_files
# make sure we do not pass it along to others, work on a copy # this is a copy oof `env` so there is nothing to worry about
env = deepcopy(env)
env["DROPBEAR_CLEARML_FIXED_PASSWORD"] = ssh_password env["DROPBEAR_CLEARML_FIXED_PASSWORD"] = ssh_password
else: else:
proc_args = [sshd_path, "-D", "-p", str(port)] + (["-f", custom_ssh_conf] if custom_ssh_conf else []) proc_args = [sshd_path, "-D", "-p", str(port)] + (["-f", custom_ssh_conf] if custom_ssh_conf else [])