// the certificate has been deleted from disk or is otherwise corrupt
// the certificate has been deleted from disk or is otherwise corrupt
ifnow.After(lastCertAvailable.Add(exitAfter)){
ifnow.After(lastCertAvailable.Add(exitAfter)){
ifclientCertificateManager.ServerHealthy(){
ifclientCertificateManager.ServerHealthy(){
glog.Fatalf("It has been %s since a valid client cert was found and the server is responsive, exiting.",exitAfter)
glog.Fatalf("It has been %s since a valid client cert was found and the server is responsive, exiting.",exitAfter)
}else{
}else{
glog.Errorf("It has been %s since a valid client cert was found, but the server is not responsive. A restart may be necessary to retrieve new initial credentials.",exitAfter)
glog.Errorf("It has been %s since a valid client cert was found, but the server is not responsive. A restart may be necessary to retrieve new initial credentials.",exitAfter)
}
}
}
}
}else{
}else{
// the certificate is expired
// the certificate is expired
ifnow.After(curr.Leaf.NotAfter){
ifnow.After(curr.Leaf.NotAfter){
ifclientCertificateManager.ServerHealthy(){
ifclientCertificateManager.ServerHealthy(){
glog.Fatalf("The currently active client certificate has expired and the server is responsive, exiting.")
glog.Fatalf("The currently active client certificate has expired and the server is responsive, exiting.")
}else{
}else{
glog.Errorf("The currently active client certificate has expired, but the server is not responsive. A restart may be necessary to retrieve new initial credentials.")
glog.Errorf("The currently active client certificate has expired, but the server is not responsive. A restart may be necessary to retrieve new initial credentials.")
}
}
}
lastCertAvailable=now
}
}
lastCertAvailable=now
}
}
}
ifcurr==nil||lastCert==curr{
// Cert hasn't been rotated.
return
}
lastCert=curr
glog.Infof("certificate rotation detected, shutting down client connections to start using new credentials")
ifcurr==nil||lastCert==curr{
// The cert has been rotated. Close all existing connections to force the client