@@ -2173,21 +2173,29 @@ static void api_session_cb(ziti_api_session *api_sess, const ziti_error *err, vo
21732173 }
21742174 }
21752175
2176- // check if identity cert can and need to be extended
2177- if (ztx -> opts .cert_extension_window == 0 || ztx -> id_creds .cert == NULL ) {
2176+ if (ztx -> id_creds .cert == NULL ) {
21782177 goto done ;
21792178 }
21802179
2181- if (!api_sess -> is_cert_extendable ) {
2182- ZTX_LOG (DEBUG , "identity certificate is not renewable" );
2183- goto done ;
2184- }
2185-
2186- struct tm exp ;
21872180 if (api_sess -> cert_extend_requested || api_sess -> key_roll_requested ) {
21882181 ZTX_LOG (INFO , "controller requested certificate renewal (%s key roll)" ,
21892182 api_sess -> key_roll_requested ? "with" : "without" );
2190- } else {
2183+ goto extend ;
2184+ }
2185+
2186+ if (api_sess -> is_cert_improper ) {
2187+ ZTX_LOG (INFO , "controller reported certificate chain as incomplete" );
2188+ goto extend ;
2189+ }
2190+
2191+ // check if identity cert is expiring or expired
2192+ if (ztx -> opts .cert_extension_window > 0 ) {
2193+ if (!api_sess -> is_cert_extendable ) {
2194+ ZTX_LOG (DEBUG , "identity certificate is not renewable" );
2195+ goto done ;
2196+ }
2197+
2198+ struct tm exp ;
21912199 ztx -> id_creds .cert -> get_expiration (ztx -> id_creds .cert , & exp );
21922200 time_t now = time (0 );
21932201 time_t exptime = mktime (& exp );
@@ -2200,6 +2208,8 @@ static void api_session_cb(ziti_api_session *api_sess, const ziti_error *err, vo
22002208 1900 + exp .tm_year , exp .tm_mon + 1 , exp .tm_mday , exp .tm_hour , exp .tm_min );
22012209 }
22022210
2211+ extend :
2212+
22032213 if ((ztx -> opts .events & ZitiConfigEvent ) == 0 ) {
22042214 ZTX_LOG (WARN , "identity certificate needs to be renewed "
22052215 "but application is not handling ZitiConfigEvent" );
0 commit comments