1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-09-07 05:38:43 +02:00

ssh key authentification fixes

- do not crash when having binary files in ~/.ssh
- support also RSA key setups
This commit is contained in:
2022-06-01 16:23:02 +02:00
parent 981440aa4e
commit 1f8fc339de

View File

@@ -573,7 +573,13 @@ def _build_opener(apiurl):
if not os.path.isfile(keyfile_path):
return False
with open(keyfile_path, "r") as f:
line = f.readline(100).strip()
try:
line = f.readline(100).strip()
except UnicodeDecodeError:
# skip binary files
return False
if line == "-----BEGIN RSA PRIVATE KEY-----":
return True
if line == "-----BEGIN OPENSSH PRIVATE KEY-----":
return True
return False