allow to configure ALPN protocols

Fixes #1406

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2023-10-28 12:35:26 +02:00
parent 691e44c1dc
commit 4a15775f65
16 changed files with 129 additions and 62 deletions

View File

@@ -82,7 +82,7 @@ func (s *webDavServer) listenAndServe(compressor *middleware.Compressor) error {
httpServer.TLSConfig = &tls.Config{
GetCertificate: certMgr.GetCertificateFunc(certID),
MinVersion: util.GetTLSVersion(s.binding.MinTLSVersion),
NextProtos: []string{"http/1.1", "h2"},
NextProtos: util.GetALPNProtocols(s.binding.Protocols),
CipherSuites: util.GetTLSCiphersFromNames(s.binding.TLSCipherSuites),
}
logger.Debug(logSender, "", "configured TLS cipher suites for binding %q: %v, certID: %v",

View File

@@ -128,11 +128,13 @@ type Binding struct {
// Note that TLS 1.3 ciphersuites are not configurable.
// The supported ciphersuites names are defined here:
//
// https://github.com/golang/go/blob/master/src/crypto/tls/cipher_suites.go#L52
// https://github.com/golang/go/blob/master/src/crypto/tls/cipher_suites.go#L53
//
// any invalid name will be silently ignored.
// The order matters, the ciphers listed first will be the preferred ones.
TLSCipherSuites []string `json:"tls_cipher_suites" mapstructure:"tls_cipher_suites"`
// HTTP protocols to enable in preference order. Supported values: http/1.1, h2
Protocols []string `json:"protocols" mapstructure:"protocols"`
// Prefix for WebDAV resources, if empty WebDAV resources will be available at the
// root ("/") URI. If defined it must be an absolute URI.
Prefix string `json:"prefix" mapstructure:"prefix"`