Update2: Confirmed that my old NetScaler Console disabled ZTCM. Found in the old NS Console: Settings > Diagnostics > Device Log > Command Log (Task Log area)
set ssl zerotouchparm -zeroTouch DISABLED
I don't see any commands blatantly related to the cert key missing, but I don't doubt it was related. I had playing with on-prem NS Console, moved to Cloud, did not cleanup on-prem Console.
Update1: A day after fixing the first issue, my ZTCM got disabled. show ssl zerotouch was in disabled state and ZTCM in NS Console in Citrix Cloud was not configured. I'm not ruling out this being self-inflicted...
I had two instances of NS Console managing a single NetScaler instance. One Console was doing Gateway Insights; I had been putting off moving that functionality to NS Console in Citrix Cloud. I've not reviewed logs, but I assume it's possible that letting two NS Consoles manage a single NS instance is not good, so I unmanaged my NS from the on-prem Console to avoid potential conflicts.
ZTCM was not configured from the on-prem Console. It had been that way without issues for quite a while. I re-enabled ZTCM from Cloud Console and the functionality gracefully resumed (certs were automatically redeployed).
Original:
I ran into an interesting issue today and I'm posting this as information in case anyone else sees this. I'm running NetScaler 14.1 73.58 connected to NetScaler console in Citrix Cloud via an agent VM. The one vserver I have using ZTCM went down because the key was no longer associated with its updated certificate. This is a "test" vserver, so I wonder if I did something that set this issue in motion as I was learning ZTCM.
The cert comes from Let's Encrypt, but I don't remember all of the options I selected during the request; it was initially configured as Automatic (Zero Touch). I do know that it only renewed once after 59 days where it failed then succeeded after retrying the next day.
To find the issue I SSH'd to the NetScaler management IP and ran "show ssl certkey".
I located the cert for the affected vserver and saw this:
Certificate Source: REMOTE Certkey Status: INACTIVE(No Private Key)
That lead me to believe ZTCM somehow lost the key during a renewal even though a key was present in ZTCM and associated with the NS. I did have a self-signed cert in the NS with the same common name or SANs previously used with the affected vserver, so I wonder if that may have created a conflict. I removed my self-signed cert and I attempted to renew the cert through ZTCM/Let's Encrypt, but the private key issue persisted.
To resolve:
- Delete the relevant certificates from ZTCM (this also removes it from Issuance & Renewals)
- 1a. Let ZTCM cycle run on NetScaler to cleanup deleted certs to avoid conflicts
- Generate new cert from Let's Encrypt
- Associate cert with NetScaler and wait for synchronization
To monitor the ZTCM service cycle on the NS application, run:
show ssl zerotouch
Citrix has a list of things that can break ZTCM certificates:
https://docs.netscaler.com/us/en/citrix-adc/current-release/ssl/zero-touch-cert-manage.html#certificates-states-in-netscaler
I'm not 100% convinced this was a cert naming conflict since it initially worked. It's a concerning that the key was disconnected, but I'm hopeful that it won't be a recurring issue.