fix import key to mikrotik
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
"""
|
"""
|
||||||
CertPusher - Automated SSL Certificate Distribution Tool
|
CertPusher - Automated SSL Certificate Distribution Tool
|
||||||
Version 1.2 - Production Ready with MikroTik Services Support
|
Version 1.2 - Production Ready with MikroTik Services Support
|
||||||
Author: @linuxiarz.pl, Mateusz Gruszczyńśki
|
Author: @linuxiarz.pl, Mateusz Gruszczyński
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import configparser
|
import configparser
|
||||||
@@ -468,6 +468,25 @@ class MikroTikManager(SSHManager):
|
|||||||
|
|
||||||
logger.info("✓ Certificate imported")
|
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)
|
time.sleep(2)
|
||||||
|
|
||||||
# Configure
|
# Configure
|
||||||
|
|||||||
Reference in New Issue
Block a user