<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.3.4">Jekyll</generator><link href="https://blog.pauljako.de/feed.xml" rel="self" type="application/atom+xml" /><link href="https://blog.pauljako.de/" rel="alternate" type="text/html" /><updated>2026-09-04T08:47:34+00:00</updated><id>https://blog.pauljako.de/feed.xml</id><title type="html">pauljako’s Blog</title><subtitle>My own Blog</subtitle><entry><title type="html">Using a Yubikey on Void Linux</title><link href="https://blog.pauljako.de/voidlinux/yubikey/2025/11/23/voidlinux-and-yubikeys.html" rel="alternate" type="text/html" title="Using a Yubikey on Void Linux" /><published>2025-11-23T12:30:00+00:00</published><updated>2025-11-23T12:30:00+00:00</updated><id>https://blog.pauljako.de/voidlinux/yubikey/2025/11/23/voidlinux-and-yubikeys</id><content type="html" xml:base="https://blog.pauljako.de/voidlinux/yubikey/2025/11/23/voidlinux-and-yubikeys.html"><![CDATA[<h2 id="introduction">Introduction</h2>

<p>Hello everyone,</p>

<p>I recently bought a new laptop. While unboxing it, two things came to mind:</p>

<ol>
  <li>I should try out a new distro—NixOS is slowly pissing me off.</li>
  <li>I want to take security more seriously.</li>
</ol>

<p>So, off to the races it was. I installed Void Linux with LUKS disk encryption. A few months later, I also bought a <a href="https://www.yubico.com/de/product/yubikey-5-series/yubikey-5c-nfc">YubiKey</a>.
I now want to show you all the steps I took to set it up.</p>

<h3 id="installation-of-basic-packages">Installation of Basic Packages</h3>

<p>I first installed some packages that seemed to be related:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>xbps-install u2f-hidraw-policy gnupg2-scdaemon ykpers yubikey-manager pcsc-ccid pcsclite
</code></pre></div></div>

<p>After that, I enabled the <code class="language-plaintext highlighter-rouge">pcscd</code> service:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">ln</span> <span class="nt">-sv</span> /etc/sv/pcscd /var/service
</code></pre></div></div>

<h2 id="pam">PAM</h2>

<p>This is the easiest part. Configuring PAM allows you to use sudo, swaylock, (insert your favourite greeter here), and a lot of other programs that normally want your password.</p>

<p>I mostly followed the <a href="https://wiki.gentoo.org/wiki/YubiKey/PAM">Gentoo Wiki</a> here.</p>

<p>First, install <code class="language-plaintext highlighter-rouge">pam_u2f</code>:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>xbps-install pam-u2f
</code></pre></div></div>

<p>Then, to use the <code class="language-plaintext highlighter-rouge">pam_u2f</code> module, enable it for system-auth by adding the following to the top of <code class="language-plaintext highlighter-rouge">/etc/pam.d/system-auth</code>:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>auth   sufficient   pam_u2f.so   cue
</code></pre></div></div>

<p>If you want to require a YubiKey, replace <code class="language-plaintext highlighter-rouge">sufficient</code> with <code class="language-plaintext highlighter-rouge">required</code>.</p>

<h3 id="adding-the-yubikey">Adding the YubiKey</h3>

<p>First create the directory and then generate the key file:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">mkdir</span> <span class="nt">-p</span> ~/.config/Yubico
pamu2fcfg <span class="o">&gt;</span> ~/.config/Yubico/u2f_keys
</code></pre></div></div>

<p>Note that you have to touch the key in the second step!</p>

<p>Most applications should already work by now, but for me, sudo didn’t.</p>

<h3 id="sudo">Sudo</h3>

<p>For some reason, on Void Linux, sudo does not seem to use the global PAM configuration.
You can change that by replacing the contents of <code class="language-plaintext highlighter-rouge">/etc/pam.d/sudo</code> with the following:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>#%PAM-1.0
auth   substack   system-auth
</code></pre></div></div>

<h2 id="disk-encryption--luks">Disk Encryption / LUKS</h2>

<h4 id="warning-this-method-is-a-really-bad-and-ugly-solution-i-do-not-take-any-responsibility-for-any-potential-loss-of-data"><strong>Warning:</strong> This method is a really bad and ugly solution. I do not take any responsibility for any potential loss of data.</h4>

<p>This is where I really struggled.
According to the <a href="https://wiki.archlinux.org/title/YubiKey#Challenge-response_2">Arch Wiki</a>, I can just use the <code class="language-plaintext highlighter-rouge">yubikey-full-disk-encryption</code> package to enroll my key. But of course, that package did not exist in the Void repos.
So I looked at its source code, only to find out that it is pretty Arch-dependent.</p>

