Skip to content

Commit 8d7ac18

Browse files
committed
caddytls: Ability to drop connections (close #6294)
1 parent 7e2510e commit 8d7ac18

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

modules/caddytls/connpolicy.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ func (cp ConnectionPolicies) TLSConfig(_ caddy.Context) *tls.Config {
119119
continue policyLoop
120120
}
121121
}
122+
if pol.Drop {
123+
return nil, fmt.Errorf("dropping connection")
124+
}
122125
return pol.TLSConfig, nil
123126
}
124127

@@ -156,6 +159,9 @@ type ConnectionPolicy struct {
156159
// Maximum TLS protocol version to allow. Default: `tls1.3`
157160
ProtocolMax string `json:"protocol_max,omitempty"`
158161

162+
// Reject TLS connections. EXPERIMENTAL: May change.
163+
Drop bool `json:"drop,omitempty"`
164+
159165
// Enables and configures TLS client authentication.
160166
ClientAuthentication *ClientAuthentication `json:"client_authentication,omitempty"`
161167

0 commit comments

Comments
 (0)