diff --git a/README.md b/README.md index 47e71ff..de19c10 100644 --- a/README.md +++ b/README.md @@ -73,4 +73,4 @@ docker run --env-file .env -it --rm --name siren siren:latest ### Authentication The Siren service uses a JWT/session based authentication system, in that JWT tokens are issued and used, but a state is also kept server-side. This is to allow for the ability to revoke and expire tokens, as well as to allow for the ability to have multiple tokens per user. -Public/Private keys can be generated with `make generate`. These keys should be located within a `/keys` directory in the root of the project. \ No newline at end of file +Public/Private keys can be generated with `./generate_keys.sh`. These keys should be located within a `/keys` directory in the root of the project. The service's .env file should be updated to reflect the location of the keys. \ No newline at end of file diff --git a/generate_keys.sh b/generate_keys.sh new file mode 100755 index 0000000..752eac6 --- /dev/null +++ b/generate_keys.sh @@ -0,0 +1,23 @@ +#! /bin/bash + +DIR="./keys" + +if [ "$#" -eq 1 ]; then + DIR=$1 +fi + +# Create the keys directory (if it doesn't exist) +echo "Generating keys in: $DIR" +mkdir -p "$DIR" + +# Generate Access Keys +openssl genrsa -out $DIR/access_private_key.pem 4096 +openssl rsa -in $DIR/access_private_key.pem -pubout -outform PEM -out $DIR/access_public_key.pem +chmod 600 $DIR/access_private_key.pem +chmod 644 $DIR/access_public_key.pem + +# Generate Refresh Keys +openssl genrsa -out $DIR/refresh_private_key.pem 4096 +openssl rsa -in $DIR/refresh_private_key.pem -pubout -outform PEM -out $DIR/refresh_public_key.pem +chmod 600 $DIR/refresh_private_key.pem +chmod 644 $DIR/refresh_public_key.pem diff --git a/service/.env.TEMPLATE b/service/.env.TEMPLATE index 8199c5f..5a1a185 100644 --- a/service/.env.TEMPLATE +++ b/service/.env.TEMPLATE @@ -24,4 +24,5 @@ SERVICE_PORT=5000 DATA_DIR_PATH= DISCORD_TOKEN= -OPENAI_API_KEY= \ No newline at end of file +OPENAI_API_KEY= +OPENAI_API_MODEL=gpt-3.5-turbo \ No newline at end of file diff --git a/service/Makefile b/service/Makefile index a501bcf..b8d76f9 100644 --- a/service/Makefile +++ b/service/Makefile @@ -29,10 +29,3 @@ clean: docker image rm siren-service || \ docker network rm siren_frontend || \ docker network rm siren-backend - -generate: ## Generate RSA keys - mkdir keys - openssl genrsa -out keys/access_private_key.pem 4096 - openssl rsa -in keys/access_private_key.pem -pubout -outform PEM -out keys/access_public_key.pem - openssl genrsa -out keys/refresh_private_key.pem 4096 - openssl rsa -in keys/refresh_private_key.pem -pubout -outform PEM -out keys/refresh_public_key.pem \ No newline at end of file