Added NDPI_TLS_CERTIFICATE_EXPIRED, NDPI_TLS_CERTIFICATE_MISMATCH, to ndpi_risk
This commit is contained in:
@@ -60,17 +60,19 @@ typedef enum {
|
||||
NDPI_TLS_SELFSIGNED_CERTIFICATE,
|
||||
NDPI_TLS_OBSOLETE_VERSION,
|
||||
NDPI_TLS_WEAK_CIPHER,
|
||||
|
||||
NDPI_TLS_CERTIFICATE_EXPIRED,
|
||||
NDPI_TLS_CERTIFICATE_MISMATCH,
|
||||
|
||||
/* Leave this as last member */
|
||||
NDPI_MAX_RISK
|
||||
} ndpi_risk;
|
||||
|
||||
/* NDPI_VISIT */
|
||||
typedef enum {
|
||||
ndpi_preorder,
|
||||
ndpi_postorder,
|
||||
ndpi_endorder,
|
||||
ndpi_leaf
|
||||
ndpi_preorder,
|
||||
ndpi_postorder,
|
||||
ndpi_endorder,
|
||||
ndpi_leaf
|
||||
} ndpi_VISIT;
|
||||
|
||||
/* NDPI_NODE */
|
||||
|
||||
@@ -1432,6 +1432,12 @@ const char* ndpi_risk2str(ndpi_risk risk) {
|
||||
case NDPI_TLS_WEAK_CIPHER:
|
||||
return("Weak TLS cipher");
|
||||
|
||||
case NDPI_TLS_CERTIFICATE_EXPIRED:
|
||||
return("TLS Expired Certificate");
|
||||
|
||||
case NDPI_TLS_CERTIFICATE_MISMATCH:
|
||||
return("TLS Certificate Mismatch");
|
||||
|
||||
default:
|
||||
return("");
|
||||
}
|
||||
|
||||
@@ -127,7 +127,6 @@ static ndpi_protocol_category_t ndpi_http_check_content(struct ndpi_detection_mo
|
||||
for (int i = 0; binary_file_ext[i] != NULL; i++) {
|
||||
if (ndpi_strncasestr((const char*)&packet->content_disposition_line.ptr[attachment_len],
|
||||
binary_file_ext[i], filename_len)) {
|
||||
printf("got %s\n", binary_file_ext[i]);
|
||||
flow->guessed_category = flow->category = NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT;
|
||||
NDPI_SET_BIT_16(flow->risk, NDPI_BINARY_APPLICATION_TRANSFER);
|
||||
NDPI_LOG_INFO(ndpi_struct, "found executable HTTP transfer");
|
||||
|
||||
+17
-2
@@ -373,11 +373,17 @@ static void processCertificateElements(struct ndpi_detection_module_struct *ndpi
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if((flow->packet.tick_timestamp < flow->protos.stun_ssl.ssl.notBefore)
|
||||
|| (flow->packet.tick_timestamp > flow->protos.stun_ssl.ssl.notAfter))
|
||||
NDPI_SET_BIT_16(flow->risk, NDPI_TLS_CERTIFICATE_EXPIRED); /* Certificate expired */
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if((packet->payload[i] == 0x55) && (packet->payload[i+1] == 0x1d) && (packet->payload[i+2] == 0x11)) {
|
||||
/* Organization OID: 2.5.29.17 (subjectAltName) */
|
||||
u_int8_t matched_name = 0;
|
||||
|
||||
#ifdef DEBUG_TLS
|
||||
printf("******* [TLS] Found subjectAltName\n");
|
||||
#endif
|
||||
@@ -409,9 +415,15 @@ static void processCertificateElements(struct ndpi_detection_module_struct *ndpi
|
||||
cleanupServerName(dNSName, len);
|
||||
|
||||
#if DEBUG_TLS
|
||||
printf("[TLS] dNSName %s\n", dNSName);
|
||||
printf("[TLS] dNSName %s [%s]\n", dNSName, flow->protos.stun_ssl.ssl.client_requested_server_name);
|
||||
#endif
|
||||
|
||||
if(matched_name == 0) {
|
||||
if((dNSName[0] == '*') && strstr(flow->protos.stun_ssl.ssl.client_requested_server_name, &dNSName[1]))
|
||||
matched_name = 1;
|
||||
else if(strcmp(flow->protos.stun_ssl.ssl.client_requested_server_name, dNSName) == 0)
|
||||
matched_name = 1;
|
||||
}
|
||||
|
||||
if(flow->protos.stun_ssl.ssl.server_names == NULL)
|
||||
flow->protos.stun_ssl.ssl.server_names = ndpi_strdup(dNSName),
|
||||
flow->protos.stun_ssl.ssl.server_names_len = strlen(dNSName);
|
||||
@@ -446,6 +458,9 @@ static void processCertificateElements(struct ndpi_detection_module_struct *ndpi
|
||||
break;
|
||||
}
|
||||
} /* while */
|
||||
|
||||
if(!matched_name)
|
||||
NDPI_SET_BIT_16(flow->risk, NDPI_TLS_CERTIFICATE_MISMATCH); /* Certificate mismatch */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user