Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Acme Downloader
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Geant DevOps
Acme Downloader
Commits
42ed4fe2
Unverified
Commit
42ed4fe2
authored
3 years ago
by
Max Adamo
Browse files
Options
Downloads
Patches
Plain Diff
fixing wildcard certificates
parent
80824504
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
acme-downloader.sh
+8
-3
8 additions, 3 deletions
acme-downloader.sh
main.go
+18
-8
18 additions, 8 deletions
main.go
with
26 additions
and
11 deletions
acme-downloader.sh
+
8
−
3
View file @
42ed4fe2
...
...
@@ -190,10 +190,15 @@ if [[ $TYPE != "EV" ]] && [[ $TYPE != "OV" ]]; then
echo
"type must be either EV, ev, OV, ov"
usage
fi
if
[[
-z
$WILDCARD
]]
;
then
$MODIFIED_CERT_NAME
=
"wildcard_
${
CERT_NAME
}
"
else
$MODIFIED_CERT_NAME
=
$CERT_NAME
fi
[[
-z
$DAYS
]]
&&
DAYS
=
30
[[
-z
$CERT_DESTINATION
]]
&&
CERT_DESTINATION
=
"
${
CERT_BASE
}
/
${
CERT_NAME
}
.crt"
[[
-z
$FULLCHAIN_DESTINATION
]]
&&
FULLCHAIN_DESTINATION
=
"
${
CERT_BASE
}
/
${
CERT_NAME
}
_fullchain.crt"
[[
-z
$KEY_DESTINATION
]]
&&
KEY_DESTINATION
=
"
${
KEY_BASE
}
/
${
CERT_NAME
}
.key"
[[
-z
$CERT_DESTINATION
]]
&&
CERT_DESTINATION
=
"
${
CERT_BASE
}
/
${
MODIFIED_
CERT_NAME
}
.crt"
[[
-z
$FULLCHAIN_DESTINATION
]]
&&
FULLCHAIN_DESTINATION
=
"
${
CERT_BASE
}
/
${
MODIFIED_
CERT_NAME
}
_fullchain.crt"
[[
-z
$KEY_DESTINATION
]]
&&
KEY_DESTINATION
=
"
${
KEY_BASE
}
/
${
MODIFIED_
CERT_NAME
}
.key"
[[
-z
$CA_DESTINATION
]]
&&
CA_DESTINATION
=
"
${
CERT_BASE
}
/COMODO_
${
TYPE
}
.crt"
UNDERSCORED_CERT_NAME
=
$(
echo
$CERT_NAME
|
sed
-e
's,\.,_,g'
)
...
...
This diff is collapsed.
Click to expand it.
main.go
+
18
−
8
View file @
42ed4fe2
...
...
@@ -48,6 +48,7 @@ var (
RedisCertURL
string
RedisCAURL
string
RedisFullChainURL
string
modifiedCertName
string
certificateDestination
string
fullchainDestination
string
keyDestination
string
...
...
@@ -504,11 +505,20 @@ Options:
RedisBaseURL
=
"https://redis.geant.org/GET"
VaultBaseURL
=
"https://vault.geant.org/v1"
if
arguments
[
"--wildcard"
]
==
true
{
VaultURL
=
fmt
.
Sprintf
(
"%v/%v/common/vault_sectigo_ov_wildcard_%v_key"
,
VaultBaseURL
,
TeamName
,
CertNameUnderscored
)
RedisCertURL
=
fmt
.
Sprintf
(
"%v/%v:common:redis_sectigo_ov_%v_pem.txt"
,
RedisBaseURL
,
TeamName
,
CertNameUnderscored
)
RedisCAURL
=
fmt
.
Sprintf
(
"%v/%v:common:redis_sectigo_ov_%v_chain_pem.txt"
,
RedisBaseURL
,
TeamName
,
CertNameUnderscored
)
RedisFullChainURL
=
fmt
.
Sprintf
(
"%v/%v:common:redis_sectigo_ov_%v_fullchain_pem.txt"
,
RedisBaseURL
,
TeamName
,
CertNameUnderscored
)
modifiedCertName
=
fmt
.
Sprintf
(
"wildcard_%v"
,
CertName
)
if
TeamName
==
"puppet"
{
VaultURL
=
fmt
.
Sprintf
(
"%v/%v/common/vault_sectigo_ov_wildcard_%v_key"
,
VaultBaseURL
,
TeamName
,
CertNameUnderscored
)
RedisCertURL
=
fmt
.
Sprintf
(
"%v/%v:common:redis_sectigo_ov_%v_pem.txt"
,
RedisBaseURL
,
TeamName
,
CertNameUnderscored
)
RedisCAURL
=
fmt
.
Sprintf
(
"%v/%v:common:redis_sectigo_ov_%v_chain_pem.txt"
,
RedisBaseURL
,
TeamName
,
CertNameUnderscored
)
RedisFullChainURL
=
fmt
.
Sprintf
(
"%v/%v:common:redis_sectigo_ov_%v_fullchain_pem.txt"
,
RedisBaseURL
,
TeamName
,
CertNameUnderscored
)
}
else
{
VaultURL
=
fmt
.
Sprintf
(
"%v/%v/%v/vault_sectigo_ov_wildcard_%v_key"
,
VaultBaseURL
,
TeamName
,
CertName
,
CertNameUnderscored
)
RedisCertURL
=
fmt
.
Sprintf
(
"%v/%v:%v:redis_sectigo_ov_%v_pem.txt"
,
RedisBaseURL
,
TeamName
,
CertName
,
CertNameUnderscored
)
RedisCAURL
=
fmt
.
Sprintf
(
"%v/%v:%v:redis_sectigo_ov_%v_chain_pem.txt"
,
RedisBaseURL
,
TeamName
,
CertName
,
CertNameUnderscored
)
RedisFullChainURL
=
fmt
.
Sprintf
(
"%v/%v:%v:redis_sectigo_ov_%v_fullchain_pem.txt"
,
RedisBaseURL
,
TeamName
,
CertName
,
CertNameUnderscored
)
}
}
else
{
modifiedCertName
=
fmt
.
Sprintf
(
CertName
)
VaultURL
=
fmt
.
Sprintf
(
"%v/%v/%v/vault_%v_key"
,
VaultBaseURL
,
TeamName
,
CertName
,
CertNameUnderscored
)
RedisCertURL
=
fmt
.
Sprintf
(
"%v/%v:%v:redis_%v_pem.txt"
,
RedisBaseURL
,
TeamName
,
CertName
,
CertNameUnderscored
)
RedisCAURL
=
fmt
.
Sprintf
(
"%v/%v:%v:redis_%v_chain_pem.txt"
,
RedisBaseURL
,
TeamName
,
CertName
,
CertNameUnderscored
)
...
...
@@ -516,12 +526,12 @@ Options:
}
if
arguments
[
"--cert-destination"
]
==
fmt
.
Sprintf
(
filepath
.
Join
(
CertBase
,
"<cert-name>.crt"
))
{
certificateDestination
=
fmt
.
Sprintf
(
filepath
.
Join
(
CertBase
,
fmt
.
Sprintf
(
"%v.crt"
,
CertName
)))
certificateDestination
=
fmt
.
Sprintf
(
filepath
.
Join
(
CertBase
,
fmt
.
Sprintf
(
"%v.crt"
,
modified
CertName
)))
}
else
{
certificateDestination
=
arguments
[
"--cert-destination"
]
.
(
string
)
}
if
arguments
[
"--fullchain-destination"
]
==
fmt
.
Sprintf
(
filepath
.
Join
(
CertBase
,
"<cert-name>_fullchain.crt"
))
{
fullchainDestination
=
fmt
.
Sprintf
(
filepath
.
Join
(
CertBase
,
fmt
.
Sprintf
(
"%v_fullchain.crt"
,
CertName
)))
fullchainDestination
=
fmt
.
Sprintf
(
filepath
.
Join
(
CertBase
,
fmt
.
Sprintf
(
"%v_fullchain.crt"
,
modified
CertName
)))
}
else
{
fullchainDestination
=
arguments
[
"--fullchain-destination"
]
.
(
string
)
}
...
...
@@ -531,7 +541,7 @@ Options:
caDestination
=
arguments
[
"--ca-destination"
]
.
(
string
)
}
if
arguments
[
"--key-destination"
]
==
fmt
.
Sprintf
(
filepath
.
Join
(
KeyBase
,
"<cert-name>.key"
))
{
keyDestination
=
fmt
.
Sprintf
(
filepath
.
Join
(
KeyBase
,
fmt
.
Sprintf
(
"%v.key"
,
CertName
)))
keyDestination
=
fmt
.
Sprintf
(
filepath
.
Join
(
KeyBase
,
fmt
.
Sprintf
(
"%v.key"
,
modified
CertName
)))
}
else
{
keyDestination
=
arguments
[
"--key-destination"
]
.
(
string
)
}
...
...
@@ -564,7 +574,7 @@ Options:
moveFile
(
tmpKeyDestination
,
keyDestination
,
GroupID
,
0640
,
0750
)
// Exit 64: if we are here it means that the certificate was replaced
// and the application can be reloaded to make use of the new certificate
//
and the application can be reloaded to make use of the new certificate
appExit
(
64
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment