A clean, Markdown-based publishing platform made for writers. Write together, and build a community. https://writefreely.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

26 lines
1002 B

  1. #!/bin/bash
  2. #
  3. # keys.sh generates keys used for the encryption of certain user data. Because
  4. # user data becomes unrecoverable without these keys, the script and won't
  5. # overwrite any existing keys unless you explicitly delete them.
  6. #
  7. # Generate cookie encryption and authentication keys
  8. if [[ ! -e "$(pwd)/keys/cookies_enc.aes256" ]]; then
  9. dd of=$(pwd)/keys/cookies_enc.aes256 if=/dev/urandom bs=32 count=1
  10. else
  11. echo "cookies key already exists! rm keys/cookies_enc.aes256 if you understand the consquences."
  12. fi
  13. if [[ ! -e "$(pwd)/keys/cookies_auth.aes256" ]]; then
  14. dd of=$(pwd)/keys/cookies_auth.aes256 if=/dev/urandom bs=32 count=1
  15. else
  16. echo "cookies authentication key already exists! rm keys/cookies_auth.aes256 if you understand the consquences."
  17. fi
  18. # Generate email encryption key
  19. if [[ ! -e "$(pwd)/keys/email.aes256" ]]; then
  20. dd of=$(pwd)/keys/email.aes256 if=/dev/urandom bs=32 count=1
  21. else
  22. echo "email key already exists! rm keys/email.aes256 if you understand the consquences."
  23. fi