Files
Classeo/deploy/vps/generate-jwt.sh
Mathias STRASSER f507cf44c2
Some checks failed
CI / Backend Tests (push) Has been cancelled
CI / Frontend Tests (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
CI / Naming Conventions (push) Has been cancelled
CI / Build Check (push) Has been cancelled
feat(deploy): add vps deployment assets
2026-03-10 18:30:45 +01:00

25 lines
664 B
Bash

#!/bin/sh
set -eu
if [ ! -f deploy/vps/.env ]; then
echo "Missing deploy/vps/.env"
exit 1
fi
JWT_PASSPHRASE=$(grep '^JWT_PASSPHRASE=' deploy/vps/.env | cut -d= -f2-)
if [ -z "$JWT_PASSPHRASE" ]; then
echo "JWT_PASSPHRASE is empty in deploy/vps/.env"
exit 1
fi
mkdir -p backend/config/jwt
openssl genrsa -aes256 -passout "pass:${JWT_PASSPHRASE}" -out backend/config/jwt/private.pem 4096
openssl rsa -pubout -passin "pass:${JWT_PASSPHRASE}" -in backend/config/jwt/private.pem -out backend/config/jwt/public.pem
chmod 600 backend/config/jwt/private.pem
chmod 644 backend/config/jwt/public.pem
echo "JWT keypair generated in backend/config/jwt"