From a3ef5c6af2d5de107d01c45a62d7324165e2551b Mon Sep 17 00:00:00 2001 From: Marius Scurtescu Date: Wed, 5 Jun 2024 14:37:50 -0700 Subject: [PATCH] add default of signature check from QUILIBRIUM_SIGNATURE_CHECK env var --- Dockerfile | 1 + docker/docker-compose.yml | 1 - node/main.go | 20 ++++++++++++++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 42fa039..5bc1e93 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ FROM golang:1.20.14-alpine3.19 as build ENV GOEXPERIMENT=arenas +ENV QUILIBRIUM_SIGNATURE_CHECK=false WORKDIR /opt/ceremonyclient diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 10d6265..1d93017 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -7,7 +7,6 @@ services: node: image: ${QUILIBRIUM_IMAGE_NAME:-quilibrium} restart: unless-stopped - command: ["--signature-check=false"] deploy: resources: limits: diff --git a/node/main.go b/node/main.go index 137f556..ecae0c3 100644 --- a/node/main.go +++ b/node/main.go @@ -102,8 +102,8 @@ var ( ) signatureCheck = flag.Bool( "signature-check", - true, - "enables or disables signature validation (default true)", + signatureCheckDefault(), + "enables or disables signature validation (default true or value of QUILIBRIUM_SIGNATURE_CHECK env var)", ) core = flag.Int( "core", @@ -137,6 +137,20 @@ var signatories = []string{ "a114b061f8d35e3f3497c8c43d83ba6b4af67aa7b39b743b1b0a35f2d66110b5051dd3d86f69b57122a35b64e624b8180bee63b6152fce4280", } +func signatureCheckDefault() bool { + envVarValue, envVarExists := os.LookupEnv("QUILIBRIUM_SIGNATURE_CHECK") + if envVarExists { + def, err := strconv.ParseBool(envVarValue) + if err == nil { + return def + } else { + fmt.Println("Invalid environment variable QUILIBRIUM_SIGNATURE_CHECK, must be 'true' or 'false'. Got: " + envVarValue) + } + } + + return true +} + func main() { flag.Parse() @@ -206,6 +220,8 @@ func main() { fmt.Println("Signature check passed") } + } else { + fmt.Println("Signature check disabled, skipping...") } if *memprofile != "" {