A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.
ci: generate auth secret in production (#1681)
Meier Lukas15d47d0585be
diff --git a/Dockerfile b/Dockerfileindex 443a7ce08..6b0ea4e63 100644--- a/Dockerfile+++ b/Dockerfile@@ -67,7 +67,7 @@ COPY --from=builder --chown=nextjs:nodejs /app/apps/nextjs/.next/standalone ./COPY --from=builder --chown=nextjs:nodejs /app/apps/nextjs/.next/static ./apps/nextjs/.next/staticCOPY --from=builder --chown=nextjs:nodejs /app/apps/nextjs/public ./apps/nextjs/publicCOPY --chown=nextjs:nodejs scripts/run.sh ./run.sh-COPY --chown=nextjs:nodejs scripts/generateEncryptionKey.js ./generateEncryptionKey.js+COPY --chown=nextjs:nodejs scripts/generateRandomSecureKey.js ./generateRandomSecureKey.jsCOPY --chown=nextjs:nodejs packages/redis/redis.conf /app/redis.confCOPY --chown=nextjs:nodejs nginx.conf /etc/nginx/templates/nginx.confdiff --git a/development/docker-run.cmd b/development/docker-run.cmdindex 080de6c41..1f608898f 100644--- a/development/docker-run.cmd+++ b/development/docker-run.cmd@@ -1 +1 @@-docker run -p 7575:7575 -e AUTH_SECRET='secrets' homarr:latest\ No newline at end of file+docker run -p 7575:7575 homarr:latest\ No newline at end of filediff --git a/e2e/shared/create-homarr-container.ts b/e2e/shared/create-homarr-container.tsindex 84cbcc711..e6f2281ae 100644--- a/e2e/shared/create-homarr-container.ts+++ b/e2e/shared/create-homarr-container.ts@@ -6,9 +6,6 @@ export const createHomarrContainer = () => {}return new GenericContainer("homarr-e2e")- .withEnvironment({- AUTH_SECRET: "secret",- }).withExposedPorts(7575).withWaitStrategy(Wait.forHttp("/api/health/ready", 7575));};diff --git a/packages/auth/configuration.ts b/packages/auth/configuration.tsindex 4c00a0b20..f13765536 100644--- a/packages/auth/configuration.ts+++ b/packages/auth/configuration.ts@@ -89,7 +89,6 @@ export const createConfiguration = (signIn: createSignInEventHandler(db),},redirectProxyUrl: createRedirectUri(headers, "/api/auth"),- secret: "secret-is-not-defined-yet", // TODO: This should be added latersession: {strategy: "database",maxAge: env.AUTH_SESSION_EXPIRY_TIME,diff --git a/scripts/generateEncryptionKey.js b/scripts/generateRandomSecureKey.jssimilarity index 65%rename from scripts/generateEncryptionKey.jsrename to scripts/generateRandomSecureKey.jsindex 1fc7fdbfe..4813ae6a5 100644--- a/scripts/generateEncryptionKey.js+++ b/scripts/generateRandomSecureKey.js@@ -1,6 +1,6 @@-// This script generates a random encryption key-// This key is used to encrypt and decrypt the integration secrets-// In production it is generated in run.sh and stored in the environment variable ENCRYPTION_KEY+// This script generates a random secure key with a length of 64 characters+// This key is used to encrypt and decrypt the integration secrets for auth.js+// In production it is generated in run.sh and stored in the environment variables ENCRYPTION_KEY / AUTH_SECRET// during runtime, it's also stored in a file.const crypto = require("crypto");diff --git a/scripts/run.sh b/scripts/run.shindex bc4d9c9b1..d22536ff2 100644--- a/scripts/run.sh+++ b/scripts/run.sh@@ -18,11 +18,24 @@ if [ -r /secrets/encryptionKey ]; thenencryptionKey=$(cat /secrets/encryptionKey)elseecho "Generating encryption key"- encryptionKey=$(node ./generateEncryptionKey.js)+ encryptionKey=$(node ./generateRandomSecureKey.js)echo $encryptionKey > /secrets/encryptionKeyfiexport ENCRYPTION_KEY=$encryptionKey+# Generates an auth secret if it doesn't exist and saves it to /secrets/authSecret+# Also sets the AUTH_SECRET environment variable required for auth.js+authSecret=""+if [ -r /secrets/authSecret ]; then+ echo "Auth secret already exists"+ authSecret=$(cat /secrets/authSecret)+else+ echo "Generating auth secret"+ authSecret=$(node ./generateRandomSecureKey.js)+ echo $authSecret > /secrets/authSecret+fi+export AUTH_SECRET=$authSecret+# Start nginx proxy# 1. Replace the HOSTNAME in the nginx template file# 2. Create the nginx configuration file from the template