1
0
Fork 0
mirror of synced 2024-12-18 04:29:46 -05:00

Merge pull request #137 from miklezzzz/master

fix absent labels for secrets
This commit is contained in:
Ilya Sosnovsky 2022-09-01 14:42:26 +03:00 committed by GitHub
commit 7db35753ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -194,6 +194,7 @@ func (openVPNPKI *OpenVPNPKI) initPKI() (err error) {
Name: secretServer, Name: secretServer,
Labels: map[string]string{ Labels: map[string]string{
"index.txt": "", "index.txt": "",
"name": "server",
"type": "serverAuth", "type": "serverAuth",
}, },
} }
@ -230,11 +231,11 @@ func (openVPNPKI *OpenVPNPKI) indexTxtUpdate() (err error) {
log.Trace(cert.Subject.CommonName) log.Trace(cert.Subject.CommonName)
if secret.Annotations["revokedAt"] == "" { if secret.Annotations["revokedAt"] == "" {
indexTxt += fmt.Sprintf("%s\t%s\t\t%s\t%s\t%s\n", "V", cert.NotAfter.Format(indexTxtDateFormat), fmt.Sprintf("%d", cert.SerialNumber), "unknown", "/CN="+secret.Annotations["name"]) indexTxt += fmt.Sprintf("%s\t%s\t\t%s\t%s\t%s\n", "V", cert.NotAfter.Format(indexTxtDateFormat), fmt.Sprintf("%d", cert.SerialNumber), "unknown", "/CN="+secret.Labels["name"])
} else if cert.NotAfter.Before(time.Now()) { } else if cert.NotAfter.Before(time.Now()) {
indexTxt += fmt.Sprintf("%s\t%s\t\t%s\t%s\t%s\n", "E", cert.NotAfter.Format(indexTxtDateFormat), fmt.Sprintf("%d", cert.SerialNumber), "unknown", "/CN="+secret.Annotations["name"]) indexTxt += fmt.Sprintf("%s\t%s\t\t%s\t%s\t%s\n", "E", cert.NotAfter.Format(indexTxtDateFormat), fmt.Sprintf("%d", cert.SerialNumber), "unknown", "/CN="+secret.Labels["name"])
} else { } else {
indexTxt += fmt.Sprintf("%s\t%s\t%s\t%s\t%s\t%s\n", "R", cert.NotAfter.Format(indexTxtDateFormat), secret.Annotations["revokedAt"], fmt.Sprintf("%d", cert.SerialNumber), "unknown", "/CN="+secret.Annotations["name"]) indexTxt += fmt.Sprintf("%s\t%s\t%s\t%s\t%s\t%s\n", "R", cert.NotAfter.Format(indexTxtDateFormat), secret.Annotations["revokedAt"], fmt.Sprintf("%d", cert.SerialNumber), "unknown", "/CN="+secret.Labels["name"])
} }
} }