fix import key to mikrotik

This commit is contained in:
Mateusz Gruszczyński
2025-10-27 09:53:54 +01:00
parent e73027a3c8
commit d32885b732

View File

@@ -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