Skip to content

Commit c36b85a

Browse files
committed
BUG/MAJOR: bind: allow bind to parse multiple certificate options
They are now parsed and serialized as SslCertificate field on the bind object and delimited by ':'.
1 parent e21184b commit c36b85a

File tree

167 files changed

+1574
-1777
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+1574
-1777
lines changed

config-parser/tests/bind_generated_test.go

Lines changed: 17 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config-parser/tests/configs/haproxy_generated.cfg.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config-parser/tests/integration/frontend_data_test.go

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config-parser/tests/integration/frontend_test.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config-parser/types/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ type ACL struct{}
265265
//test:ok:bind :443 idle-ping 10
266266
//test:ok:bind :443 ssl tls-tickets
267267
//test:ok:bind :443 ssl no-strict-sni
268+
//test:ok:bind :443 ssl crt mycert1.pem crt mycert2.pem crt mycert3.pem
268269
//test:fail:bind :443 idle-ping
269270
//test:fail:bind :443 user
270271
//test:fail:bind :443 user mode 600

configuration/bind.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,11 @@ func parseBindParams(bindOptions []params.BindOption) models.BindParams { //noli
308308
case "tcp-md5sig":
309309
b.TCPMd5sig = v.Value
310310
case "crt":
311-
b.SslCertificate = v.Value
311+
if b.SslCertificate == "" {
312+
b.SslCertificate = v.Value
313+
} else {
314+
b.SslCertificate = fmt.Sprintf("%s:%s", b.SslCertificate, v.Value)
315+
}
312316
case "ca-file":
313317
b.SslCafile = v.Value
314318
case "ca-verify-file":
@@ -464,7 +468,10 @@ func serializeBindParams(b models.BindParams, path string, opt *options.Configur
464468
options = append(options, &params.BindOptionValue{Name: "name", Value: path})
465469
}
466470
if b.SslCertificate != "" {
467-
options = append(options, &params.BindOptionValue{Name: "crt", Value: b.SslCertificate})
471+
certs := strings.Split(b.SslCertificate, ":")
472+
for _, cert := range certs {
473+
options = append(options, &params.BindOptionValue{Name: "crt", Value: cert})
474+
}
468475
}
469476
if b.SslCafile != "" {
470477
options = append(options, &params.BindOptionValue{Name: "ca-file", Value: b.SslCafile})

models/aclfiles_diff_generated.go

Lines changed: 26 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

models/aclfiles_equal_generated.go

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

models/aclfilesentries_diff_generated.go

Lines changed: 26 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

models/aclfilesentries_equal_generated.go

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)