caddyja3

package module
v0.0.0-...-9635735 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

README

caddyja3

A caddy plugin to get the JA3 fingerprint from requests as a header

Building with xcaddy

xcaddy build \
  --with github.com/antoniomika/caddyja3

Sample Caddyfile

Note that this enforces HTTPS (TLS).
You can add a http_redirect to automatically redirect http -> https like shown below.

{
	debug
	log {
		output stdout
		format console
	}
	order ja3 before respond
	servers {
		listener_wrappers {
			http_redirect
			ja3
			tls
		}
	}
}

localhost:2020 {
	ja3
	tls internal
	respond <<EOF
          JA3 Hash: {header.ja3-hash}
          JA3 String: {header.ja3-string}
          JA3 SNI: {header.ja3-sni}
          EOF 200
}

Acknowledgements

This repository is based on the code from caddy-ja3

Documentation

Index

Constants

View Source
const (
	CacheAppId = "ja3.cache"
)

Variables

This section is empty.

Functions

func NewJA3Conn

func NewJA3Conn(c net.Conn, cache *Cache, logger *zap.Logger) (net.Conn, error)

NewJA3Conn returns a new JA3 conn for generating the JA3 data.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

func (Cache) CaddyModule

func (Cache) CaddyModule() caddy.ModuleInfo

CaddyModule implements caddy.Module.

func (*Cache) ClearJA3

func (c *Cache) ClearJA3(addr string)

func (*Cache) GetJA3

func (c *Cache) GetJA3(addr string) *ja3.JA3

func (*Cache) Provision

func (c *Cache) Provision(ctx caddy.Context) error

func (*Cache) Reset

func (c *Cache) Reset()

func (*Cache) SetClientHello

func (c *Cache) SetClientHello(addr string, ch []byte) error

func (*Cache) Start

func (c *Cache) Start() error

Start implements caddy.App.

func (*Cache) Stop

func (c *Cache) Stop() error

Stop implements caddy.App.

type JA3Conn

type JA3Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

JA3Conn a struct to hold all components for our JA3 data.

func (*JA3Conn) Close

func (c *JA3Conn) Close() error

Close cleans up the ja3 entry from cache.

func (*JA3Conn) Read

func (c *JA3Conn) Read(b []byte) (int, error)

Read is the read handler for JA3 conns. It tries to read the client hello on first request.

type JA3Handler

type JA3Handler struct {
	// contains filtered or unexported fields
}

func (JA3Handler) CaddyModule

func (JA3Handler) CaddyModule() caddy.ModuleInfo

func (*JA3Handler) Provision

func (h *JA3Handler) Provision(ctx caddy.Context) error

Provision implements caddy.Provisioner.

func (*JA3Handler) ServeHTTP

func (h *JA3Handler) ServeHTTP(rw http.ResponseWriter, req *http.Request, next caddyhttp.Handler) error

ServeHTTP implements caddyhttp.MiddlewareHandler.

func (*JA3Handler) UnmarshalCaddyfile

func (h *JA3Handler) UnmarshalCaddyfile(_ *caddyfile.Dispenser) error

UnmarshalCaddyfile implements caddyfile.Unmarshaler.

type JA3Listener

type JA3Listener struct {
	// contains filtered or unexported fields
}

func (JA3Listener) CaddyModule

func (JA3Listener) CaddyModule() caddy.ModuleInfo

CaddyModule implements caddy.Module.

func (*JA3Listener) Provision

func (l *JA3Listener) Provision(ctx caddy.Context) error

func (*JA3Listener) UnmarshalCaddyfile

func (l *JA3Listener) UnmarshalCaddyfile(_ *caddyfile.Dispenser) error

UnmarshalCaddyfile implements caddyfile.Unmarshaler.

func (*JA3Listener) WrapListener

func (l *JA3Listener) WrapListener(ln net.Listener) net.Listener

WrapListener implements caddy.ListenerWrapper.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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