Guest User

Untitled

a guest
Jul 22nd, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. ########################################################################
  2. ### Rakefile for encrypted passwords
  3. ########################################################################
  4. #
  5. # Here's a little Rakefile to manage your encrypted password file! It's
  6. # really easy to use:
  7. #
  8. # 1) put the email addresses of the keys you want in AUTHORIZED_USERS
  9. # 2) create a passwords.txt (and ignore it in your SCM)
  10. # 3) run `rake passwords:encrypt`
  11. # 4) check in passwords.pgp
  12. #
  13. # To decrypt, just run `rake passwords:decrypt`
  14. #
  15. ########################################################################
  16. #
  17. # Ben Bleything wrote this, and would love it if you gave him lots of
  18. # money. You can email him at ben@bleything.net for wire transfer info.
  19. #
  20. # That said, there's nothing special in here, so I'm placing it in the
  21. # public domain.
  22. #
  23.  
  24. AUTHORIZED_USERS = %w[
  25. ben@bleything.net
  26. ]
  27.  
  28. namespace :passwords do
  29.  
  30. desc "Encrypts the current passwords.txt file"
  31. task :encrypt do
  32. # ascii armor, encrypt, sign, overwrite passwords.pgp, always trust public keys
  33. cmd = %w[
  34. gpg --armor --encrypt --sign --output passwords.pgp --yes --trust-model always
  35. ]
  36.  
  37. # add -r <email> for each user
  38. AUTHORIZED_USERS.each do |user|
  39. cmd << "-r #{user}"
  40. end
  41.  
  42. # and encrypt the passwords.txt
  43. cmd << "passwords.txt"
  44.  
  45. exec cmd.join(' ')
  46. end
  47.  
  48. desc "Decrypts passwords.gpg and writes it to passwords.txt"
  49. task :decrypt do
  50. exec "gpg --armor --decrypt --output passwords.txt passwords.pgp"
  51. end
  52.  
  53. end
Add Comment
Please, Sign In to add comment