<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet href="/rss/stylesheet/" type="text/xsl"?>
<rss xmlns:content='http://purl.org/rss/1.0/modules/content/' xmlns:taxo='http://purl.org/rss/1.0/modules/taxonomy/' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:itunes='http://www.itunes.com/dtds/podcast-1.0.dtd' xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0" xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:atom='http://www.w3.org/2005/Atom' xmlns:podbridge='http://www.podbridge.com/podbridge-ad.dtd' version='2.0'>
<channel>
  <title>Snicoe&apos;s Blog</title>
  <language>zh-cn</language>
  <generator>microfeed.org</generator>
  <itunes:type>serial</itunes:type>
  <itunes:explicit>false</itunes:explicit>
  <atom:link rel="self" href="https://blog-arklink-org.pages.dev/rss/" type="application/rss+xml"/>
  <link>https://blog.arklink.org</link>
  <description>
    <![CDATA[<blockquote><em><u>“这是一步死棋”</u></em></blockquote><p>这里是Snicoe自言自语的地方，随便写点东西，也没啥人看，所以看心情更新一些陈芝麻烂谷子的东西。</p><p>计划有变，我可能不会经常维护此站点，也许可能永久不更新消失在汪洋互联网之中，会回来吗？也许吧，Good Luck！</p><p>社媒: <a href="https://www.instagram.com/snicoe0716" rel="noopener noreferrer" target="_blank">Instagram</a> | <a href="https://www.youtube.com/@snicoeofficial" rel="noopener noreferrer" target="_blank">Youtube</a> | <a href="https://x.com/snicoeofficial" rel="noopener noreferrer" target="_blank">X / Twitter</a></p><p>如果你使用了我的部分服务可以前往<a href="https://status0.arklink.org" rel="noopener noreferrer" target="_blank">Status</a>页面查看可用状态，全部服务均优先运行在IPv6网络。</p><p>本人生理男性并自认为男性，性取向正常，社恐一个，看心情回复❤️。</p>]]>
  </description>
  <itunes:author>Snicoeの自言自语</itunes:author>
  <itunes:image href="https://media-cdn.arklink.org/blog-arklink-org/production/images/channel-35018318ef9161a58e1728b4144ab0a9.png"/>
  <image>
    <title>Snicoe&apos;s Blog</title>
    <url>https://media-cdn.arklink.org/blog-arklink-org/production/images/channel-35018318ef9161a58e1728b4144ab0a9.png</url>
    <link>https://blog.arklink.org</link>
  </image>
  <copyright>©2019-2025</copyright>
  <itunes:category text="Science"/>
  <item>
    <title>利用Yubikey的OpenPGP在远程机器上签名和加密文件</title>
    <guid>bX2K3pq7z62</guid>
    <pubDate>Thu, 02 Jan 2025 08:47:51 GMT</pubDate>
    <itunes:explicit>false</itunes:explicit>
    <description>
      <![CDATA[<p>最近在玩OpenPGP遇到一个问题，如何在远程机器上使用Yubikey的OpenPGP功能签名和加密，本地可以使用kleopatra或者用gpg命令来签名加密文件，ssh登陆到远程服务器上是没法用本地gpg usb智能卡来签名加密文件，由于这种抽象玩法比较少见，但好歹找到了解决办法。</p><p><strong> Linux到Linux</strong></p><p>本质上是转发 gpg-agent，unix socket对unix socket是没有什么问题的，兼容性比较好。</p><p><em>参考：</em></p><p>https://security.stackexchange.com/questions/166280/how-to-use-yubikey-through-gnupg-on-remote-server</p><p><strong>Windows 到 Linux</strong></p><p>windows到Linux有个大坑，引用</p><p>&gt; <a href="https://github.com/PowerShell/Win32-OpenSSH/issues/1564" rel="noopener noreferrer" target="_blank">https://github.com/PowerShell/Win32-OpenSSH/issues/1564</a></p><p>ssh 只能转发 unix socket，OpenSSH_for_Windows并没有实现，这个issue依然是Open，去搜了一圈貌似官方尚未解决这个问题。</p><p>&gt; <a href="https://dev.gnupg.org/T3883" rel="noopener noreferrer" target="_blank">https://dev.gnupg.org/T3883</a></p><p>&gt; <a href="https://github.com/rupor-github/win-gpg-agent" rel="noopener noreferrer" target="_blank">https://github.com/rupor-github/win-gpg-agent</a></p><p>不过原issue的作者提供了一个Rust写的解决方案，试了下完美解决了这个问题。</p><p><img src="https://media-cdn.arklink.org/blog-arklink-org/production/media/rich-editor/items/bX2K3pq7z62/image-e8ab92c17bdee2cf416ac7ddbd55dfd1.png"></p><p>&gt;<a href="https://github.com/BusyJay/gpg-bridge/tree/v0.1.1/src" rel="noopener noreferrer" target="_blank">https://github.com/BusyJay/gpg-bridge/tree/v0.1.1/src</a></p><p>1. 安装：gpg-bridge</p><pre class="ql-syntax" spellcheck="false">cargo install -f --git https://github.com/busyjay/gpg-bridge
</pre><p>2. 运行</p><pre class="ql-syntax" spellcheck="false">gpg-bridge.exe --extra 127.0.0.1:4321
</pre><p>4. 获取远程gpg-agent路径</p><p>gpgconf --list-dir agent-socket</p><p>3. 编辑配置文件</p><p>本机`vim ~/.ssh/config`添加</p><pre class="ql-syntax" spellcheck="false">Host&nbsp;
	RemoteForward&nbsp;&nbsp;/run/user/1000/gnupg/S.gpg-agent&nbsp;127.0.0.1:4321
	ForwardAgent yes #&lt;远程gpg-agent&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;gpg-bridge监听端口&gt;
</pre><p>4. 远程机器</p><p>编辑`/etc/ssh/sshd_config`添加</p><pre class="ql-syntax" spellcheck="false">StreamLocalBindUnlink yes
</pre><p>5. 重启sshd</p><pre class="ql-syntax" spellcheck="false">systemctl restart sshd&nbsp;
</pre><p><strong>用WSL或者用usbip转发yubikey</strong></p><p>这种办法也是一种办法，但是比第二种办法还折腾，遂没有采用。</p>]]>
    </description>
    <link>https://blog.arklink.org/i/bX2K3pq7z62/</link>
    <itunes:episodeType>full</itunes:episodeType>
  </item>
</channel>
</rss>