Skip to content

Commit

Permalink
fix(provider/init): check local cert expiration (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
andy108369 authored Feb 19, 2024
1 parent 4ef9e95 commit dc8513c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/akash-provider/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type: application
# Versions are expected to follow Semantic Versioning (https://semver.org/)

# Major version bit highlights the mainnet release (e.g. mainnet4 = 4.x.x, mainnet5 = 5.x.x, ...)
version: 8.0.1
version: 8.0.2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
9 changes: 9 additions & 0 deletions charts/akash-provider/scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@ if [[ $rc -ne 0 ]]; then
GEN_NEW_CERT=0
fi

# check if current local cert has expired
# TODO: should probably add a healthCheck which would keep doing this every 5 minutes to bounce the pod if cert got expired
openssl x509 -checkend 604800 -noout -in "${CERT_REAL_PATH}" 2>/dev/null 1>&2
rc=$?
if [[ $rc -ne 0 ]]; then
echo "Certificate expires in less than 7 days, so going to generate a new one."
GEN_NEW_CERT=0
fi

if [[ "$GEN_NEW_CERT" -eq "0" ]]; then
echo "Removing the old certificate before generating a new one"
# It's also a good idea to delete it as otherwise, we'd have to add `--overwrite` to `provider-services tx cert generate server` command later.
Expand Down

0 comments on commit dc8513c

Please sign in to comment.