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 ( import (
"embed" "embed"
"io/fs" "io/fs"
"io/ioutil"
"net" "net"
"net/http" "net/http"
"os" "os"
"runtime"
"strconv" "strconv"
"strings"
duoapi "github.com/duosecurity/duo_api_golang" duoapi "github.com/duosecurity/duo_api_golang"
"github.com/fasthttp/router" "github.com/fasthttp/router"
@ -174,23 +171,6 @@ func Start(configuration schema.Configuration, providers middlewares.Providers)
logger.Fatalf("Error initializing listener: %s", err) 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 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 { 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) logger.Fatalf("Could not configure healthcheck: %v", err)

View File

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