diff --git a/renku/command/session.py b/renku/command/session.py index 824ad9be58..12bd063c9a 100644 --- a/renku/command/session.py +++ b/renku/command/session.py @@ -39,7 +39,7 @@ def search_session_providers_command(): def session_list_command(): """List all the running interactive sessions.""" - return Command().command(session_list) + return Command().command(session_list).with_database(write=False) def session_start_command(): diff --git a/renku/core/session/renkulab.py b/renku/core/session/renkulab.py index 4693c0d9ac..32ed5a5364 100644 --- a/renku/core/session/renkulab.py +++ b/renku/core/session/renkulab.py @@ -299,8 +299,6 @@ def session_list(self, project_name: str, ssh_garbage_collection: bool = True) - params=self._get_renku_project_name_parts(), ) if sessions_res.status_code == 200: - system_config = SystemSSHConfig() - name = self._project_name_from_full_project_name(project_name) sessions = [ Session( id=session["name"], @@ -310,7 +308,8 @@ def session_list(self, project_name: str, ssh_garbage_collection: bool = True) - commit=session.get("annotations", {}).get("renku.io/commit-sha"), branch=session.get("annotations", {}).get("renku.io/branch"), provider="renkulab", - ssh_enabled=system_config.session_config_path(name, session["name"]).exists(), + ssh_enabled=get_value("renku", "ssh_supported") == "true" + or project_context.project.template_metadata.ssh_supported, ) for session in sessions_res.json().get("servers", {}).values() ] diff --git a/renku/core/session/session.py b/renku/core/session/session.py index 0ca42e32ef..ce1fa67f6c 100644 --- a/renku/core/session/session.py +++ b/renku/core/session/session.py @@ -353,3 +353,8 @@ def ssh_setup(existing_key: Optional[Path] = None, force: bool = False): """ ) f.write(content) + + communication.warn( + "This command does not add any public SSH keys to your project. " + "Keys have to be added manually or by using the 'renku session start' command with the '--ssh' flag." + ) diff --git a/renku/core/util/ssh.py b/renku/core/util/ssh.py index 0f787a7ec9..e55f6e92aa 100644 --- a/renku/core/util/ssh.py +++ b/renku/core/util/ssh.py @@ -177,6 +177,12 @@ def setup_session_config(self, project_name: str, session_name: str) -> str: ServerAliveCountMax 3 ProxyJump jumphost-{self.renku_host} IdentityFile {self.keyfile} + IdentityFile ~/.ssh/id_rsa + IdentityFile ~/.ssh/id_ecdsa + IdentityFile ~/.ssh/id_ecdsa_sk + IdentityFile ~/.ssh/id_ed25519 + IdentityFile ~/.ssh/id_ed25519_sk + IdentityFile ~/.ssh/id_dsa User jovyan StrictHostKeyChecking no """ diff --git a/renku/ui/cli/session.py b/renku/ui/cli/session.py index 3db7642479..ba40aa8f7a 100644 --- a/renku/ui/cli/session.py +++ b/renku/ui/cli/session.py @@ -379,7 +379,11 @@ def open(session_name, provider, **kwargs): ) @click.option("--force", is_flag=True, help="Overwrite existing keys/config.") def ssh_setup(existing_key, force): - """Setup keys for SSH connections into sessions.""" + """Generate keys and configuration for SSH connections into sessions. + + Note that this will not add any keys to a specific project, adding keys to a project + has to be done manually or through the renku session start command by using the --ssh flag. + """ from renku.command.session import ssh_setup_command communicator = ClickCallback()