0

我正在尝试创建一个 ansible 角色来自动备份。但是,它失败并出现以下错误:

Local and Remote metadata are synchronized, no sync needed.
Last full backup date: none
GPGError: GPG Failed, see log below:
===== Begin GnuPG log =====
gpg: ADD3F11Easdsdfs: skipped: public key not found
gpg: [stdin]: encryption failed: public key not found
===== End GnuPG log =====

PGP 密钥是使用gpg --gen-key <filename>以下设置生成的:

Key-Type: DSA
Key-Length: 4096
Name-Real: {{ gpg_name }}
Name-Comment: Used primarily for backup encryption on {{ inventory_hostname }}
Name-Email: {{ gpg_email }}
Expire-Date: 0
%no-ask-passphrase
%no-protection
%commit
%echo done

如您所见,它没有过期日期(因此它不会过期)并且没有密码。这两个属性都已使用 CLI 手动验证。

这是我用来运行 duplicity 的命令:

duplicity full /var/www gs://backups2/{{ inventory_hostname }} --encrypt-key {{ gpg_email }}

我也尝试过使用密钥 ID:

duplicity full /var/www gs://backups2/hostname --encrypt-key ADD3F11E

知道可能出了什么问题吗?

4

1 回答 1

0

运行gpg --version/usr/bin/gpg --version检查它们是否相同。

Duplicity 可能回退到版本 1.xx,而您的终端可能有一个别名来调用 GnuPG 版本 2.xx 在这种情况下,密钥是使用 GnuPG 2 创建/导入的,但 GnuPG 1 可能不知道它(?)

或者,如果您希望 Duplicity 使用 GnuPG 2 并且您使用的是 debian(或相关),您可以将/usr/bin/gpg2 转移/usr/bin/gpg,如此此处所述。在这种情况下,duplicity 将被迫使用版本 2。

如参考资料中所述,在调用/usr/bin/gpg时,转移可能会对期望 GnuPG 版本 1 的其他程序产生不良副作用。

于 2018-07-17T21:12:50.433 回答