Fortinet white logo
Fortinet white logo

Script Reference Guide

SSL:sni()

SSL:sni()

Returns the SNI or false (if no SNI).

Syntax

SSL:sni();

Arguments

N/A

Events

Applicable in the following events:

  • CLIENTSSL_HANDSHAKE

  • SERVERSSL_HANDSHAKE

  • CLIENTSSL_RENEGOTIATE

  • SERVERSSL_RENEGOTIATE

Example

when CLIENTSSL_HANDSHAKE {
debug("client handshake\n")
cc=SSL:sni();
debug("SNI: %s \n",cc);
}
Result:

Enable sni in client-ssl-profile

config load-balance client-ssl-profile

edit "csp"

set client-sni-required enable

next

end

  1. Client sends HTTPS request without SNI:
    [root@NxLinux certs]# openssl s_client -connect 5.1.1.100:443
    Debug output:
    Client handshake
    SNI: false
  2. Client sends HTTPS request with SNI:
    openssl s_client -connect 5.1.1.100:443 -servername 4096-rootca-rsa-server1
    debug output :
    client handshake
    SNI: 4096-rootca-rsa-server1

Supported Version

FortiADC version 5.0.x and later.

SSL:sni()

SSL:sni()

Returns the SNI or false (if no SNI).

Syntax

SSL:sni();

Arguments

N/A

Events

Applicable in the following events:

  • CLIENTSSL_HANDSHAKE

  • SERVERSSL_HANDSHAKE

  • CLIENTSSL_RENEGOTIATE

  • SERVERSSL_RENEGOTIATE

Example

when CLIENTSSL_HANDSHAKE {
debug("client handshake\n")
cc=SSL:sni();
debug("SNI: %s \n",cc);
}
Result:

Enable sni in client-ssl-profile

config load-balance client-ssl-profile

edit "csp"

set client-sni-required enable

next

end

  1. Client sends HTTPS request without SNI:
    [root@NxLinux certs]# openssl s_client -connect 5.1.1.100:443
    Debug output:
    Client handshake
    SNI: false
  2. Client sends HTTPS request with SNI:
    openssl s_client -connect 5.1.1.100:443 -servername 4096-rootca-rsa-server1
    debug output :
    client handshake
    SNI: 4096-rootca-rsa-server1

Supported Version

FortiADC version 5.0.x and later.