@@ -2137,28 +2137,38 @@ static void api_session_cb(ziti_api_session *api_sess, const ziti_error *err, vo
2137
2137
goto done ;
2138
2138
}
2139
2139
2140
- struct tm exp ;
2141
- ztx -> id_creds .cert -> get_expiration (ztx -> id_creds .cert , & exp );
2142
- time_t now = time (0 );
2143
- time_t exptime = mktime (& exp );
2144
-
2145
- bool renew = exptime - now < ztx -> opts .cert_extension_window * ONE_DAY ;
2146
- if (!renew ) {
2140
+ if (!api_sess -> is_cert_extendable ) {
2141
+ ZTX_LOG (DEBUG , "identity certificate is not renewable" );
2147
2142
goto done ;
2148
2143
}
2149
2144
2150
- if (!api_sess -> is_cert_extendable ) {
2151
- ZTX_LOG (WARN , "identity certificate is not renewable" );
2152
- goto done ;
2145
+ struct tm exp ;
2146
+ if (api_sess -> cert_extend_requested || api_sess -> key_roll_requested ) {
2147
+ ZTX_LOG (INFO , "controller requested certificate renewal (%s key roll)" ,
2148
+ api_sess -> key_roll_requested ? "with" : "without" );
2149
+ } else {
2150
+ ztx -> id_creds .cert -> get_expiration (ztx -> id_creds .cert , & exp );
2151
+ time_t now = time (0 );
2152
+ time_t exptime = mktime (& exp );
2153
+
2154
+ bool renew = exptime - now < ztx -> opts .cert_extension_window * ONE_DAY ;
2155
+ if (!renew ) {
2156
+ goto done ;
2157
+ }
2158
+ ZTX_LOG (INFO , "renewing identity certificate exp[%04d-%02d-%02d %02d:%02d]" ,
2159
+ 1900 + exp .tm_year , exp .tm_mon + 1 , exp .tm_mday , exp .tm_hour , exp .tm_min );
2153
2160
}
2154
2161
2155
2162
if ((ztx -> opts .events & ZitiConfigEvent ) == 0 ) {
2156
- ZTX_LOG (WARN , "identity certificate needs to be renewed but application is not handling ZitiConfigEvent" );
2163
+ ZTX_LOG (WARN , "identity certificate needs to be renewed "
2164
+ "but application is not handling ZitiConfigEvent" );
2157
2165
goto done ;
2158
2166
}
2159
2167
2160
- ZTX_LOG (INFO , "renewing identity certificate exp[%04d-%02d-%02d %02d:%02d]" ,
2161
- 1900 + exp .tm_year , exp .tm_mon + 1 , exp .tm_mday , exp .tm_hour , exp .tm_min );
2168
+ if (api_sess -> key_roll_requested ) {
2169
+ ZTX_LOG (WARN , "key roll requested, but not yet supported" );
2170
+ }
2171
+
2162
2172
if (ztx -> tlsCtx -> generate_csr_to_pem (ztx -> id_creds .key , & csr , & len , "O" , "OpenZiti" ,
2163
2173
"DC" , ztx -> config .controller_url ,
2164
2174
"CN" , api_sess -> identity_id ,
0 commit comments