Skip to content

Commit

Permalink
caddytls: Ability to drop connections (close #6294)
Browse files Browse the repository at this point in the history
  • Loading branch information
mholt committed May 7, 2024
1 parent 7e2510e commit 8d7ac18
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/caddytls/connpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ func (cp ConnectionPolicies) TLSConfig(_ caddy.Context) *tls.Config {
continue policyLoop
}
}
if pol.Drop {
return nil, fmt.Errorf("dropping connection")
}
return pol.TLSConfig, nil
}

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

// Reject TLS connections. EXPERIMENTAL: May change.
Drop bool `json:"drop,omitempty"`

// Enables and configures TLS client authentication.
ClientAuthentication *ClientAuthentication `json:"client_authentication,omitempty"`

Expand Down

0 comments on commit 8d7ac18

Please sign in to comment.