|
|
@ -1,4 +1,4 @@ |
|
|
#!/usr/bin/env sh |
|
|
|
|
|
|
|
|
#!/bin/bash |
|
|
|
|
|
|
|
|
# Here is a script to deploy cert to routeros router. |
|
|
# Here is a script to deploy cert to routeros router. |
|
|
# Deploy the cert to remote routeros |
|
|
# Deploy the cert to remote routeros |
|
|
@ -144,21 +144,21 @@ routeros_deploy() { |
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
DEPLOY_SCRIPT_CMD="/system script add name=\"LE Cert Deploy - $_cdomain\" owner=admin policy=ftp,read,write,password,sensitive |
|
|
|
|
|
source=\"## generated by routeros deploy script in acme.sh\r\n |
|
|
|
|
|
\r\n /certificate remove [ find name=$_cdomain.cer_0 ] |
|
|
|
|
|
\r\n /certificate remove [ find name=$_cdomain.cer_1 ] |
|
|
|
|
|
\r\n delay 1 |
|
|
|
|
|
\r\n /certificate import file-name=$_cdomain.cer passphrase=\\\"\\\" |
|
|
|
|
|
\r\n /certificate import file-name=$_cdomain.key passphrase=\\\"\\\" |
|
|
|
|
|
\r\n delay 1 |
|
|
|
|
|
\r\n /file remove $_cdomain.cer |
|
|
|
|
|
\r\n /file remove $_cdomain.key |
|
|
|
|
|
\r\n delay 2 |
|
|
|
|
|
|
|
|
DEPLOY_SCRIPT_CMD="/system script add name=\"LE Cert Deploy - $_cdomain\" owner=admin policy=ftp,read,write,password,sensitive \ |
|
|
|
|
|
source=\"## generated by routeros deploy script in acme.sh\r\n\ |
|
|
|
|
|
\r\n /certificate remove [ find name=$_cdomain.cer_0 ]\ |
|
|
|
|
|
\r\n /certificate remove [ find name=$_cdomain.cer_1 ]\ |
|
|
|
|
|
\r\n delay 1\ |
|
|
|
|
|
\r\n /certificate import file-name=$_cdomain.cer passphrase=\\\"\\\"\ |
|
|
|
|
|
\r\n /certificate import file-name=$_cdomain.key passphrase=\\\"\\\"\ |
|
|
|
|
|
\r\n delay 1\ |
|
|
|
|
|
\r\n /file remove $_cdomain.cer\ |
|
|
|
|
|
\r\n /file remove $_cdomain.key\ |
|
|
|
|
|
\r\n delay 2\ |
|
|
$router_os_services\"" |
|
|
$router_os_services\"" |
|
|
|
|
|
|
|
|
# shellcheck disable=SC2029 |
|
|
# shellcheck disable=SC2029 |
|
|
ssh "$Le_router_os_username@$Le_router_os_host" $DEPLOY_SCRIPT_CMD |
|
|
|
|
|
|
|
|
ssh "$Le_router_os_username@$Le_router_os_host" "$DEPLOY_SCRIPT_CMD" |
|
|
# shellcheck disable=SC2029 |
|
|
# shellcheck disable=SC2029 |
|
|
ssh "$Le_router_os_username@$Le_router_os_host" "/system script run \"LE Cert Deploy - $_cdomain\"" |
|
|
ssh "$Le_router_os_username@$Le_router_os_host" "/system script run \"LE Cert Deploy - $_cdomain\"" |
|
|
# shellcheck disable=SC2029 |
|
|
# shellcheck disable=SC2029 |
|
|
|