我正在尝试使用该gpg工具来加密和解密文件,我想知道是否可以在不更改用户全局状态的情况下运行该工具。具体来说,gpg作为给定用户第一次运行将导致它.gnupg在用户的主目录中创建一个目录和其他工件。
我已经在从用户的公钥和密钥环隔离此命令的操作(见我的红宝石宝石一些成功https://github.com/rcook/rgpg对我怎么做),这是最后剩下gpg我想阻止的行为。
我们有一个私有的 debian 存储库,它是由早期的系统管理员在几年前建立的。软件包由旧密钥 7610DDDE(我必须撤销)签名,如 repo 服务器上的 root 用户所示。
# gpg --list-keys
/root/.gnupg/pubring.gpg
------------------------
pub 1024D/2D230C5F 2006-01-03 [expired: 2007-02-07]
uid Debian Archive Automatic Signing Key (2006) <ftpmaster@debian.org>
pub 1024D/7610DDDE 2006-03-03 [revoked: 2016-03-31]
uid Archive Maintainer <root@xxxxxxxxxx.com>
pub 4096R/DD219672 2016-04-18
uid Archive Maintainer <root@xxxxxxxxxx.com>
Run Code Online (Sandbox Code Playgroud)
以下所有命令均以 root 用户身份执行。我修改了 repository/conf/distributions 文件以使用我明确创建的新子密钥进行签名:
Architectures: i386 amd64 source
Codename: unstable
Components: main
...
SignWith: DD219672
Run Code Online (Sandbox Code Playgroud)
但是当我使用 dput 更新包时,我得到
Could not find any key matching 'DD219672'!
ERROR: Could not finish exporting 'unstable'!
This means that from outside your …Run Code Online (Sandbox Code Playgroud) 我有一个包含多个 .gpg 文件的目录,所有文件都使用相同的密码加密。如何在不一遍又一遍地输入密码的情况下解密它们?
我们想使用 gpg 签名来验证我们系统配置管理工具的某些方面。此外,我们希望使用“信任”模型,其中使用主签名密钥对各个系统管理员密钥进行签名,然后我们的系统信任该主密钥(并使用“信任网络”来验证我们的系统管理员的签名)。
这为我们提供了很大的灵活性,例如可以在有人离开时轻松撤销对密钥的信任,但我们遇到了问题。虽然该gpg命令会告诉您密钥是否不受信任,但它似乎不会返回指示此事实的退出代码。例如:
# gpg -v < foo.asc
Version: GnuPG v1.4.11 (GNU/Linux)
gpg: armor header:
gpg: original file name=''
this is a test
gpg: Signature made Fri 22 Jul 2011 11:34:02 AM EDT using RSA key ID ABCD00B0
gpg: using PGP trust model
gpg: Good signature from "Testing Key <someone@example.com>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key …Run Code Online (Sandbox Code Playgroud) 我在bashDebian 6.0.6 机器上编写 gpg 脚本时遇到了一些问题。我有一个执行批量操作的脚本,并希望在尝试继续之前确保 gpg-agent 可用。
由于 gpg-agent 在已经运行时启动,将不采取任何行动并返回成功,因此确保代理存在非常简单:
eval $(gpg-agent --daemon)
Run Code Online (Sandbox Code Playgroud)
gpg-agent 开始,或将报告:
gpg-agent[21927]: a gpg-agent is already running - not starting a new one
Run Code Online (Sandbox Code Playgroud)
如果已经运行,则返回 0(成功)。
当代理已经在另一个会话中运行时,就会出现问题。gpg-agent说它已经在运行......但gpg它自己然后声称它不可用。
$ gpg-agent --version
gpg-agent (GnuPG) 2.0.19
libgcrypt 1.5.0
$ gpg --version
gpg (GnuPG) 1.4.13
$ eval $(gpg-agent --daemon)
gpg-agent[21927]: a gpg-agent is already running - not starting a new one
$ gpg -d demo-file.asc
gpg: gpg-agent is not available in this session
Run Code Online (Sandbox Code Playgroud)
这让我感到沮丧和困惑。似乎gpg-agent …
我有一个备份服务器,它创建要备份的目录树的xz压缩tar档案。这些 tar 存档可能会变得很大(多 TB),可以split分成多个部分(2.5TB),并且每个部分都被写入 LTO-6 磁带,然后这些磁带会去异地。
现在我想添加加密。我可以在拆分之前使用公私密钥加密以及一个或多个收件人(管理员公钥)对 tar 存档进行 GPG 加密。
然而,在恢复的情况下,至少有一位管理员需要将他的私钥放在备份服务器上,因为文件太大而无法在其他任何地方解压。
GPG 在幕后使用混合加密方案,使用对称密码(如 AES)和会话密钥,只有该会话密钥才能为接收者加密公私密钥。
有没有办法让管理员提供会话密钥来解密要恢复的文件,而无需将私钥放在备份服务器上?
我当然可以重新发明轮子:
但是是否有“标准”或内置或最佳实践方法来实现上述目标?
所以我有这样的事情:
# apt-get update
Get:1 http://ftp.us.debian.org etch Release.gpg [1032B]
Hit http://ftp.us.debian.org etch Release
(...bunch more of this elided...)
Hit http://ftp.us.debian.org etch/contrib Sources
Fetched 68.8kB in 1s (37.4kB/s)
Reading package lists... Done
W: There is no public key available for the following key IDs:
9AA38DCD55BE302B
W: GPG error: http://ftp.us.debian.org etch Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 9AA38DCD55BE302B
W: You may want to run apt-get update to correct these problems
Run Code Online (Sandbox Code Playgroud)
显然我不能跑步apt-get update …
我知道我可以做到(编辑:修复了这个问题;我对 gpg 而不是 openssh 感兴趣)
gpg --edit-key
Run Code Online (Sandbox Code Playgroud)
...更改我的密钥的密码,但我不确定这意味着什么。
如果我在盒子 A 上加密数据并在盒子 B 上解密(比如口是心非),我是否必须更改两端的密码?以前的备份仍然有效吗?
密码短语只是密钥文件周围某种加密包装器的密钥吗?
愚蠢的问题,但我不想搞砸。谢谢!
当我尝试安装或更新任何软件包时,我得到:
Untrusted packages could compromise your system's security.
You should only proceed with the installation if you are certain that
this is what you want to do.
我强烈怀疑这与我在更新时遇到的错误有关:
$ sudo aptitude update
Get: 1 http://ftp.us.debian.org wheezy InRelease [208 kB]
Get: 2 http://debian.lcs.mit.edu wheezy InRelease [208 kB]
Ign http://ftp.us.debian.org wheezy InRelease
Hit http://ftp.us.debian.org wheezy/main amd64 Packages/DiffIndex
Hit http://ftp.us.debian.org wheezy/contrib amd64 Packages/DiffIndex
Hit http://ftp.us.debian.org wheezy/non-free amd64 Packages/DiffIndex
Hit http://ftp.us.debian.org wheezy/contrib Translation-en
Hit http://ftp.us.debian.org wheezy/main Translation-en
Hit http://ftp.us.debian.org wheezy/non-free Translation-en
Get: 3 http://debian.lcs.mit.edu …Run Code Online (Sandbox Code Playgroud) 有时我可能想使用某人的 gpg 密钥来发送消息,但不需要再次使用该密钥。
在这种情况下导入密钥似乎没有必要。
我已经搜索过,但找不到任何表明这是可能的。每次都必须执行 --delete-keys 有点烦人。
gpg ×10
apt ×2
debian ×2
linux ×2
pgp ×2
aptitude ×1
backup ×1
cryptography ×1
password ×1
private-key ×1
public-key ×1
repository ×1
scripting ×1
shell ×1