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
f158caa2
Commit
f158caa2
authored
Feb 06, 2017
by
David Kerr
Browse files
Updates from code review
parent
e02c94eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
deploy/sshdeploy.sh
View file @
f158caa2
...
...
@@ -3,7 +3,7 @@
# Script to deploy certificates to remote server by SSH
# Note that SSH must be able to login to remote host without a password...
# SSH Keys must have been exchanged with the remote host. Validate and
# test that you can login to USER@
URL
from the host running acme.sh before
# test that you can login to USER@
SERVER
from the host running acme.sh before
# using this script.
#
# The following variables exported from environment will be used.
...
...
@@ -13,7 +13,8 @@
#
# The following examples are for QNAP NAS running QTS 4.2
# export ACME_DEPLOY_SSH_USER="admin"
# export ACME_DEPLOY_SSH_URL="qnap"
# export ACME_DEPLOY_SSH_SERVER="qnap"
# export ACME_DEPLOY_SSH_PORT="22"
# export ACME_DEPLOY_SSH_SERVICE_STOP=""
# export ACME_DEPLOY_SSH_KEYFILE="/etc/stunnel/stunnel.pem"
# export ACME_DEPLOY_SSH_CERTFILE="/etc/stunnel/stunnel.pem"
...
...
@@ -34,7 +35,7 @@ sshdeploy_deploy() {
_cmdstr
=
""
_homedir
=
'~'
_backupprefix
=
"
$_homedir
/.acme_ssh_deploy/certs-backup"
_backupdir
=
"
$_backupprefix
-
$(
date
+%Y%m%d%H%M%S
)
"
_backupdir
=
"
$_backupprefix
-
$(
_utc_date |
tr
' '
'-'
)
"
if
[
-f
"
$DOMAIN_CONF
"
]
;
then
# shellcheck disable=SC1090
...
...
@@ -58,15 +59,23 @@ sshdeploy_deploy() {
_savedomainconf Le_Deploy_ssh_user
"
$Le_Deploy_ssh_user
"
fi
#
URL
is optional.
If not provided then use _cdomain
if
[
-n
"
$ACME_DEPLOY_SSH_
URL
"
]
;
then
Le_Deploy_ssh_
url
=
"
$ACME_DEPLOY_SSH_
URL
"
_savedomainconf Le_Deploy_ssh_
url
"
$Le_Deploy_ssh_
url
"
elif
[
-z
"
$Le_Deploy_ssh_
url
"
]
;
then
Le_Deploy_ssh_
url
=
"
$_cdomain
"
#
SERVER
is optional. If not provided then use _cdomain
if
[
-n
"
$ACME_DEPLOY_SSH_
SERVER
"
]
;
then
Le_Deploy_ssh_
server
=
"
$ACME_DEPLOY_SSH_
SERVER
"
_savedomainconf Le_Deploy_ssh_
server
"
$Le_Deploy_ssh_
server
"
elif
[
-z
"
$Le_Deploy_ssh_
server
"
]
;
then
Le_Deploy_ssh_
server
=
"
$_cdomain
"
fi
_info
"Deploy certificates to remote server
$Le_Deploy_ssh_user
@
$Le_Deploy_ssh_url
"
# PORT is optional. If not provided then use port 22
if
[
-n
"
$ACME_DEPLOY_SSH_PORT
"
]
;
then
Le_Deploy_ssh_port
=
"
$ACME_DEPLOY_SSH_PORT
"
_savedomainconf Le_Deploy_ssh_port
"
$Le_Deploy_ssh_port
"
elif
[
-z
"
$Le_Deploy_ssh_port
"
]
;
then
Le_Deploy_ssh_port
=
"22"
fi
_info
"Deploy certificates to remote server
$Le_Deploy_ssh_user
@
$Le_Deploy_ssh_server
on port
$Le_Deploy_ssh_port
"
# SERVICE_STOP is optional.
# If provided then this command will be executed on remote host.
...
...
@@ -190,7 +199,7 @@ sshdeploy_deploy() {
_info
"Submitting sequence of commands to remote server by ssh"
# quotations in bash cmd below intended. Squash travis spellcheck error
# shellcheck disable=SC2029
ssh
-T
"
$Le_Deploy_ssh_user
@
$Le_Deploy_ssh_
url
"
ba
sh
-c
"'
$_cmdstr
'"
ssh
-T
-p
"
$Le_Deploy_ssh_port
"
"
$Le_Deploy_ssh_user
@
$Le_Deploy_ssh_
server
"
sh
-c
"'
$_cmdstr
'"
return
0
return
$?
}
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