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
6bbf927f
Commit
6bbf927f
authored
Jan 19, 2022
by
Ross Shen
Browse files
omv deploy hook: separate DEPLOY_OMV_WEBUI_ADMIN and DEPLOY_OMV_SSH_USER
parent
dca9def4
Changes
1
Hide whitespace changes
Inline
Side-by-side
deploy/openmediavault.sh
View file @
6bbf927f
...
@@ -23,25 +23,32 @@ openmediavault_deploy() {
...
@@ -23,25 +23,32 @@ openmediavault_deploy() {
DEPLOY_OMV_HOST
=
"
$_cdomain
"
DEPLOY_OMV_HOST
=
"
$_cdomain
"
fi
fi
_getdeployconf DEPLOY_OMV_
USER
_getdeployconf DEPLOY_OMV_
WEBUI_ADMIN
if
[
-z
"
$DEPLOY_OMV_USER
"
]
;
then
if
[
-z
"
$DEPLOY_OMV_WEBUI_ADMIN
"
]
;
then
DEPLOY_OMV_USER
=
"admin"
DEPLOY_OMV_WEBUI_ADMIN
=
"admin"
fi
_getdeployconf DEPLOY_OMV_SSH_USER
if
[
-z
"
$DEPLOY_OMV_SSH_USER
"
]
;
then
DEPLOY_OMV_SSH_USER
=
"root"
fi
fi
_savedeployconf DEPLOY_OMV_HOST
"
$DEPLOY_OMV_HOST
"
_savedeployconf DEPLOY_OMV_HOST
"
$DEPLOY_OMV_HOST
"
_savedeployconf DEPLOY_OMV_USER
"
$DEPLOY_OMV_USER
"
_savedeployconf DEPLOY_OMV_WEBUI_ADMIN
"
$DEPLOY_OMV_WEBUI_ADMIN
"
_savedeployconf DEPLOY_OMV_SSH_USER
"
$DEPLOY_OMV_SSH_USER
"
_command
=
"omv-rpc -u
$DEPLOY_OMV_
USER
'CertificateMgmt' 'getList' '{
\"
start
\"
: 0,
\"
limit
\"
: -1}' | jq -r '.data[] | select(.name==
\"
/CN='
$_cdomain
'
\"
) | .uuid'"
_command
=
"omv-rpc -u
$DEPLOY_OMV_
WEBUI_ADMIN
'CertificateMgmt' 'getList' '{
\"
start
\"
: 0,
\"
limit
\"
: -1}' | jq -r '.data[] | select(.name==
\"
/CN='
$_cdomain
'
\"
) | .uuid'"
# shellcheck disable=SC2086
# shellcheck disable=SC2086
_uuid
=
$(
ssh
"
root
@
$DEPLOY_OMV_HOST
"
"
$_command
"
)
_uuid
=
$(
ssh
"
$DEPLOY_OMV_SSH_USER
@
$DEPLOY_OMV_HOST
"
"
$_command
"
)
_debug _command
"
$_command
"
_debug _command
"
$_command
"
if
[
-z
"
$_uuid
"
]
;
then
if
[
-z
"
$_uuid
"
]
;
then
_info
"[OMV deploy-hook] Domain
$_cdomain
has no certificate in openmediavault, creating it!"
_info
"[OMV deploy-hook] Domain
$_cdomain
has no certificate in openmediavault, creating it!"
_command
=
"omv-rpc -u
$DEPLOY_OMV_
USER
'CertificateMgmt' 'create' '{
\"
cn
\"
:
\"
test.example.com
\"
,
\"
size
\"
: 4096,
\"
days
\"
: 3650,
\"
c
\"
:
\"\"
,
\"
st
\"
:
\"\"
,
\"
l
\"
:
\"\"
,
\"
o
\"
:
\"\"
,
\"
ou
\"
:
\"\"
,
\"
email
\"
:
\"\"
}' | jq -r '.uuid'"
_command
=
"omv-rpc -u
$DEPLOY_OMV_
WEBUI_ADMIN
'CertificateMgmt' 'create' '{
\"
cn
\"
:
\"
test.example.com
\"
,
\"
size
\"
: 4096,
\"
days
\"
: 3650,
\"
c
\"
:
\"\"
,
\"
st
\"
:
\"\"
,
\"
l
\"
:
\"\"
,
\"
o
\"
:
\"\"
,
\"
ou
\"
:
\"\"
,
\"
email
\"
:
\"\"
}' | jq -r '.uuid'"
# shellcheck disable=SC2086
# shellcheck disable=SC2086
_uuid
=
$(
ssh
"
root
@
$DEPLOY_OMV_HOST
"
"
$_command
"
)
_uuid
=
$(
ssh
"
$DEPLOY_OMV_SSH_USER
@
$DEPLOY_OMV_HOST
"
"
$_command
"
)
_debug _command
"
$_command
"
_debug _command
"
$_command
"
if
[
-z
"
$_uuid
"
]
;
then
if
[
-z
"
$_uuid
"
]
;
then
...
@@ -58,17 +65,17 @@ openmediavault_deploy() {
...
@@ -58,17 +65,17 @@ openmediavault_deploy() {
_debug _key
"
$_key
"
_debug _key
"
$_key
"
_info
"[OMV deploy-hook] Updating key and certificate in openmediavault"
_info
"[OMV deploy-hook] Updating key and certificate in openmediavault"
_command
=
"omv-rpc -u
$DEPLOY_OMV_
USER
'CertificateMgmt' 'set' '{
\"
uuid
\"
:
\"
$_uuid
\"
,
\"
certificate
\"
:
$_fullchain
,
\"
privatekey
\"
:
$_key
,
\"
comment
\"
:
\"
acme.sh deployed
$(
date
)
\"
}'"
_command
=
"omv-rpc -u
$DEPLOY_OMV_
WEBUI_ADMIN
'CertificateMgmt' 'set' '{
\"
uuid
\"
:
\"
$_uuid
\"
,
\"
certificate
\"
:
$_fullchain
,
\"
privatekey
\"
:
$_key
,
\"
comment
\"
:
\"
acme.sh deployed
$(
date
)
\"
}'"
# shellcheck disable=SC2029
# shellcheck disable=SC2029
_result
=
$(
ssh
"root@
$DEPLOY_OMV_HOST
"
"
$_command
"
)
_result
=
$(
ssh
"
$DEPLOY_OMV_SSH_USER
@
$DEPLOY_OMV_HOST
"
"
$_command
"
)
_debug _result
"
$_result
"
_debug _command
"
$_command
"
_debug _command
"
$_command
"
_debug _result
"
$_result
"
_info
"[OMV deploy-hook] Asking openmediavault to apply changes... (this could take some time, hang in there)"
_info
"[OMV deploy-hook] Asking openmediavault to apply changes... (this could take some time, hang in there)"
_command
=
"omv-rpc -u
$DEPLOY_OMV_
USER
'Config' 'applyChanges' '{
\"
modules
\"
:[],
\"
force
\"
: false}'"
_command
=
"omv-rpc -u
$DEPLOY_OMV_
WEBUI_ADMIN
'Config' 'applyChanges' '{
\"
modules
\"
:[],
\"
force
\"
: false}'"
# shellcheck disable=SC2029
# shellcheck disable=SC2029
_result
=
$(
ssh
"
root
@
$DEPLOY_OMV_HOST
"
"
$_command
"
)
_result
=
$(
ssh
"
$DEPLOY_OMV_SSH_USER
@
$DEPLOY_OMV_HOST
"
"
$_command
"
)
_debug _command
"
$_command
"
_debug _command
"
$_command
"
_debug _result
"
$_result
"
_debug _result
"
$_result
"
...
@@ -76,7 +83,7 @@ openmediavault_deploy() {
...
@@ -76,7 +83,7 @@ openmediavault_deploy() {
_info
"[OMV deploy-hook] Asking nginx to reload"
_info
"[OMV deploy-hook] Asking nginx to reload"
_command
=
"nginx -s reload"
_command
=
"nginx -s reload"
# shellcheck disable=SC2029
# shellcheck disable=SC2029
_result
=
$(
ssh
"
root
@
$DEPLOY_OMV_HOST
"
"
$_command
"
)
_result
=
$(
ssh
"
$DEPLOY_OMV_SSH_USER
@
$DEPLOY_OMV_HOST
"
"
$_command
"
)
_debug _command
"
$_command
"
_debug _command
"
$_command
"
_debug _result
"
$_result
"
_debug _result
"
$_result
"
...
...
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