mirror of
https://github.com/flant/ovpn-admin.git
synced 2026-02-04 01:10:22 -08:00
Merge b85931184da1c5f2f8a96163f74e899b2a0a2275 into d74e7f8313bbd726ebfd1908a182fdbdf751fcdb
This commit is contained in:
commit
7f830f0dec
@ -32,7 +32,7 @@ const (
|
|||||||
privKeyFileName = "tls.key"
|
privKeyFileName = "tls.key"
|
||||||
)
|
)
|
||||||
|
|
||||||
//<year><month><day><hour><minute><second>Z
|
// <year><month><day><hour><minute><second>Z
|
||||||
const indexTxtDateFormat = "060102150405Z"
|
const indexTxtDateFormat = "060102150405Z"
|
||||||
|
|
||||||
var namespace = "default"
|
var namespace = "default"
|
||||||
@ -230,6 +230,16 @@ func (openVPNPKI *OpenVPNPKI) indexTxtUpdate() (err error) {
|
|||||||
|
|
||||||
log.Trace(cert.Subject.CommonName)
|
log.Trace(cert.Subject.CommonName)
|
||||||
|
|
||||||
|
// Fix for old secrets, added label name if not exists
|
||||||
|
labelName := secret.Labels["name"]
|
||||||
|
if labelName == "" {
|
||||||
|
secret.Labels["name"] = cert.Subject.CommonName
|
||||||
|
_, err = openVPNPKI.KubeClient.CoreV1().Secrets(namespace).Update(context.TODO(), &secret, metav1.UpdateOptions{})
|
||||||
|
if err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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.Labels["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()) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user