Skip to content

Commit

Permalink
upload-certificate: cleanup old certificate config
Browse files Browse the repository at this point in the history
An uploaded custom certificate has precedence over a requested one. If
the same domain was requested before, the old configuration must be
cleaned.
  • Loading branch information
Amygos committed Aug 5, 2024
1 parent 7fd7092 commit cfa5fe6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions imageroot/actions/upload-certificate/22save_certificates
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,17 @@ cn_name=$(openssl x509 -noout -subject -nameopt=multiline -in $CERT_FILE | sed -
cp $KEY_FILE "custom_certificates/$cn_name.key"
cp $CERT_FILE "custom_certificates/$cn_name.crt"

#clenaup existing requested certificate if exists
if [ -f "configs/certificate-${cn_name}.yml" ]; then
rm -f "configs/certificate-${cn_name}.yml"
fi

# write configuration file for certificate
cat >"configs/certificate_${cn_name}.yml" <<EOF
tls:
certificates:
- certFile: /etc/traefik/custom_certificates/$cn_name.crt
keyFile: /etc/traefik/custom_certificates/$cn_name.key
EOF


0 comments on commit cfa5fe6

Please sign in to comment.