<p>Later, I stumbled upon <a href="https://github.com/anatol/clevis-extra-pins">Clevis Extra Pins</a>, which provided a Clevis integration for YubiKeys.
First, I downloaded the two scripts from the repo to <code class="language-plaintext highlighter-rouge">/usr/bin</code> and made them executable:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>wget <span class="nt">-O</span> /usr/bin/clevis-encrypt-yubikey https://github.com/anatol/clevis-extra-pins/raw/refs/heads/main/clevis-encrypt-yubikey
wget <span class="nt">-O</span> /usr/bin/clevis-decrypt-yubikey https://github.com/anatol/clevis-extra-pins/raw/refs/heads/main/clevis-decrypt-yubikey
<span class="nb">chmod</span> +x /usr/bin/clevis-encrypt-yubikey /usr/bin/clevis-decrypt-yubikey
</code></pre></div></div>

<p>I then tried to encrypt some data:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>clevis encrypt yubikey <span class="s1">'{"slot":"2"}'</span> <span class="o">&lt;&lt;&lt;</span> <span class="s1">'hello, world'</span>
</code></pre></div></div>

<p>But quickly noticed something: I forgot to configure the second slot:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ykpersonalize <span class="nt">-2</span> <span class="nt">-ochal-resp</span> <span class="nt">-ochal-hmac</span> <span class="nt">-ohmal-lt64</span>
</code></pre></div></div>

<p>Then I ran into another problem:
The <code class="language-plaintext highlighter-rouge">sha3-256sum</code> command does not exist on Void Linux, so I replaced it with the normal <code class="language-plaintext highlighter-rouge">sha256sum</code>:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sed</span> <span class="nt">-i</span> <span class="s1">'s/sha3-256sum -x/sha256sum/g'</span> /usr/bin/clevis-encrypt-yubikey
<span class="nb">sed</span> <span class="nt">-i</span> <span class="s1">'s/sha3-256sum -x/sha256sum/g'</span> /usr/bin/clevis-decrypt-yubikey
</code></pre></div></div>

<p>Now I was able to encrypt data using my YubiKey and Clevis. Yay!
So I bound my YubiKey to my LUKS drive:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>clevis luks <span class="nb">bind</span> <span class="nt">-d</span> /dev/sdX yubikey <span class="s1">'{"slot":"2"}'</span>
</code></pre></div></div>

<p>But there was just one problem: the initramfs.</p>

<h3 id="dracut">Dracut</h3>

<p>Dracut is Void Linux’s default initramfs. It runs early userspace tasks like mounting the root filesystem.
I wanted Dracut to decrypt my drive using Clevis.</p>

<p>Thankfully, there already was a Clevis hook for Dracut, so I just had to make one for the YubiKey pin.
I wrote the following to <code class="language-plaintext highlighter-rouge">/usr/lib/dracut/modules.d/60clevis-pin-yubikey/module-setup.sh</code>:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c">#!/bin/bash</span>

depends<span class="o">()</span> <span class="o">{</span>
    <span class="nb">echo </span>clevis
    <span class="k">return </span>0
<span class="o">}</span>

<span class="nb">install</span><span class="o">()</span> <span class="o">{</span>
    inst_multiple ykchalresp xxd <span class="nb">sha256sum </span>jose
    inst_libdir_file libusb-1.0.so.0
    inst clevis-decrypt-yubikey
<span class="o">}</span>
</code></pre></div></div>

<p>After that, I reconfigured the initramfs and rebooted:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>xbps-reconfigure <span class="nt">-xf</span> linux
</code></pre></div></div>

<p>Now it finally worked! I was able to decrypt my drive using my YubiKey.</p>]]></content><author><name></name></author><category term="voidlinux" /><category term="yubikey" /><summary type="html"><![CDATA[Introduction]]></summary></entry><entry><title type="html">Installing NixOS on a VPS</title><link href="https://blog.pauljako.de/nixos/vps/2024/12/24/installing-nixos-on-a-vps.html" rel="alternate" type="text/html" title="Installing NixOS on a VPS" /><published>2024-12-24T21:34:23+00:00</published><updated>2024-12-24T21:34:23+00:00</updated><id>https://blog.pauljako.de/nixos/vps/2024/12/24/installing-nixos-on-a-vps</id><content type="html" xml:base="https://blog.pauljako.de/nixos/vps/2024/12/24/installing-nixos-on-a-vps.html"><![CDATA[<h2 id="introduction">Introduction</h2>
<p>Hello everyone,
I recently bought a new VPS. However the provider I bought it at (<a href="https://ionos.com">IONOS</a>) does not provide NixOS images.
At first I thought that Debian will be fine for me, but I quickly noticed, that NixOS is just way easier to maintain and reproduce. Especially on servers.
So I quickly looked into ways of installing NixOS and I discovered two Methods:</p>

