mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +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 app as app_module
|
||||||
from plinth import cfg, glib, menu
|
from plinth import cfg, glib, menu
|
||||||
|
from plinth.modules.names.components import DomainName
|
||||||
from plinth.package import Packages
|
from plinth.package import Packages
|
||||||
|
|
||||||
from . import api, errors, manifest, privileged
|
from . import api, errors, manifest, privileged
|
||||||
@ -154,11 +155,14 @@ def generate_ssh_client_auth_key():
|
|||||||
key_path)
|
key_path)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
domain_name = DomainName.list_names()[0]
|
||||||
logger.info('Generating SSH client key %s for FreedomBox service',
|
logger.info('Generating SSH client key %s for FreedomBox service',
|
||||||
key_path)
|
key_path)
|
||||||
subprocess.run(
|
subprocess.run([
|
||||||
['ssh-keygen', '-t', 'ed25519', '-N', '', '-f',
|
'ssh-keygen', '-t', 'ed25519', '-N', '', '-C',
|
||||||
str(key_path)], stdout=subprocess.DEVNULL, check=True)
|
f'freedombox@{domain_name}', '-f',
|
||||||
|
str(key_path)
|
||||||
|
], stdout=subprocess.DEVNULL, check=True)
|
||||||
|
|
||||||
|
|
||||||
def get_ssh_client_public_key() -> str:
|
def get_ssh_client_public_key() -> str:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user