Skip to content

Commit df564ed

Browse files
committed
add check for improper cert chain
restructure extension checks
1 parent 1fb3204 commit df564ed

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

library/ziti.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2177,6 +2177,12 @@ static void api_session_cb(ziti_api_session *api_sess, const ziti_error *err, vo
21772177
goto done;
21782178
}
21792179

2180+
// it is a 3rd party cert, no need for the rest of checks
2181+
if (!api_sess->is_cert_extendable) {
2182+
ZTX_LOG(DEBUG, "identity certificate is not renewable");
2183+
goto done;
2184+
}
2185+
21802186
if (api_sess->cert_extend_requested || api_sess->key_roll_requested) {
21812187
ZTX_LOG(INFO, "controller requested certificate renewal (%s key roll)",
21822188
api_sess->key_roll_requested ? "with" : "without");
@@ -2190,11 +2196,6 @@ static void api_session_cb(ziti_api_session *api_sess, const ziti_error *err, vo
21902196

21912197
// check if identity cert is expiring or expired
21922198
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-
21982199
struct tm exp;
21992200
ztx->id_creds.cert->get_expiration(ztx->id_creds.cert, &exp);
22002201
time_t now = time(0);

0 commit comments

Comments
 (0)