LoginSignup
2
0

More than 1 year has passed since last update.

macOS GnuPG 2.3.1でYubiKeyのOpenPGP鍵へアクセスできなくなったら

Last updated at Posted at 2021-04-26

先に結論

~/.gnupg/scdaemon.confに以下の一文を追加してgpg-agentを再起動。

~/.gnupg/scdaemon.conf
disable-ccid

ただしあくまで暫定対処。

状況とその原因

brew upgrade を行ったところ、2021-4-23付のGnuPG v2.3.1へのアップグレードが実行された。

gnupg: update 2.3.1 bottle.
https://github.com/Homebrew/homebrew-core/commit/553ca25a3098148f32a3b0da68daba7e4d3d69a0#diff-ad8333a9d16df0e9fc911f266f3914e073b6f0f335048ff754d55bbe6479f4bf

以降、YubiKey 5C NFCのOpenPGP Smartcardへのアクセスが不可能となった。

git commitへの署名、sshなど全部不可能。OpenPGP Smartcard ステータスを確認すると

zsh
% gpg --card-status
gpg: selecting card failed: Operation not supported by device
gpg: OpenPGP card not available: Operation not supported by device

という状態。なお、筆者の環境は以下の通り。

  • iMac 27inch 2020

  • macOS Big Sur (v11.2.3)

  • brew version:

  % brew --version
  Homebrew 3.1.3-91-gfb7d19c
  Homebrew/homebrew-core (git revision 0941e37d09; last commit 2021-04-26)

この原因としては、GnuPGのフォーラム(https://dev.gnupg.org/T5409)で記載されている通り、GnuPGに内蔵されているCCIDドライバがYubiKeyにアクセスできないことだった模様。

(暫定) 対処法

OpenPGP Smartcardへアクセスできないのは、メッセージによれば「USBデバイス側にパーミッションがないから」である。しかし、そもそもGnuPG内臓のCCIDドライバ使わなければ問題ないんじゃね? ということで、Work Around気味ではあるものの、macOS側のPC/SCベースのアクセスに切り替えればちゃんと動作する。これもGnuPGのフォーラムにある通り。

以下の一文を~/.gnupg/scdaemon.confへ追記する。

~/.gnupg/scdaemon.conf
disable-ccid

あとはgpg-agentを再起動しておく。

この設定については、GnuPGのScdaemonのマニュアルに記載通り、内蔵のCCIDドライバからフォールバックするというオプション:

Disable the integrated support for CCID compliant readers. This allows falling back to one of the other drivers even if the internal CCID driver can handle the reader. Note, that CCID support is only available if libusb was available at build time.

おわり

GnuPG 2.2.27にロールバックするのも、homebrew経由でインストールしていると面倒なので、このような暫定対処をとることとした。

参考

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0