Skip to content

Commit 3fa737a

Browse files
authored
fix(cli): ssh setup and key usage (#3615)
1 parent 19142c6 commit 3fa737a

File tree

5 files changed

+19
-5
lines changed

5 files changed

+19
-5
lines changed

renku/command/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def search_session_providers_command():
3939

4040
def session_list_command():
4141
"""List all the running interactive sessions."""
42-
return Command().command(session_list)
42+
return Command().command(session_list).with_database(write=False)
4343

4444

4545
def session_start_command():

renku/core/session/renkulab.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,6 @@ def session_list(self, project_name: str, ssh_garbage_collection: bool = True) -
299299
params=self._get_renku_project_name_parts(),
300300
)
301301
if sessions_res.status_code == 200:
302-
system_config = SystemSSHConfig()
303-
name = self._project_name_from_full_project_name(project_name)
304302
sessions = [
305303
Session(
306304
id=session["name"],
@@ -310,7 +308,8 @@ def session_list(self, project_name: str, ssh_garbage_collection: bool = True) -
310308
commit=session.get("annotations", {}).get("renku.io/commit-sha"),
311309
branch=session.get("annotations", {}).get("renku.io/branch"),
312310
provider="renkulab",
313-
ssh_enabled=system_config.session_config_path(name, session["name"]).exists(),
311+
ssh_enabled=get_value("renku", "ssh_supported") == "true"
312+
or project_context.project.template_metadata.ssh_supported,
314313
)
315314
for session in sessions_res.json().get("servers", {}).values()
316315
]

renku/core/session/session.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,3 +353,8 @@ def ssh_setup(existing_key: Optional[Path] = None, force: bool = False):
353353
"""
354354
)
355355
f.write(content)
356+
357+
communication.warn(
358+
"This command does not add any public SSH keys to your project. "
359+
"Keys have to be added manually or by using the 'renku session start' command with the '--ssh' flag."
360+
)

renku/core/util/ssh.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ def setup_session_config(self, project_name: str, session_name: str) -> str:
177177
ServerAliveCountMax 3
178178
ProxyJump jumphost-{self.renku_host}
179179
IdentityFile {self.keyfile}
180+
IdentityFile ~/.ssh/id_rsa
181+
IdentityFile ~/.ssh/id_ecdsa
182+
IdentityFile ~/.ssh/id_ecdsa_sk
183+
IdentityFile ~/.ssh/id_ed25519
184+
IdentityFile ~/.ssh/id_ed25519_sk
185+
IdentityFile ~/.ssh/id_dsa
180186
User jovyan
181187
StrictHostKeyChecking no
182188
"""

renku/ui/cli/session.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,11 @@ def open(session_name, provider, **kwargs):
379379
)
380380
@click.option("--force", is_flag=True, help="Overwrite existing keys/config.")
381381
def ssh_setup(existing_key, force):
382-
"""Setup keys for SSH connections into sessions."""
382+
"""Generate keys and configuration for SSH connections into sessions.
383+
384+
Note that this will not add any keys to a specific project, adding keys to a project
385+
has to be done manually or through the renku session start command by using the --ssh flag.
386+
"""
383387
from renku.command.session import ssh_setup_command
384388

385389
communicator = ClickCallback()

0 commit comments

Comments
 (0)