From 5da5ef5f96a20865f49519de59fe90b2d9304157 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Thu, 5 Feb 2026 22:24:16 -0800 Subject: [PATCH] backups: Create a better comment in the generated SSH key file Tests: - When /var/lib/plinth/.ssh is deleted and add remote repository form is visited, the directory along with SSH key files are created. The .pub file has the expected comment freedombox@configured_domain. Signed-off-by: Sunil Mohan Adapa --- plinth/modules/backups/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plinth/modules/backups/__init__.py b/plinth/modules/backups/__init__.py index 9499d56aa..55cfb50e1 100644 --- a/plinth/modules/backups/__init__.py +++ b/plinth/modules/backups/__init__.py @@ -15,6 +15,7 @@ from django.utils.translation import gettext_noop from plinth import app as app_module from plinth import cfg, glib, menu +from plinth.modules.names.components import DomainName from plinth.package import Packages from . import api, errors, manifest, privileged @@ -154,11 +155,14 @@ def generate_ssh_client_auth_key(): key_path) return + domain_name = DomainName.list_names()[0] logger.info('Generating SSH client key %s for FreedomBox service', key_path) - subprocess.run( - ['ssh-keygen', '-t', 'ed25519', '-N', '', '-f', - str(key_path)], stdout=subprocess.DEVNULL, check=True) + subprocess.run([ + 'ssh-keygen', '-t', 'ed25519', '-N', '', '-C', + f'freedombox@{domain_name}', '-f', + str(key_path) + ], stdout=subprocess.DEVNULL, check=True) def get_ssh_client_public_key() -> str: