1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-26 22:56:15 +01:00

Merge pull request #1048 from adrianschroeter/ssh_fix

ssh key authentification fixes
This commit is contained in:
Daniel Mach 2022-06-02 09:03:42 +02:00 committed by GitHub
commit 2a1faddc08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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