backup/backup

Using 'passphrase' with GPG doesn't work (promt opens)

Roko131 opened this issue · 1 comments

  encrypt_with GPG do |encryption|
    encryption.keys = {}
    encryption.passphrase = 'secret passphrase'
    # encryption.mode = :both
    encryption.mode = :symmetric
  end

But running backup perform --trigger my_backup prompt passphrase windown, not using secret passphrase.

Why?

Because as of version 2 of GPG, the option --batch is needed to ensure no prompt. as can be read in the manual.

If this command is used with --batch, --pinentry-mode has been set to loopback, and one of the passphrase options (--passphrase,
--passphrase-fd, or passphrase-file) is used, the supplied passphrase is used for the new key and the agent does not ask for it. To
create a key without any protection --passphrase '' may be used.

How I fixed it:

just added the --batch flag:
In lib/backup/encryptor/gpg.rb, symmetric_options method:
changed
"-c --passphrase-file '#{path}'"
to
"-c --batch --passphrase-file '#{path}'"

My gpg version: gpg (GnuPG) 2.2.12

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.