caddy_waf_t1k

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

README

About this repo

This is a WAF plugin for Caddy Server using Chaitin SafeLine as backend engine.

How to use

(waf) {
	route {
		waf_chaitin {
			waf_engine_addr 169.254.0.5:8000
		}
	}
}

:8000 {
	import waf
	respond / "Hello, world!"
}

How to build

xcaddy build --with github.com/W0n9/caddy_waf_t1k

TODO

  • Detection and Interception
  • Pass the remote_addr to the Engine
  • Multi backend engine instances support, include Load Balance and High Availability

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CaddyWAF

type CaddyWAF struct {
	WafEngineAddr string `json:"waf_engine_addr,omitempty"` // WAF Engine address

	PoolSize int `json:"pool_size,omitempty"` // Pool size
	// contains filtered or unexported fields
}

CaddyWAF implements an HTTP handler for WAF.

func (CaddyWAF) CaddyModule

func (CaddyWAF) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (CaddyWAF) Cleanup added in v0.0.3

func (m CaddyWAF) Cleanup() error

Cleanup releases resources associated with the CaddyWAF instance. It closes the WAF engine and logs the cleanup action. Returns an error if any issues occur during the cleanup process.

func (*CaddyWAF) Provision

func (m *CaddyWAF) Provision(ctx caddy.Context) error

Provision sets up the WAF module.

func (CaddyWAF) ServeHTTP

func (m CaddyWAF) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error

ServeHTTP is the main handler for the CaddyWAF middleware. It processes incoming HTTP requests, uses the WAF engine to detect potential threats, and takes appropriate actions based on the detection results. If a threat is detected and blocked, it redirects the request to an intercept page. Otherwise, it passes the request to the next handler in the chain.

func (*CaddyWAF) UnmarshalCaddyfile

func (m *CaddyWAF) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile implements caddyfile.Unmarshaler.

Jump to

Keyboard shortcuts

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