Mercurial > kallithea
changeset 8090:c8af6594ded9 stable
ssh: tweak some exception messages to make them more helpful in context
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Sun, 29 Dec 2019 15:15:09 +0100 |
parents | 1eca0ed41a6e |
children | 726c64c1cb04 |
files | kallithea/lib/ssh.py kallithea/model/ssh_key.py |
diffstat | 2 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/lib/ssh.py Sun Dec 29 01:47:29 2019 +0100 +++ b/kallithea/lib/ssh.py Sun Dec 29 15:15:09 2019 +0100 @@ -46,7 +46,7 @@ >>> parse_pub_key('''AAAAB3NzaC1yc2EAAAALVGhpcyBpcyBmYWtlIQ''') Traceback (most recent call last): ... - SshKeyParseError: Incorrect SSH key - it must have both a key type and a base64 part + SshKeyParseError: Incorrect SSH key - it must have both a key type and a base64 part, like 'ssh-rsa ASRNeaZu4FA...xlJp=' >>> parse_pub_key('''abc AAAAB3NzaC1yc2EAAAALVGhpcyBpcyBmYWtlIQ''') Traceback (most recent call last): ... @@ -74,7 +74,7 @@ parts = ssh_key.split(None, 2) if len(parts) < 2: - raise SshKeyParseError(_("Incorrect SSH key - it must have both a key type and a base64 part")) + raise SshKeyParseError(_("Incorrect SSH key - it must have both a key type and a base64 part, like 'ssh-rsa ASRNeaZu4FA...xlJp='")) keytype, keyvalue, comment = (parts + [''])[:3] if keytype not in ('ssh-rsa', 'ssh-dss', 'ssh-ed25519'):
--- a/kallithea/model/ssh_key.py Sun Dec 29 01:47:29 2019 +0100 +++ b/kallithea/model/ssh_key.py Sun Dec 29 15:15:09 2019 +0100 @@ -126,7 +126,7 @@ elif ssh.SSH_OPTIONS in l and ' ssh-serve ' in l: pass # Kallithea entries are ok to overwrite else: - raise SshKeyModelException("Safety check failed, found %r in %s - please review and remove it" % (l.strip(), authorized_keys)) + raise SshKeyModelException("Safety check failed, found %r line in %s - please remove it if Kallithea should manage the file" % (l.strip(), authorized_keys)) fh, tmp_authorized_keys = tempfile.mkstemp('.authorized_keys', dir=os.path.dirname(authorized_keys)) with os.fdopen(fh, 'w') as f: