Explicitly hardcode MaxHeaderBytes as 1k, to prevent slowloris attack
This commit is contained in:
@@ -11,6 +11,9 @@ const (
|
|||||||
// copyBufferSize is the buffer size used for streaming file contents.
|
// copyBufferSize is the buffer size used for streaming file contents.
|
||||||
copyBufferSize = 32 * 1024
|
copyBufferSize = 32 * 1024
|
||||||
|
|
||||||
|
// maxHeaderBytes is the maximum size of request headers (1KB).
|
||||||
|
maxHeaderBytes = 1024
|
||||||
|
|
||||||
// portMin is the minimum valid port number.
|
// portMin is the minimum valid port number.
|
||||||
portMin = 1
|
portMin = 1
|
||||||
|
|
||||||
|
|||||||
@@ -184,6 +184,7 @@ func NewServer(configPath string) (*ServerWrapper, error) {
|
|||||||
Handler: withServerHeader(mux),
|
Handler: withServerHeader(mux),
|
||||||
ReadHeaderTimeout: readHeaderTimeout,
|
ReadHeaderTimeout: readHeaderTimeout,
|
||||||
WriteTimeout: time.Duration(C.BackupTimeout) * time.Minute,
|
WriteTimeout: time.Duration(C.BackupTimeout) * time.Minute,
|
||||||
|
MaxHeaderBytes: maxHeaderBytes,
|
||||||
ErrorLog: log.DebugLogger(),
|
ErrorLog: log.DebugLogger(),
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -195,6 +196,7 @@ func NewServer(configPath string) (*ServerWrapper, error) {
|
|||||||
Handler: withServerHeader(mux),
|
Handler: withServerHeader(mux),
|
||||||
ReadHeaderTimeout: readHeaderTimeout,
|
ReadHeaderTimeout: readHeaderTimeout,
|
||||||
WriteTimeout: time.Duration(C.BackupTimeout) * time.Minute,
|
WriteTimeout: time.Duration(C.BackupTimeout) * time.Minute,
|
||||||
|
MaxHeaderBytes: maxHeaderBytes,
|
||||||
TLSConfig: &tls.Config{
|
TLSConfig: &tls.Config{
|
||||||
MinVersion: tls.VersionTLS13,
|
MinVersion: tls.VersionTLS13,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user