Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
certman
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
Container registry
Model registry
Operate
Environments
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
IML Open Source
certman
Commits
1e76d807
Commit
1e76d807
authored
4 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
update renew: exit code 0 if renew was skipped
parent
97d071c9
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cm.sh
+24
-15
24 additions, 15 deletions
cm.sh
with
24 additions
and
15 deletions
cm.sh
+
24
−
15
View file @
1e76d807
...
...
@@ -44,11 +44,16 @@ function _listCerts(){
$ACME
--list
}
# internal function; get a list of fqdn of all existing certs
function
_listCertdomains
(){
_listCerts |
sed
-n
'2,$p'
|
awk
'{ print $1 }'
}
# internal function; checks if a certificate for a given FQDN already exists
# used in _certMustExist, _certMustNotExist
# param string FQDN
function
_certExists
(){
_listCert
s |
awk
'{ print $1 }'
|
grep
"^
${
CM_fqdn
}
$"
>
/dev/null
_listCert
domains
|
grep
"^
${
CM_fqdn
}
$"
>
/dev/null
}
# internal function; a certificate of a given FQDN must exist - otherwise
...
...
@@ -306,30 +311,34 @@ function public_list(){
function
public_renew
(){
_requiresFqdn
_certMustExist
$ACME
--renew
-d
${
CM_fqdn
}
$ACME_Params
||
exit
2
_certTransfer
_certMatching
$ACME
--renew
-d
${
CM_fqdn
}
$ACME_Params
local
_rc
=
$?
_update
"renewed
${
CM_fqdn
}
"
case
$_rc
in
0
)
_certTransfer
_certMatching
_update
"renewed
${
CM_fqdn
}
"
;;
2
)
_wd
"renew was skipped ... we need to wait a while."
;;
*
)
_wd
"Error ocured."
exit
$_rc
esac
}
#
# public function - renew al certificates (to be used in cronjo
n
)
# public function - renew al
l
certificates (to be used in
a
cronjo
b
)
# no params
function
public_renew-all
(){
_listCert
s |
sed
-n
'2,$p'
|
awk
'{ print $1 }'
|
while
read
mydomain
_listCert
domains
|
while
read
mydomain
do
_wd
"--- renew
$mydomain
"
_setenv
${
mydomain
}
$ACME
--renew
-d
${
CM_fqdn
}
$ACME_Params
if
[
$?
-eq
0
]
;
then
_certTransfer
_certMatching
_update
"renewed
${
CM_fqdn
}
"
fi
public_renew
done
}
...
...
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