Skip to content

Commit

Permalink
Merge pull request backup#161 from square/jof-secure_gpg_keys
Browse files Browse the repository at this point in the history
Store GPG keys more securely.
  • Loading branch information
tomash committed Jul 8, 2011
2 parents 7a44cda + bd49c77 commit d34d3f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/backup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

require 'fileutils'
require 'yaml'
require 'etc'

##
# The Backup Ruby Gem
Expand Down Expand Up @@ -37,6 +38,7 @@ module Backup

##
# Backup's Environment paths
USER = ENV['USER'] || Etc.getpwuid.name # The user the backup is running as.
PATH = File.join(ENV['HOME'], 'Backup')
DATA_PATH = File.join(ENV['HOME'], 'Backup', 'data')
CONFIG_FILE = File.join(ENV['HOME'], 'Backup', 'config.rb')
Expand Down
2 changes: 2 additions & 0 deletions lib/backup/encryptor/gpg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def options
# Creates a new temp file and writes the provided public gpg key to it
def write_tmp_file!
@tmp_file = Tempfile.new('backup.pub')
FileUtils.chown(USER, nil, @tmp_file)
FileUtils.chmod(0600, @tmp_file)
@tmp_file.write(key)
@tmp_file.close
end
Expand Down

0 comments on commit d34d3f6

Please sign in to comment.