2018-09-19 08:49:11 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# keys.sh generates keys used for the encryption of certain user data. Because
|
|
|
|
# user data becomes unrecoverable without these keys, the script and won't
|
|
|
|
# overwrite any existing keys unless you explicitly delete them.
|
|
|
|
#
|
|
|
|
|
|
|
|
# Generate cookie encryption and authentication keys
|
|
|
|
if [[ ! -e "$(pwd)/keys/cookies_enc.aes256" ]]; then
|
|
|
|
dd of=$(pwd)/keys/cookies_enc.aes256 if=/dev/urandom bs=32 count=1
|
|
|
|
else
|
|
|
|
echo "cookies key already exists! rm keys/cookies_enc.aes256 if you understand the consquences."
|
|
|
|
fi
|
|
|
|
if [[ ! -e "$(pwd)/keys/cookies_auth.aes256" ]]; then
|
|
|
|
dd of=$(pwd)/keys/cookies_auth.aes256 if=/dev/urandom bs=32 count=1
|
|
|
|
else
|
|
|
|
echo "cookies authentication key already exists! rm keys/cookies_auth.aes256 if you understand the consquences."
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Generate email encryption key
|
2018-10-27 17:17:54 +00:00
|
|
|
if [[ ! -e "$(pwd)/keys/email.aes256" ]]; then
|
|
|
|
dd of=$(pwd)/keys/email.aes256 if=/dev/urandom bs=32 count=1
|
2018-09-19 08:49:11 +00:00
|
|
|
else
|
2018-10-27 17:17:54 +00:00
|
|
|
echo "email key already exists! rm keys/email.aes256 if you understand the consquences."
|
2018-09-19 08:49:11 +00:00
|
|
|
fi
|