15.5. 自定义TLS日志记录

在suricata.yaml中,找到tls日志部分并按以下方式编辑:

- tls-log:
    enabled: yes      # Log TLS connections.
    filename: tls.log # File to store TLS logs.
    append: yes
    custom: yes       # enabled the custom logging format (defined by customformat)
    customformat: "%{%D-%H:%M:%S}t.%z %a:%p -> %A:%P %v %n %d %D"

在tls.log文件中,您将获得以下信息,例如:

12/03/16-19:20:14.85859 10.10.10.4:58274 -> 192.0.78.24:443 VERSION='TLS 1.2' suricata-ids.org NOTBEFORE='2016-10-27T20:36:00' NOTAFTER='2017-01-25T20:36:00'
::

12/03/16-19:20:20.36849 10.10.10.4:39472->192.30.253.113:443 version='tls 1.2'github.com notbefore='2016-03-10t00:00:00'notafter='2018-05-17t12:00:00'

支持的格式字符串列表如下:

  • %N-客户SNI

  • %V-TLS/SSL版本

  • %D-证书日期不早于

  • %D-证书日期不晚于

  • %F-证书指纹sha1

  • %S-证书主题

  • %I-证书颁发者DN

  • %E-扩展格式

  • %strftime_format_t-选定strftime格式的TLS事务的时间戳。即:08/28/12-22:14:30

  • %z—使用秒的精确时间。电话:693856

  • %A-客户端IP地址

  • %P-客户端端口号

  • %A-服务器IP地址

  • %P-服务器端口号

任何不可打印的字符都将以十六进制格式的字节值表示(其中,xx是十六进制代码)