tlsformat

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2021 License: MIT Imports: 6 Imported by: 0

README

caddy-tls-format

This packages contains two log field filters to log TLS version and cipher suites in a more readable form.

Installation

xcaddy build --with github.com/ueffel/caddy-tls-format

Usage

See caddy log filter documentation. There will be two new filters to use:

tls_version
<field> tls_version [prefix]
  • field Probably the only sensible field to use here is: request>tls>version
  • prefix string that is added before the TLS version string.
tls_cipher
<field> tls_cipher
  • field Probably the only sensible field to use here is: request>tls>cipher_suite

Example configuration

The following example configuration uses the Formatted Log Encoder

format filter {
    wrap formatted "\"{request>method} {request>uri} {request>proto}\" {request>tls>version}/{request>tls>cipher_suite}"
    fields {
        request>tls>version tls_version TLSv
        request>tls>cipher_suite tls_cipher
    }
}

Log output (with and without HTTPS):

"GET / HTTP/2.0" TLSv1.3/TLS_AES_128_GCM_SHA256
"GET / HTTP/1.1" -/-

For reference the configuration and output without filters:

format formatted "\"{request>method} {request>uri} {request>proto}\" {request>tls>version}/{request>tls>cipher_suite}"

Log output:

"GET / HTTP/2.0" 772/4865
"GET / HTTP/1.1" -/-

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TLSCipherFilter

type TLSCipherFilter struct{}

TLSCipherFilter is Caddy log field filter that replaces the numeric TLS cipher_suite value with the string representation.

func (TLSCipherFilter) CaddyModule

func (TLSCipherFilter) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*TLSCipherFilter) Filter

func (f *TLSCipherFilter) Filter(in zapcore.Field) zapcore.Field

Filter replaces the input field containing numeric TLS cipher_suite with the corresponding string representation.

func (*TLSCipherFilter) UnmarshalCaddyfile

func (f *TLSCipherFilter) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile sets up the module from Caddyfile tokens.

type TLSVersionFilter

type TLSVersionFilter struct {
	// Prefix is a constant string that will be added before the replaced version string.
	Prefix string `json:"prefix,omitempty"`
}

TLSVersionFilter is a Caddy log field filter that replaces the numeric TLS version with the string version and optionally adds a prefix.

func (TLSVersionFilter) CaddyModule

func (TLSVersionFilter) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*TLSVersionFilter) Filter

func (f *TLSVersionFilter) Filter(in zapcore.Field) zapcore.Field

Filter replaces the input field containing the numeric TLS version with the string version and adds the prefix.

func (*TLSVersionFilter) UnmarshalCaddyfile

func (f *TLSVersionFilter) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile sets up the module from Caddyfile tokens.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL