calcom / docker

The Docker configuration for Cal.com is an effort powered by people within the community. Cal.com, Inc. does not provide official support for Docker, but we will accept fixes and documentation. Use at your own risk.
MIT License
676 stars 346 forks source link

Invalid key length on CALENDSO_ENCRYPTION KEY #333

Open ozzyoss77 opened 7 months ago

ozzyoss77 commented 7 months ago

Hello everyone, I have a deployment of cal.com with the following characteristics:

Everything works fine, but when trying to activate 2FA, it tells me that something went wrong. Checking the Docker Compose logs, I have this message in the console:

RangeError: Invalid key length calcom-1 | @calcom/web:start: at Cipheriv.createCipherBase (node:internal/crypto/cipher:122:19) calcom-1 | @calcom/web:start: at Cipheriv.createCipherWithIV (node:internal/crypto/cipher:141:3) calcom-1 | @calcom/web:start: at new Cipheriv (node:internal/crypto/cipher:249:3) calcom-1 | @calcom/web:start: at Object.createCipheriv (node:crypto:141:10) calcom-1 | @calcom/web:start: at symmetricEncrypt (/calcom/apps/web/.next/server/chunks/69559.js:1:278) calcom-1 | @calcom/web:start: at handler (/calcom/apps/web/.next/server/pages/api/auth/two-factor/totp/setup.js:1:3027) { calcom-1 | @calcom/web:start: code: 'ERR_CRYPTO_INVALID_KEYLEN' calcom-1 | @calcom/web:start: } calcom-1 | @calcom/web:start: RangeError: Invalid key length calcom-1 | @calcom/web:start: at Cipheriv.createCipherBase (node:internal/crypto/cipher:122:19) calcom-1 | @calcom/web:start: at Cipheriv.createCipherWithIV (node:internal/crypto/cipher:141:3) calcom-1 | @calcom/web:start: at new Cipheriv (node:internal/crypto/cipher:249:3) calcom-1 | @calcom/web:start: at Object.createCipheriv (node:crypto:141:10) calcom-1 | @calcom/web:start: at symmetricEncrypt (/calcom/apps/web/.next/server/chunks/69559.js:1:278) calcom-1 | @calcom/web:start: at handler (/calcom/apps/web/.next/server/pages/api/auth/two-factor/totp/setup.js:1:3027) { calcom-1 | @calcom/web:start: code: 'ERR_CRYPTO_INVALID_KEYLEN' calcom-1 | @calcom/web:start: }

From what I understand, there is an issue with the length of the secret used to encrypt the information. Can someone help me with the necessary specifications to get this accepted?

I'm already using openssl rand -base64 32 to generate a random string, but I still can't get it to work.

Thanks in advance.

johan-cruxdata commented 6 months ago

have you tried the old guidance of openssl rand -base64 24?