Fortinet white logo
Fortinet white logo

Script Reference Guide

SSL:cert(t)

SSL:cert(t)

Allows you to get the certificate information between local or remote.

Syntax

SSL:cert(t);

Arguments

Name Description

t

A table which specifies the certificate direction, and operation.

Events

Applicable in the following events:

  • BEFORE_AUTH

  • CLIENTSSL_HANDSHAKE

  • HTTP_REQUEST

  • SERVERSSL_HANDSHAKE

  • SERVERSSL_RENEGOTIATE

  • WAF_REQUEST_ATTACK_DETECTED

  • WAF_REQUEST_BEFORE_SCAN

Example

when CLIENTSSL_HANDSHAKE {
debug("client handshake\n")
t={}
t["direction"]="remote";
t["operation"]="index";
t["idx"]=0;
t["type"]="info";
cert=SSL:cert(t)
if cert then
debug("client has cert\n")
end
for k, v in pairs(cert) do
if k=="serial_number" or k=="digest" then
debug("cert info name %s, value in HEX %s\n", k, to_HEX(v));
else
debug("cert info name %s, value %s\n", k, v);
end
end
}

Note:

  • direction: local and remote. In CLIENTSSL_HANDSHAKE, local means FortiADC's cert, remote means client's cert.

  • operation: index, count, issuer

  • type: info, der, (pem)

This command returns a table that contains all the information in the certificate.
In the return, it contains: key_algorithm, hash, serial_number, not Before, not After, signature_algorithm, version, digest, issuer_name, subject_name, old_hash, pin-sha256, finger_print.

Supported Version

FortiADC version 5.0.x and later.

SSL:cert(t)

SSL:cert(t)

Allows you to get the certificate information between local or remote.

Syntax

SSL:cert(t);

Arguments

Name Description

t

A table which specifies the certificate direction, and operation.

Events

Applicable in the following events:

  • BEFORE_AUTH

  • CLIENTSSL_HANDSHAKE

  • HTTP_REQUEST

  • SERVERSSL_HANDSHAKE

  • SERVERSSL_RENEGOTIATE

  • WAF_REQUEST_ATTACK_DETECTED

  • WAF_REQUEST_BEFORE_SCAN

Example

when CLIENTSSL_HANDSHAKE {
debug("client handshake\n")
t={}
t["direction"]="remote";
t["operation"]="index";
t["idx"]=0;
t["type"]="info";
cert=SSL:cert(t)
if cert then
debug("client has cert\n")
end
for k, v in pairs(cert) do
if k=="serial_number" or k=="digest" then
debug("cert info name %s, value in HEX %s\n", k, to_HEX(v));
else
debug("cert info name %s, value %s\n", k, v);
end
end
}

Note:

  • direction: local and remote. In CLIENTSSL_HANDSHAKE, local means FortiADC's cert, remote means client's cert.

  • operation: index, count, issuer

  • type: info, der, (pem)

This command returns a table that contains all the information in the certificate.
In the return, it contains: key_algorithm, hash, serial_number, not Before, not After, signature_algorithm, version, digest, issuer_name, subject_name, old_hash, pin-sha256, finger_print.

Supported Version

FortiADC version 5.0.x and later.