From 1f8fc339de34679e2d43200dd123b92e6d83c9d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Wed, 1 Jun 2022 16:23:02 +0200 Subject: [PATCH] ssh key authentification fixes - do not crash when having binary files in ~/.ssh - support also RSA key setups --- osc/conf.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osc/conf.py b/osc/conf.py index b1e3c3ab..bc6a6555 100644 --- a/osc/conf.py +++ b/osc/conf.py @@ -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