From d32885b732ca9c378a2dc3dc00311583188e22e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Mon, 27 Oct 2025 09:53:54 +0100 Subject: [PATCH] fix import key to mikrotik --- certpusher.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/certpusher.py b/certpusher.py index 4d98f0e..35ee7d1 100644 --- a/certpusher.py +++ b/certpusher.py @@ -2,7 +2,7 @@ """ CertPusher - Automated SSL Certificate Distribution Tool Version 1.2 - Production Ready with MikroTik Services Support -Author: @linuxiarz.pl, Mateusz Gruszczyńśki +Author: @linuxiarz.pl, Mateusz Gruszczyński """ import configparser @@ -467,7 +467,26 @@ class MikroTikManager(SSHManager): return False, False logger.info("✓ Certificate imported") - + + + if key_path: + logger.info("Importing private key") + success, stdout, stderr = self.execute_command( + '/certificate import file-name=letsencrypt-key.pem passphrase=""', + timeout=30 + ) + + if not success: + logger.error(f"Key import failed: {stderr}") + return False, False + + logger.info("✓ Private key imported") + logger.debug(f"Key import output: {stdout}") + else: + logger.warning("No private key provided!") + + + time.sleep(2) # Configure