A good tool to generate strong passwords and secrets is "apg". You can get it with
sudo apt-get install apg
To create a strong secret for sessions, hashed Paperclip paths, etc. say
apg -m128 -a1 -E\'\"
Arguments explained:
- The
-mparameter defines the secret length -
-a1makes apg choose from all 7-bit ASCII characters instead of just the alphabet -
-E\'\"excludes quote characters so you can easily paste the secret into a Ruby string
Rails can also generate secrets that can be used for secret_key_base:
$ bin/rails secret
5693040b90b1b09d0a73364d950f15e3a9604403c8e81c6e5bb8b51d0981ef3bbde15a52bf5df41ac4974675bb8e31d69d03490dc11abd1086c873783d1be607
Posted by Henning Koch to makandra dev (2010-09-30 12:28)