<h3 id="nixos-anywhere">NixOS Anywhere</h3>
<p><a href="https://github.com/nix-community/nixos-anywhere">NixOS Anywhere</a> is a Nix module that can format the disk and install NixOS over SSH. It let’s you deploy your own flake and disko configuration onto your server. However at the time of installing, I never used Flakes and was somehow too afraid to try them out. Additionally the Machine I used for the installation didn’t have Nix installed which is required for NixOS Anywhere. So I looked into other Methods of installing NixOS.</p>

<h3 id="nixos-infect">NixOS-Infect</h3>
<p><a href="https://github.com/elitak/nixos-infect">NixOS-Infect</a> is just a Shell script to install NixOS over another Distribution. This makes it possible to use basically any machine to install it from. You can even use the admin console of your VPS if you want. It doesn’t require any Interaction and creates it’s own NixOS configuration. However this also comes with some issues: The root password is unset and no additional user is created. So if you forget to set a SSH-key for the root user, you basically locked yourself out of your VPS. Not only that but the shell script isn’t coded very good and doesn’t have any error handling. I still decided to try this script out because it seemed very simple.</p>

<h2 id="installing-nixos">Installing NixOS</h2>
<p>NixOS-Infect is pretty simple:
First, add your public ssh key to the root user like this:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">echo</span> <span class="s2">"&lt;your ssh key&gt;"</span> <span class="o">&gt;&gt;</span> /root/.ssh/authorized_keys
</code></pre></div></div>

<p>After that just run the shell script by running the following:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | <span class="nv">NIX_CHANNEL</span><span class="o">=</span>nixos-&lt;nixos version&gt; bash <span class="nt">-x</span>
</code></pre></div></div>

<p>At the time of writing the latest NixOS version is 24.11, so I entered the following:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | <span class="nv">NIX_CHANNEL</span><span class="o">=</span>nixos-24.11 bash <span class="nt">-x</span>
</code></pre></div></div>
<p>The script will automatically reboot your server and after it finished startup, You can login as the root user using the SSH-key you set up before.</p>

<h2 id="configuring-afterwards">Configuring afterwards</h2>
<p>After installation you can use the VPS like a normal NixOS machine and deploy a new configuration using flakes or the /etc/nixos/configuration.nix file. I would highly recommend creating a new user and removing the SSH-key from the root user. Additionally I also installed things like docker and tailscale to make maintaining easier.</p>

<h4 id="thank-you-for-reading-this-blog-post-i-wish-you-merry-christmas-and-i-hope-that-i-helped-you-out-hopefully-we-will-see-us-soon">Thank you for reading this blog post. I wish you Merry Christmas and I hope, that I helped you out. Hopefully we will see us soon</h4>]]></content><author><name></name></author><category term="nixos" /><category term="vps" /><summary type="html"><![CDATA[Introduction Hello everyone, I recently bought a new VPS. However the provider I bought it at (IONOS) does not provide NixOS images. At first I thought that Debian will be fine for me, but I quickly noticed, that NixOS is just way easier to maintain and reproduce. Especially on servers. So I quickly looked into ways of installing NixOS and I discovered two Methods:]]></summary></entry><entry><title type="html">Welcome to my Blog!</title><link href="https://blog.pauljako.de/general/2024/12/21/welcome-to-my-blog.html" rel="alternate" type="text/html" title="Welcome to my Blog!" /><published>2024-12-21T06:59:20+00:00</published><updated>2024-12-21T06:59:20+00:00</updated><id>https://blog.pauljako.de/general/2024/12/21/welcome-to-my-blog</id><content type="html" xml:base="https://blog.pauljako.de/general/2024/12/21/welcome-to-my-blog.html"><![CDATA[<p>Hello All,
This is my new Blog. I don’t know how long I will do this, but I hope You can Stay Updated for now.
I have some big projects upcoming so stay tuned!
That’s all for now. I wish you Merry Christmas and I hope, that we will see us soon</p>]]></content><author><name></name></author><category term="general" /><summary type="html"><![CDATA[Hello All, This is my new Blog. I don’t know how long I will do this, but I hope You can Stay Updated for now. I have some big projects upcoming so stay tuned! That’s all for now. I wish you Merry Christmas and I hope, that we will see us soon]]></summary></entry></feed>