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
79664715
Commit
79664715
authored
Jul 10, 2017
by
Santeri
Committed by
GitHub
Jul 10, 2017
Browse files
Removed double quotes from _opt
Broke GoDaddy cpanel causing error (thanks Hedgehog)
parent
6c3430b6
Changes
1
Show whitespace changes
Inline
Side-by-side
deploy/cpanel.sh
View file @
79664715
#!/
bin/ba
sh
#!/
usr/bin/env
sh
# Here is the script to deploy the cert to your cpanel using the cpanel API.
# Here is the script to deploy the cert to your cpanel using the cpanel API.
# Uses command line uapi. Cpanel username is needed only when run as root.
# Uses command line uapi.
# Returns 0 when success, otherwise error.
# Cpanel username is needed only when run as root (I did not test this).
# Returns 0 when success.
# Written by Santeri Kannisto <santeri.kannisto@2globalnomads.info>
# Written by Santeri Kannisto <santeri.kannisto@2globalnomads.info>
# Public domain, 2017
# Public domain, 2017
#export DEPLOY_CPANEL_USER=myusername
#export DEPLOY_CPANEL_USER=myusername
#export DEPLOY_CPANEL_PASSWORD=PASSWORD
######## Public functions #####################
######## Public functions #####################
...
@@ -26,32 +26,28 @@ cpanel_deploy() {
...
@@ -26,32 +26,28 @@ cpanel_deploy() {
_debug _cfullchain
"
$_cfullchain
"
_debug _cfullchain
"
$_cfullchain
"
# read cert and key files and urlencode both
# read cert and key files and urlencode both
_certstr
=
`
cat
"
$_ccert
"
`
_certstr
=
$(
cat
"
$_ccert
"
)
_keystr
=
`
cat
"
$_ckey
"
`
_keystr
=
$(
cat
"
$_ckey
"
)
_cert
=
$(
php
-r
"echo urlencode(
\"
$_certstr
\"
);"
)
_cert
=
$(
php
-r
"echo urlencode(
\"
$_certstr
\"
);"
)
_key
=
$(
php
-r
"echo urlencode(
\"
$_keystr
\"
);"
)
_key
=
$(
php
-r
"echo urlencode(
\"
$_keystr
\"
);"
)
_debug _cert
"
$_cert
"
_debug _cert
"
$_cert
"
_debug _key
"
$_key
"
_debug _key
"
$_key
"
if
[[
$EUID
-eq
0
]]
if
[
"
$(
id
-u
)
"
=
0
]
;
then
then
_opt
=
"--user=
$DEPLOY_CPANEL_USER
"
_opt
=
"--user=
$DEPLOY_CPANEL_USER
SSL install_ssl"
else
_opt
=
"SSL install_ssl"
fi
_debug _opt
"
$_opt
"
_debug _opt
"
$_opt
"
fi
response
=
$(
uapi
$_opt
domain
=
"
$_cdom
m
ain
"
cert
=
"
$_cert
"
key
=
"
$_key
"
)
_
response
=
$(
uapi
$_opt
SSL install_ssl
domain
=
"
$_cdomain
"
cert
=
"
$_cert
"
key
=
"
$_key
"
)
if
[
$?
-ne
0
]
if
[
$?
-ne
0
]
;
then
then
_err
"Error in deploying certificate:"
_err
"Error in deploying certificate:"
_err
"
$response
"
_err
"
$
_
response
"
return
1
return
1
fi
fi
_debug response
"
$response
"
_debug response
"
$
_
response
"
_info
"Certificate successfully deployed"
_info
"Certificate successfully deployed"
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