【问题标题】:can't use gpg-agent as an ssh agent不能使用 gpg-agent 作为 ssh 代理
【发布时间】:2018-05-16 09:12:39
【问题描述】:

我一直试图让 gpg-agent 作为 ssh 代理工作,但没有任何运气。我正在运行 Linux Mint (Sarah) 的 KDE 版本。

首先,我在 /etc/X11/Xsession.options 中禁用了内置 ssh 代理:

# $Id: Xsession.options 189 2005-06-11 00:04:27Z branden $
#
# configuration options for /etc/X11/Xsession
# See Xsession.options(5) for an explanation of the available options.
allow-failsafe
allow-user-resources
allow-user-xsession
#use-ssh-agent
use-session-dbus

然后,我在 gpg-agent 中启用了 ssh-agent 支持:

> $ cat ~/.gnupg/gpg-agent.conf                                                                                                                            
enable-ssh-support

此时我重新启动了我的电脑,并检查了我的环境变量:

> $ echo $GPG_AGENT_INFO                                                                                                                                   
/home/jeroen/.gnupg/S.gpg-agent:0:1

> $ echo $SSH_AUTH_SOCK                                                                                                                                    
/home/jeroen/.gnupg/S.gpg-agent.ssh

只是为了确保没有其他代理正在运行:

> $ ps aux | grep agent                                                                                                                                    
jeroen    5072  0.0  0.0 282604   764 ?        Ss   Nov24   0:15 /usr/bin/gpg-agent --daemon
jeroen    5265  0.0  0.1 697044 29032 ?        Sl   Nov24   0:01 /usr/lib/x86_64-linux-gnu/libexec/polkit-kde-authentication-agent-1
jeroen    9574  0.0  0.0 130292  1016 pts/6    S+   12:15   0:00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn agent

到目前为止,一切看起来都不错。那么让我们来看看我的 gpg 密钥:

pub   rsa2048/03AB1CB5 2015-06-12 [SC]
uid         [ultimate] Jeroen Jacobs <jeroen.jacobs@REDACTED.be>
uid         [ultimate] Jeroen Jacobs <jeroen.jacobs@REDACTED.be>
sub   rsa2048/014F9774 2015-06-12 [E]
sub   rsa2048/0FEF1A6F 2017-11-23 [A]

如您所见,存在一个身份验证子密钥。确定 gpg-agent 会选择这个,对吧?

ssh-add -l                                                                                                                                             
The agent has no identities.

嗯,它没有...已经重新启动了我的电脑,但没有任何区别。我已经阅读了几乎所有关于该主题的教程,并且我认为我按照书本做了所有事情,但我无法让它发挥作用。

以防万一,gpg2 和 gpg-agent 的版本:

> $ gpg2 --version                                                                                                                                         
gpg (GnuPG) 2.1.11
libgcrypt 1.6.5
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: ~/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2

> $ gpg-agent --version                                                                                                                                    
gpg-agent (GnuPG) 2.1.11
libgcrypt 1.6.5
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

【问题讨论】:

  • GPG 中的 ssh 代理支持是否知道如何提取身份验证子密钥?我认为它只是标准 ssh 代理的替代品,您必须使用 ssh-add 手动为其添加密钥。

标签: linux ssh gnupg pgp linux-mint


【解决方案1】:

您的身份验证子密钥的Append the keygrip~/.gnupg/sshcontrol 文件中。

gpg -K --with-keygrip 是列出所有密钥及其密钥的命令。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-18
    • 2022-12-16
    • 1970-01-01
    • 2021-10-27
    • 2022-12-28
    • 2018-04-26
    • 1970-01-01
    相关资源
    最近更新 更多