Ubuntu 22.04 SSH 智能卡认证,如何使 enable-ssh-support 标志起作用?

Ubuntu 22.04 SSH 智能卡认证,如何使 enable-ssh-support 标志起作用?

我正在尝试在干净的 Ubuntu 22.04 安装中设置使用智能卡读卡器的 SSH 身份验证。当使用 ssh 时,它不会尝试使用智能卡读卡器进行身份验证,而只是显示“[电子邮件保护]:权限被拒绝(公钥)。

Gpg-agent 可用于使用 SC 进行签名和解密,但不适用于 SSH 身份验证。我已设置启用 ssh 支持标记.gnupg/gpg-agent.conf但它不像在我的旧 Ubuntu 16.04 中那样工作。

更多来自https://unix.stackexchange.com/questions/701131/use-ntrux25519-key-exchange-with-gpg-agent我尝试设置“Kex算法[电子邮件保护]“客户端中的选项〜/.ssh / congig,在服务器中/etc/ssh/sshd_config但两次都没有成功。

我也尝试设置“PKCS11提供程序 /usr/lib/x86_64-linux-gnu/opensc-pkcs11.so“选项.ssh/配置,但我不确定这个选项是否适用于其他类型的卡,但是格努普

最初执行了以下命令:

$ sudo apt install gnupg2 gnupg-agent pcscd scdaemon pcsc-tools opensc gpgsm
$ sudo mv /etc/xdg/autostart/gnome-keyring-ssh.desktop /etc/xdg/autostart/gnome-keyring-ssh.desktop.inactive
$ echo "enable-ssh-support" >> ~/.gnupg/gpg-agent.conf
$ gpg2 --import public-armored-stub.gpg
$ gpg2 --edit-key <mykey>
    gpg> trust
    Your decision? 5
    Do you really want to set this key to ultimate trust? (y/N) y
    gpg> quit

除此之外,如果我将读卡器(使用相同的 SC)插入装有 Ubuntu 16.04 的旧笔记本电脑,即使没有从 Identiv 网站安装驱动程序,它也能完美运行。我在 Ubuntu 22.04 上使用带有 gnupg v2.1 SC 的 Identiv 读卡器(SCM SPR332 V2 - Pinpad Reader)。还有什么想法吗?

答案1

最后,在 Ubuntu 22.04 中设置使用智能卡的 SSH 身份验证,与旧版本相比,只需编辑 2 个配置文件。我找到了信息这里

除此之外,无需编辑 Gnome 密钥环自动启动文件,也无需驱动程序,至少对于 Nitrokey Pro 和 Identiv SCM SPR332 V2 Pinpad Reader 来说是这样。但是,带有 SC 读取器的 Cherry 键盘 (KC 1000 SC) 无法在此过程中运行。

我还发现只需要安装 scdaemon 包。所有这些都在另一次全新安装中进行了测试。

设置:

$ sudo apt install scdaemon
$ echo "use-agent" >> ~/.gnupg/gpg.conf
$ echo "enable-ssh-support" >> ~/.gnupg/gpg-agent.conf
$ echo "IdentityAgent /run/user/1000/gnupg/S.gpg-agent.ssh" >> ~/.ssh/config

将公钥存根添加到密钥环:

$ gpg2 --import public-armored-stub.gpg
$ gpg2 --edit-key <mykey>
    gpg> trust
    Your decision? 5
    Do you really want to set this key to ultimate trust? (y/N) y
    gpg> quit

就我而言,服务器上的公共 SSH 密钥已经位于 ~/.ssh/authorized_keys。

相关内容