mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
backups: Fix issue with verifying remote server identity
- The output of ssh-keyscan scan contain comments that start with '#'. When these are present, they are incorrectly assumed to be valid keys. Ignore these lines. Tests: - Output of ssh-keyscan with latest OpenSSH in Debian testing contains comments. Trying to verify the identity of the remove host without the patch fails when adding remote backup repository. When patch is applied, it works (except RSA key). Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
fdde1cd40b
commit
54538ed891
@ -292,7 +292,8 @@ class VerifySshHostkeyForm(forms.Form):
|
||||
keyscan = subprocess.run(['ssh-keyscan', hostname],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE, check=False)
|
||||
keys = keyscan.stdout.decode().splitlines()
|
||||
key_lines = keyscan.stdout.decode().splitlines()
|
||||
keys = [line for line in key_lines if not line.startswith('#')]
|
||||
error_message = keyscan.stderr.decode() if keyscan.returncode else None
|
||||
# Generate user-friendly fingerprints of public keys
|
||||
keygen = subprocess.run(['ssh-keygen', '-l', '-f', '-'],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user