fix(server): remove obselete memory check warning (#2380)

Given the fact that many Linux OSes are defaulting to CGroups v2 and also Authelia changing the default memory config for argon2id this warning is now obselete.
pull/2382/head
Amir Zarrinkafsh 2021-09-16 12:26:34 +10:00 committed by GitHub
parent a88c5588e8
commit 11032bdf93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 20 deletions

View File

@ -3,13 +3,10 @@ package server
import (
"embed"
"io/fs"
"io/ioutil"
"net"
"net/http"
"os"
"runtime"
"strconv"
"strings"
duoapi "github.com/duosecurity/duo_api_golang"
"github.com/fasthttp/router"
@ -174,23 +171,6 @@ func Start(configuration schema.Configuration, providers middlewares.Providers)
logger.Fatalf("Error initializing listener: %s", err)
}
// TODO(clems4ever): move that piece to a more related location, probably in the configuration package.
if configuration.AuthenticationBackend.File != nil && configuration.AuthenticationBackend.File.Password.Algorithm == "argon2id" && runtime.GOOS == "linux" {
f, err := ioutil.ReadFile("/sys/fs/cgroup/memory/memory.limit_in_bytes")
if err != nil {
logger.Warnf("Error reading hosts memory limit: %s", err)
} else {
m, _ := strconv.Atoi(strings.TrimSuffix(string(f), "\n"))
hostMem := float64(m) / 1024 / 1024 / 1024
argonMem := float64(configuration.AuthenticationBackend.File.Password.Memory) / 1024
if hostMem/argonMem <= 2 {
logger.Warnf("Authelia's password hashing memory parameter is set to: %gGB this is %g%% of the available memory: %gGB", argonMem, argonMem/hostMem*100, hostMem)
logger.Warn("Please read https://www.authelia.com/docs/configuration/authentication/file.html#memory and tune your deployment")
}
}
}
if configuration.Server.TLS.Certificate != "" && configuration.Server.TLS.Key != "" {
if err = writeHealthCheckEnv(configuration.Server.DisableHealthcheck, "https", configuration.Server.Host, configuration.Server.Path, configuration.Server.Port); err != nil {
logger.Fatalf("Could not configure healthcheck: %v", err)

View File

@ -1,6 +1,7 @@
module.exports = {
extends: ["@commitlint/config-conventional"],
rules: {
"body-max-line-length": [2, "always", "Infinity"],
"body-min-length": [2, "always", 20],
"header-case": [2, "always", "lower-case"],
"header-max-length": [2, "always", 72],