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
c140fe9b
Commit
c140fe9b
authored
Apr 27, 2017
by
thecantero
Committed by
Andre Cantero
Apr 27, 2017
Browse files
Typo Fix
parent
4b02ee5b
Changes
1
Hide whitespace changes
Inline
Side-by-side
deploy/kong.sh
View file @
c140fe9b
#!/usr/bin/env sh
# This deploy hook will deploy ssl cert on kong proxy engine based on api request_host parameter.
# Note that ssl plugin should be available on Kong instance
# Note that ssl plugin should be available on Kong instance
# The hook will match cdomain to request_host, in case of multiple domain it will always take the first
# The hook will match cdomain to request_host, in case of multiple domain it will always take the first
# one (acme.sh behaviour).
# one (acme.sh behaviour).
...
@@ -49,10 +46,9 @@ kong_deploy() {
...
@@ -49,10 +46,9 @@ kong_deploy() {
#Set Header
#Set Header
_H1
=
"Content-Type: multipart/form-data; boundary=
$delim
"
_H1
=
"Content-Type: multipart/form-data; boundary=
$delim
"
#Generate data for request (Multipart/form-data with mixed content)
#Generate data for request (Multipart/form-data with mixed content)
content
=
"--
$delim
${
nl
}
"
if
[
-z
"
$ssl_uuid
"
]
;
then
if
[
-z
"
$ssl_uuid
"
]
;
then
#set sni to domain
#set sni to domain
content
=
"
$content
{nl}Content-Disposition: form-data; name=
\"
snis
\"
${
nl
}${
nl
}
$_cdomain
"
content
=
"
--
$delim
$
{
nl
}
Content-Disposition: form-data; name=
\"
snis
\"
${
nl
}${
nl
}
$_cdomain
"
fi
fi
#add key
#add key
content
=
"
$content
${
nl
}
--
$delim
${
nl
}
Content-Disposition: form-data; name=
\"
key
\"
; filename=
\"
$(
basename
"
$_ckey
"
)
\"
${
nl
}
Content-Type: application/octet-stream
${
nl
}${
nl
}
$(
cat
"
$_ckey
"
)
"
content
=
"
$content
${
nl
}
--
$delim
${
nl
}
Content-Disposition: form-data; name=
\"
key
\"
; filename=
\"
$(
basename
"
$_ckey
"
)
\"
${
nl
}
Content-Type: application/octet-stream
${
nl
}${
nl
}
$(
cat
"
$_ckey
"
)
"
...
@@ -67,7 +63,7 @@ kong_deploy() {
...
@@ -67,7 +63,7 @@ kong_deploy() {
_debug content
"
$content
"
_debug content
"
$content
"
#Check if sslcreated (if not => POST else => PATCH)
#Check if sslcreated (if not => POST else => PATCH)
if
[
!
-z
"
$ssl_uuid
"
]
;
then
if
[
-z
"
$ssl_uuid
"
]
;
then
#Post certificate to Kong
#Post certificate to Kong
response
=
$(
_post
"
$content
"
"
$KONG_URL
/certificates"
""
"POST"
)
response
=
$(
_post
"
$content
"
"
$KONG_URL
/certificates"
""
"POST"
)
else
else
...
...
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