From c903379eeeded97d2df8205ad0714564b1cf2f47 Mon Sep 17 00:00:00 2001 From: Ayoub Zaki Date: Wed, 24 Mar 2021 14:30:27 +0100 Subject: [PATCH] Non interactive key password injection Add possibiliy to inject private key password using environment variable KEY_PASS. --- authkeys.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/authkeys.cpp b/authkeys.cpp index fb801a8..8d9760c 100755 --- a/authkeys.cpp +++ b/authkeys.cpp @@ -186,9 +186,11 @@ uint8_t Key::ParseOpenSSLKey(FILE* f) RSA_Class rsaInst; OpenSSL_add_all_algorithms(); uint32_t keySzRd; + char *key_pass = NULL; if (isSecret) { - rsaInst.rsa = PEM_read_RSAPrivateKey(f, NULL, NULL, NULL); + key_pass = getenv("KEY_PASS"); + rsaInst.rsa = PEM_read_RSAPrivateKey(f, NULL, NULL, (void *)key_pass); if(rsaInst.rsa == NULL) { return 1;