@marcel91200 / caddy Mirror · read-only / commits / 8d7ac184
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 12, 13:15 UTC

caddytls: Ability to drop connections (close #6294)

Matthew Holt committed May 6, 2024 at 19:59 UTC 8d7ac1840221d0b4060448b6f333e6720cfe895f
1 file changed +6
modules/caddytls/connpolicy.go
+6
@@ -119,6 +119,9 @@ func (cp ConnectionPolicies) TLSConfig(_ caddy.Context) *tls.Config {
119 continue policyLoop
120 }
121 }
122 + if pol.Drop {
123 + return nil, fmt.Errorf("dropping connection")
124 + }
125 return pol.TLSConfig, nil
126 }
127
@@ -156,6 +159,9 @@ type ConnectionPolicy struct {
159 // Maximum TLS protocol version to allow. Default: `tls1.3`
160 ProtocolMax string `json:"protocol_max,omitempty"`
161
162 + // Reject TLS connections. EXPERIMENTAL: May change.
163 + Drop bool `json:"drop,omitempty"`
164 +
165 // Enables and configures TLS client authentication.
166 ClientAuthentication *ClientAuthentication `json:"client_authentication,omitempty"`
167