Skip to content

Commit

Permalink
MINOR: global: add ssl provider options
Browse files Browse the repository at this point in the history
  • Loading branch information
mjuraga committed Sep 13, 2023
1 parent 047194c commit c3078a2
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 2 deletions.
3 changes: 3 additions & 0 deletions configuration/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ global
ssl-default-bind-client-sigalgs ECDSA+SHA256:RSA+SHA256
ssl-default-server-sigalgs RSA+SHA256
ssl-default-server-client-sigalgs ECDSA+SHA256:RSA+SHA256
ssl-propquery provider
ssl-provider default
ssl-provider-path test
defaults test_defaults
maxconn 2000
Expand Down
30 changes: 30 additions & 0 deletions configuration/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,21 @@ func ParseGlobalSection(p parser.Parser) (*models.Global, error) { //nolint:goco
sslDhParamFile = sslDhParamFileParser.Value
}

sslPropquery, err := parseStringOption(p, "ssl-propquery")
if err != nil {
return nil, err
}

sslProvider, err := parseStringOption(p, "ssl-provider")
if err != nil {
return nil, err
}

sslProviderPath, err := parseStringOption(p, "ssl-provider-path")
if err != nil {
return nil, err
}

var sslServerVerify string
data, err = p.Get(parser.Global, parser.GlobalSectionName, "ssl-server-verify")
if err == nil {
Expand Down Expand Up @@ -1167,6 +1182,9 @@ func ParseGlobalSection(p parser.Parser) (*models.Global, error) { //nolint:goco
SslDefaultServerCiphersuites: sslServerCiphersuites,
SslDefaultServerOptions: sslServerOptions,
SslModeAsync: sslModeAsync,
SslPropquery: sslPropquery,
SslProvider: sslProvider,
SslProviderPath: sslProviderPath,
SslSkipSelfIssuedCa: sslSkipSelfIssuedCa,
TuneOptions: tuneOptions,
TuneSslDefaultDhParam: dhParam,
Expand Down Expand Up @@ -1659,6 +1677,18 @@ func SerializeGlobalSection(p parser.Parser, data *models.Global) error { //noli
return err
}

if err := serializeStringOption(p, "ssl-propquery", data.SslPropquery); err != nil {
return err
}

if err := serializeStringOption(p, "ssl-provider", data.SslProvider); err != nil {
return err
}

if err := serializeStringOption(p, "ssl-provider-path", data.SslProviderPath); err != nil {
return err
}

luaPrependPath := []types.LuaPrependPath{}
for _, l := range data.LuaPrependPath {
lpp := types.LuaPrependPath{
Expand Down
12 changes: 12 additions & 0 deletions configuration/global_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,15 @@ func TestGetGlobal(t *testing.T) {
if global.SslDefaultServerClientSigalgs != "ECDSA+SHA256:RSA+SHA256" {
t.Errorf("SslDefaultServerClientSigalgs is %v, expected ECDSA+SHA256:RSA+SHA256", global.SslDefaultServerClientSigalgs)
}
if global.SslPropquery != "provider" {
t.Errorf("SslPropquery is %v, expected provider", global.SslPropquery)
}
if global.SslProvider != "default" {
t.Errorf("SslProvider is %v, expected default", global.SslProvider)
}
if global.SslProviderPath != "test" {
t.Errorf("SslProviderPath is %v, expected test", global.SslProviderPath)
}
}

func TestPutGlobal(t *testing.T) {
Expand Down Expand Up @@ -717,6 +726,9 @@ func TestPutGlobal(t *testing.T) {
ClusterSecret: "",
SslDefaultServerSigalgs: "ECDSA+SHA256",
SslDefaultServerClientSigalgs: "ECDSA+SHA256",
SslPropquery: "foo",
SslProvider: "my_provider",
SslProviderPath: "providers/",
}

err := clientTest.PushGlobalConfiguration(g, "", version)
Expand Down
9 changes: 9 additions & 0 deletions models/global.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions models/global_compare.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions models/global_compare_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions specification/build/haproxy_spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1505,6 +1505,15 @@ definitions:
- disabled
type: string
x-display-name: Asynchronous TLS I/O operations
ssl_propquery:
type: string
x-display-name: SSL Query String Property
ssl_provider:
type: string
x-display-name: SSL Provider
ssl_provider_path:
type: string
x-display-name: SSL Provider Path
ssl_server_verify:
enum:
- none
Expand Down
9 changes: 9 additions & 0 deletions specification/models/configuration/global.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,15 @@ global:
x-display-name: Asynchronous TLS I/O operations
ssl_dh_param_file:
type: string
ssl_propquery:
type: string
x-display-name: SSL Query String Property
ssl_provider:
type: string
x-display-name: SSL Provider
ssl_provider_path:
type: string
x-display-name: SSL Provider Path
ssl_server_verify:
type: string
enum: [none, required]
Expand Down

0 comments on commit c3078a2

Please sign in to comment.