Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
205e95a2
Commit
205e95a2
authored
Feb 10, 2022
by
Mac_Zhou
Browse files
Add environment variables ROUTER_OS_PORT
parent
2c2a43e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
deploy/routeros.sh
View file @
205e95a2
...
...
@@ -23,6 +23,7 @@
# ```sh
# export ROUTER_OS_USERNAME=certuser
# export ROUTER_OS_HOST=router.example.com
# export ROUTER_OS_PORT=22
#
# acme.sh --deploy -d ftp.example.com --deploy-hook routeros
# ```
...
...
@@ -80,6 +81,13 @@ routeros_deploy() {
return
1
fi
_getdeployconf ROUTER_OS_PORT
if
[
-z
"
$ROUTER_OS_PORT
"
]
;
then
_debug
"Using default port 22 as ROUTER_OS_PORT, please set if not correct."
ROUTER_OS_PORT
=
22
fi
_getdeployconf ROUTER_OS_ADDITIONAL_SERVICES
if
[
-z
"
$ROUTER_OS_ADDITIONAL_SERVICES
"
]
;
then
...
...
@@ -89,12 +97,13 @@ routeros_deploy() {
_savedeployconf ROUTER_OS_HOST
"
$ROUTER_OS_HOST
"
_savedeployconf ROUTER_OS_USERNAME
"
$ROUTER_OS_USERNAME
"
_savedeployconf ROUTER_OS_PORT
"
$ROUTER_OS_PORT
"
_savedeployconf ROUTER_OS_ADDITIONAL_SERVICES
"
$ROUTER_OS_ADDITIONAL_SERVICES
"
_info
"Trying to push key '
$_ckey
' to router"
scp
"
$_ckey
"
"
$ROUTER_OS_USERNAME
@
$ROUTER_OS_HOST
:
$_cdomain
.key"
scp
-P
"
$ROUTER_OS_PORT
"
"
$_ckey
"
"
$ROUTER_OS_USERNAME
@
$ROUTER_OS_HOST
:
$_cdomain
.key"
_info
"Trying to push cert '
$_cfullchain
' to router"
scp
"
$_cfullchain
"
"
$ROUTER_OS_USERNAME
@
$ROUTER_OS_HOST
:
$_cdomain
.cer"
scp
-P
"
$ROUTER_OS_PORT
"
"
$_cfullchain
"
"
$ROUTER_OS_USERNAME
@
$ROUTER_OS_HOST
:
$_cdomain
.cer"
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;
\
\n
/certificate remove [ find name=
$_cdomain
.cer_0 ];
\
...
...
@@ -111,11 +120,11 @@ source=\"## generated by routeros deploy script in acme.sh;\
\n\"
"
# shellcheck disable=SC2029
ssh
"
$ROUTER_OS_USERNAME
@
$ROUTER_OS_HOST
"
"
$DEPLOY_SCRIPT_CMD
"
ssh
-p
"
$ROUTER_OS_PORT
"
"
$ROUTER_OS_USERNAME
@
$ROUTER_OS_HOST
"
"
$DEPLOY_SCRIPT_CMD
"
# shellcheck disable=SC2029
ssh
"
$ROUTER_OS_USERNAME
@
$ROUTER_OS_HOST
"
"/system script run
\"
LE Cert Deploy -
$_cdomain
\"
"
ssh
-p
"
$ROUTER_OS_PORT
"
"
$ROUTER_OS_USERNAME
@
$ROUTER_OS_HOST
"
"/system script run
\"
LE Cert Deploy -
$_cdomain
\"
"
# shellcheck disable=SC2029
ssh
"
$ROUTER_OS_USERNAME
@
$ROUTER_OS_HOST
"
"/system script remove
\"
LE Cert Deploy -
$_cdomain
\"
"
ssh
-p
"
$ROUTER_OS_PORT
"
"
$ROUTER_OS_USERNAME
@
$ROUTER_OS_HOST
"
"/system script remove
\"
LE Cert Deploy -
$_cdomain
\"
"
return
0
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment