mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-03-11 09:04:54 +00:00
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 <sunil@medhas.org>
This commit is contained in:
parent
4ae66c034c
commit
5da5ef5f96
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user