{
  "version": "https://jsonfeed.org/version/1",
  "title": "Rifa Achrinza",
  "description": "Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.",
  "home_page_url": "https://www.achrinza.com",
  "feed_url": "https://www.achrinza.com/blog/feed.json",
  "favicon": "https://www.achrinza.com/favicon.png",
  
  "items": [
    
    
    {
      "id": "https://www.achrinza.com/blog/2026/07/17/running-bosh-lite-on-windows-11",
      "url": "https://www.achrinza.com/blog/2026/07/17/running-bosh-lite-on-windows-11",
      "title": "Running BOSH Lite on Windows 11 the easy way",
      "content_html": "<ul id=\"markdown-toc\">\n  <li><a href=\"#a-primer-on-bosh-lite\" id=\"markdown-toc-a-primer-on-bosh-lite\">A Primer on BOSH Lite</a></li>\n  <li><a href=\"#the-problem\" id=\"markdown-toc-the-problem\">The problem</a></li>\n  <li><a href=\"#prerequisites\" id=\"markdown-toc-prerequisites\">Prerequisites</a></li>\n  <li><a href=\"#setup\" id=\"markdown-toc-setup\">Setup</a>    <ul>\n      <li><a href=\"#enabling-the-hyper-v-windows-feature\" id=\"markdown-toc-enabling-the-hyper-v-windows-feature\">Enabling the Hyper-V Windows feature</a></li>\n      <li><a href=\"#create-a-internal-hyper-v-vswitch-network\" id=\"markdown-toc-create-a-internal-hyper-v-vswitch-network\">Create a internal Hyper-V vSwitch network</a></li>\n      <li><a href=\"#making-the-network-adapter-routable\" id=\"markdown-toc-making-the-network-adapter-routable\">Making the network adapter routable</a></li>\n      <li><a href=\"#adding-vboxmanage-cli-to-wsl-2\" id=\"markdown-toc-adding-vboxmanage-cli-to-wsl-2\">Adding <code class=\"language-plaintext highlighter-rouge\">VBoxManage</code> CLI to WSL 2</a></li>\n      <li><a href=\"#deploying-the-bosh-director\" id=\"markdown-toc-deploying-the-bosh-director\">Deploying the BOSH Director</a></li>\n    </ul>\n  </li>\n  <li><a href=\"#next-steps\" id=\"markdown-toc-next-steps\">Next steps</a></li>\n  <li><a href=\"#final-thoughts\" id=\"markdown-toc-final-thoughts\">Final thoughts</a></li>\n</ul>\n\n<h2 id=\"a-primer-on-bosh-lite\">A Primer on BOSH Lite</h2>\n\n<p>Cloud Foundry <a href=\"https://bosh.io/docs/\">BOSH</a> is a powerful tool that provides a\nstandard for packaging software, deploying it, and especially for managing\nday-2 operations (including health checks, gradual rollouts, self-healing, and\nmetrics!).</p>\n\n<p>Getting started with BOSH can seem quite daunting as production setups assume\nyou’re using it to manage a bunch of virtual machines on a platform like AWS\nor vSphere. But don’t fret! For local development, there’s <em>BOSH Lite</em>, a\nlightweight setup crammed into a single VM.</p>\n\n<div class=\"language-text highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code>                                                                   \n                                                                   \n                      *** BOSH (Typical) ***                       \n                                                                   \n                      ┌───────────────────────────────────────────┐\n       ┌──────────────┼────────┐  ┌───────────┐                   │\n┌──────┼─────┐        │┌───────┼──┼────┐┌─────┼──────────────────┐│\n│ ┌────┴───┐ │        ││┌──────▼──▼───┐││┌────▼─────┐┌──────────┐││\n│ │BOSH CLI├─┼─┐  ┌───┼┼┤BOSH Director││││BOSH Agent││Deployment│││\n│ └────────┘ │ │  │   ││└─────────────┘││└──────────┘└──────────┘││\n│Dev Machine │ │  │   ││Virtual Machine││    Virtual Machine     ││\n└────────────┘ │  │   │└───────────────┘└────────────────────────┘│\n               │  └───►                                           │\n               └──────►                 Platform                  │\n                      └───────────────────────────────────────────┘\n                                                                   \n                                                                   \n                         *** BOSH Lite ***                         \n                                                                   \n                     ┌────────────────────────────────────────────┐\n       ┌─────────────┼────────┐                                   │\n       │             │┌───────┼──────────────────────────────────┐│\n       │             ││       │  ┌───────────┐                   ││\n┌──────┼─────┐       ││       │  │     ┌─────┼──────────────────┐││\n│ ┌────┴───┐ │       ││┌──────▼──▼───┐ │┌────▼─────┐┌──────────┐│││\n│ │BOSH CLI├─┼──┐    │││BOSH Director│ ││BOSH Agent││Deployment││││\n│ └────────┘ │  │    ││└──────┬──────┘ │└──────────┘└──────────┘│││\n│Dev Machine │  │    ││       └────────►    Garden Container    │││\n└────────────┘  │    ││                └────────────────────────┘││\n                │    ││             Virtual Machine              ││\n                │    │└──────────────────────────────────────────┘│\n                └────►                  Platform                  │\n                     └────────────────────────────────────────────┘\n\n</code></pre></div></div>\n\n<p>Compared to a typical setup, BOSH Lite swaps the BOSH Director’s Cloud\nProvider Interface’s (CPI) Provider - the abstraction code that enables BOSH\nto interact with platforms - for Warden (used to interact with Cloud Foundry’s\nown container runtime, <del>Warden</del> ahem,\n<a href=\"https://github.com/cloudfoundry/garden-runc-release\">Guardian</a>) while the\nephemeral Bootstrap BOSH (that’s <code class=\"language-plaintext highlighter-rouge\">bosh create-env</code>) retains the original\nplatform’s CPI Provider. This creates a split-CPI Provider setup which can\nseem confusing at first. But as the diagram above shows, it’s actually not too\ndifferent!</p>\n\n<p>BOSH Lite can used on top of any BOSH-supported platforms, but more likely\nthan not it’s used on either VirtualBox or Docker. Although Docker is the\n<a href=\"https://github.com/cloudfoundry/docs-bosh/issues/907#issuecomment-4867328298\">now-preferred</a>\nplatform for local BOSH development, the VirtualBox support is more\n<a href=\"https://github.com/cloudfoundry/bosh-docker-cpi-release/tree/65582382f6c9ae25c3ff6868bd2ab0279924d234#todo\">feature-complete</a>,\nbetter-documented, and mature.</p>\n\n<p>This guide will provide steps for spinning up a Windows 11 VirtualBox BOSH\nenvironment with the BOSH CLI via Windows Subsystem for Linux 2 (WSL 2).</p>\n\n<p>Unlike <a href=\"https://medium.com/pubsubplus/yes-you-can-run-bosh-lite-v2-on-windows-10-b55f679640b9\">prior\nguides</a>,\nthis also works with the newer WSL 2 <a href=\"https://learn.microsoft.com/en-us/windows/wsl/networking#mirrored-mode-networking\">mirrored networking\nmode</a>\nand limits changes to within WSL 2 and one Hyper-V vSwitch and vEthernet\nadapter pair.</p>\n\n<h2 id=\"the-problem\">The problem</h2>\n\n<p>Most BOSH CPIs (including VirtualBox), and by extension the <code class=\"language-plaintext highlighter-rouge\">bosh create-env</code>\n command, <a href=\"https://github.com/cloudfoundry/bosh-cli/issues/278\">do not support\n Windows</a>. Therefore,\n it’s recommended to run the command under WSL 2. However:</p>\n\n<ol>\n  <li>The VirtualBox CPI relies on the <code class=\"language-plaintext highlighter-rouge\">VBoxManage</code> CLI and passes untransformed\n Linux paths for stemcell uploads</li>\n  <li>VirtualBox on WSL 2 is not supported</li>\n  <li>There is <a href=\"https://github.com/microsoft/WSL/issues/14381\">no route</a> between\nVirtualBox’s host-only network and WSL 2 in mirrored mode.</li>\n</ol>\n\n<h2 id=\"prerequisites\">Prerequisites</h2>\n\n<ol>\n  <li>Install <a href=\"https://learn.microsoft.com/en-us/windows/wsl/install\">WSL 2</a></li>\n  <li>Install the <a href=\"./cli-v2-install\"><code class=\"language-plaintext highlighter-rouge\">bosh</code> CLI</a> on the WSL 2 environment</li>\n  <li>Install <a href=\"https://www.virtualbox.org/wiki/Downloads\">VirtualBox</a> on the\nWindows host</li>\n  <li>Clone <a href=\"https://github.com/cloudfoundry/bosh-deployment\">bosh-deployment</a></li>\n</ol>\n\n<h2 id=\"setup\">Setup</h2>\n\n<blockquote>\n  <p><strong>A word of caution</strong></p>\n\n  <p>Following this guide will necessarily alter the security model such that\nthe BOSH Director becomes routable to and from other virtual machines on\nthe host machine rather than just the host operating system. For typical\ndevelopment machines where running VMs are trusted, this should not be an\nissue.</p>\n</blockquote>\n\n<h3 id=\"enabling-the-hyper-v-windows-feature\">Enabling the Hyper-V Windows feature</h3>\n\n<p>This is needed to leverage Hyper-V’s vSwitch to expose a network adapter with\na routable IP address. Our VirtualBox VMs will attach to this network adapter\ninstead of VirtualBox’s host-only network.</p>\n\n<ol>\n  <li>Open “Turn Windows Features on or off” from the Start Menu.</li>\n  <li>Tick <code class=\"language-plaintext highlighter-rouge\">Hyper-V</code> and its sub-features.\n <img src=\"https://static.achrinza.com/media/articles/running-bosh-lite-on-windows-11/windows-feature-on-off-hyper-v.png\" alt=\"\" /></li>\n  <li>Press OK.</li>\n  <li>Restart the computer when instructed.</li>\n</ol>\n\n<h3 id=\"create-a-internal-hyper-v-vswitch-network\">Create a internal Hyper-V vSwitch network</h3>\n\n<ol>\n  <li>Open “Hyper-V Manager” from the Start Menu</li>\n  <li>\n    <p>Go to “Action” &gt; “Virtual Switch Manager”</p>\n\n    <p><img src=\"https://static.achrinza.com/media/articles/running-bosh-lite-on-windows-11/hyper-v-open-virtual-switch-manager.png\" alt=\"\" /></p>\n  </li>\n  <li>Under “Virtual Switches”, click on “New virtual network switch”</li>\n  <li>Select “Internal” type</li>\n  <li>Click “Create Virtual Switch”</li>\n  <li>Set a name for the new vSwitch</li>\n  <li>\n    <p>Click OK</p>\n\n    <p><img src=\"https://static.achrinza.com/media/articles/running-bosh-lite-on-windows-11/hyper-v-internal-network-config.png\" alt=\"\" /></p>\n  </li>\n</ol>\n\n<h3 id=\"making-the-network-adapter-routable\">Making the network adapter routable</h3>\n\n<blockquote>\n  <p><strong>Tip</strong></p>\n\n  <p>When creating a vSwitch in the previous section, a network adapter managed\nby Hyper-V (called “vEthernet”) is also created. Here, we’ll configure\nthis adapter to be routable.</p>\n</blockquote>\n\n<ol>\n  <li>Open “View network connections” from the Start Menu.</li>\n  <li>\n    <p>Right-click on the newly-created network adapter and click “Properties”. It\ncan be identified by the vSwitch name from the previous section:\n<code class=\"language-plaintext highlighter-rouge\">vEthernet (&lt;vSwitch Name&gt;)</code>.</p>\n\n    <p><img src=\"https://static.achrinza.com/media/articles/running-bosh-lite-on-windows-11/windows-network-connection.png\" alt=\"\" /></p>\n  </li>\n  <li>\n    <p>Note down the network adapter’s name listed under “Connect using”.</p>\n\n    <p><img src=\"https://static.achrinza.com/media/articles/running-bosh-lite-on-windows-11/windows-network-connection-properties.png\" alt=\"\" /></p>\n\n    <blockquote>\n      <p><strong>Note</strong></p>\n\n      <p>Your network adapter name may differ from the example.</p>\n    </blockquote>\n  </li>\n  <li>Double-click “Internet Protocol Version 4 (TCP/IPv4)” in the items list.</li>\n  <li>Select “Use the following IP address:”.</li>\n  <li>\n    <p>Set the IP address and subnet mask.</p>\n\n    <blockquote>\n      <p><strong>Note</strong></p>\n\n      <p>This example uses the subnet <code class=\"language-plaintext highlighter-rouge\">10.150.250.0/24</code>, though it can be\nconfigured to any unused subnet. <code class=\"language-plaintext highlighter-rouge\">192.168.56.0/24</code> is not used to avoid\nconflict with the default VirtualBox host-only network.</p>\n    </blockquote>\n\n    <p><img src=\"https://static.achrinza.com/media/articles/running-bosh-lite-on-windows-11/windows-network-connection-ipv4-properties.png\" alt=\"\" /></p>\n  </li>\n  <li>Click OK on both dialog boxes to save changes.</li>\n</ol>\n\n<h3 id=\"adding-vboxmanage-cli-to-wsl-2\">Adding <code class=\"language-plaintext highlighter-rouge\">VBoxManage</code> CLI to WSL 2</h3>\n\n<p>In the WSL 2 environment, add the <a href=\"https://git.sr.ht/~achrinza/vboxmanage-wsl2-wrapper\">VBoxManage WSL 2\nwrapper</a>:</p>\n\n<div class=\"language-shell highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code>curl <span class=\"nt\">-LO</span>  https://git.sr.ht/~achrinza/vboxmanage-wsl2-wrapper/blob/main/VBoxManage.sh\n<span class=\"nb\">chmod</span> +x VBoxManage.sh\n<span class=\"nb\">sudo mv </span>VBoxManage.sh /usr/local/bin/VBoxManage\n</code></pre></div></div>\n\n<h3 id=\"deploying-the-bosh-director\">Deploying the BOSH Director</h3>\n\n<p>Because the networking stack differs from what <code class=\"language-plaintext highlighter-rouge\">bosh-deployment</code> covers,\nwe’ll need to create a new Ops File:</p>\n\n<div class=\"language-yaml highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code><span class=\"c1\"># ./virtualbox-wsl2.yml</span>\n<span class=\"pi\">-</span> <span class=\"na\">name</span><span class=\"pi\">:</span> <span class=\"s\">/networks/name=default/subnets/0/cloud_properties?</span>\n  <span class=\"na\">type</span><span class=\"pi\">:</span> <span class=\"s\">replace</span>\n  <span class=\"na\">value</span><span class=\"pi\">:</span>\n    <span class=\"na\">type</span><span class=\"pi\">:</span> <span class=\"s\">bridged</span>\n    <span class=\"c1\"># Replace this with your network adapter name:</span>\n    <span class=\"na\">name</span><span class=\"pi\">:</span> <span class=\"s2\">\"</span><span class=\"s\">Hyper-V</span><span class=\"nv\"> </span><span class=\"s\">Virtual</span><span class=\"nv\"> </span><span class=\"s\">Ethernet</span><span class=\"nv\"> </span><span class=\"s\">Adapter</span><span class=\"nv\"> </span><span class=\"s\">#4\"</span>\n</code></pre></div></div>\n\n<blockquote>\n  <p><strong>Note</strong></p>\n\n  <p>Do not confuse this with the <em>vSwitch</em> name. The network adapter name is\nautogenerated and should start with <code class=\"language-plaintext highlighter-rouge\">Hyper-V Virtual Ethernet Adapter #</code>.</p>\n</blockquote>\n\n<p>From there, we can follow the <a href=\"https://bosh.io/docs/bosh-lite/#install\">standard VirtualBox\ndeployment</a>, appending\nour new Ops File and altering the <code class=\"language-plaintext highlighter-rouge\">internal</code> network variables:</p>\n\n<div class=\"language-diff highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code> bosh create-env ~/workspace/bosh-deployment/bosh.yml \\\n   --state ./state.json \\\n   -o ~/workspace/bosh-deployment/virtualbox/cpi.yml \\\n   -o ~/workspace/bosh-deployment/virtualbox/outbound-network.yml \\\n   -o ~/workspace/bosh-deployment/bosh-lite.yml \\\n   -o ~/workspace/bosh-deployment/bosh-lite-runc.yml \\\n   -o ~/workspace/bosh-deployment/uaa.yml \\\n   -o ~/workspace/bosh-deployment/credhub.yml \\\n   -o ~/workspace/bosh-deployment/jumpbox-user.yml \\\n<span class=\"gi\">+  -o ./virtualbox-wsl2.yml \\\n</span>   --vars-store ./creds.yml \\\n   -v director_name=bosh-lite \\\n<span class=\"gd\">-  -v internal_ip=192.168.56.6 \\\n-  -v internal_gw=192.168.56.1 \\\n-  -v internal_cidr=192.168.56.0/24 \\\n</span><span class=\"gi\">+  -v internal_ip=10.150.250.6 \\\n+  -v internal_gw=10.150.250.1 \\\n+  -v internal_cidr=10.150.250.0/24 \\\n</span>   -v outbound_network_name=NatNetwork\n</code></pre></div></div>\n\n<p>Then, we can alias the BOSH environment:</p>\n\n<div class=\"language-shell highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code><span class=\"nb\">export </span><span class=\"nv\">BOSH_CLIENT</span><span class=\"o\">=</span>admin\n<span class=\"nb\">export </span><span class=\"nv\">BOSH_CLIENT_SECRET</span><span class=\"o\">=</span><span class=\"s2\">\"</span><span class=\"si\">$(</span>bosh int ./creds.yml <span class=\"nt\">--path</span> /admin_password<span class=\"si\">)</span><span class=\"s2\">\"</span>\nbosh alias-env vbox <span class=\"nt\">-e</span> 10.150.250.6 <span class=\"nt\">--ca-cert</span> &lt;<span class=\"o\">(</span>bosh int ./creds.yml <span class=\"nt\">--path</span> /director_ssl/ca<span class=\"o\">)</span>\n</code></pre></div></div>\n\n<h2 id=\"next-steps\">Next steps</h2>\n\n<p>Now we have a functioning BOSH environment! To start testing out BOSH, we can\ntry the classic ZooKeeper deployment (with <a href=\"https://github.com/cppforlife/zookeeper-release/pull/16\">some\nmodifications</a>):</p>\n\n<div class=\"language-sh highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code>bosh <span class=\"nt\">-e</span> vbox update-cloud-config ~/workspace/bosh-deployment/warden/cloud-config.yml\n<span class=\"c\"># Get the latest `upload-stemcell` command from: https://bosh.io/stemcells/bosh-warden-boshlite-ubuntu-noble</span>\nbosh upload-stemcell <span class=\"nt\">--sha1</span> cda735071b3d91349b90ee3309ef8d16cfe2dc74 <span class=\"se\">\\</span>\n  <span class=\"s2\">\"https://bosh.io/d/stemcells/bosh-warden-boshlite-ubuntu-noble?v=1.460\"</span>\nbosh <span class=\"nt\">-e</span> vbox <span class=\"nt\">-d</span> zookeeper deploy &lt;<span class=\"o\">(</span>curl <span class=\"nt\">-L</span> https://github.com/achrinzafork/zookeeper-release/raw/b9a3df6abefb2a853738c99c200eaa93892f8f55/manifests/zookeeper.yml<span class=\"o\">)</span>\nbosh <span class=\"nt\">-e</span> vbox <span class=\"nt\">-d</span> zookeeper run-errand smoke-tests\n</code></pre></div></div>\n\n<h2 id=\"final-thoughts\">Final thoughts</h2>\n\n<p>BOSH is an underrated, mature tool for managing VMs, but getting started on\nWindows is more confusing than it needs to be. For me, this meant more time\nspent trying to set up BOSH before being able to actually learn it. The setup\ndescribed above is what I use today for local BOSH development on Windows - A\nquick way to get started with minimal fuss. That’s why I wrote this article\nwith a BOSH Lite explainer and a networking guide; It’s what I wish I knew\nwhen first starting with BOSH, and I hope it comes in handy for those who want\nto get started quickly.</p>\n",
      "date_published": "Fri, 17 Jul 2026 00:00:00 +0000"
      },
    
    {
      "id": "https://www.achrinza.com/blog/2024/08/05/protecting-against-malicious-dependencies-with-flatpak",
      "url": "https://www.achrinza.com/blog/2024/08/05/protecting-against-malicious-dependencies-with-flatpak",
      "title": "Protecting against malicious dependencies with Flatpak",
      "content_html": "<ul id=\"markdown-toc\">\n  <li><a href=\"#the-problem-with-modern-programming\" id=\"markdown-toc-the-problem-with-modern-programming\">The problem with modern programming</a></li>\n  <li><a href=\"#flatpak-sandboxing\" id=\"markdown-toc-flatpak-sandboxing\">Flatpak sandboxing</a></li>\n  <li><a href=\"#clamping-down-with-flatpak-overrides\" id=\"markdown-toc-clamping-down-with-flatpak-overrides\">Clamping down with Flatpak overrides</a></li>\n  <li><a href=\"#giving-granular-access\" id=\"markdown-toc-giving-granular-access\">Giving granular access</a></li>\n  <li><a href=\"#where-are-my-override-files\" id=\"markdown-toc-where-are-my-override-files\">Where are my override files?</a></li>\n  <li><a href=\"#limitations\" id=\"markdown-toc-limitations\">Limitations</a></li>\n  <li><a href=\"#in-conclusion\" id=\"markdown-toc-in-conclusion\">In conclusion</a></li>\n</ul>\n\n<p><a href=\"https://flatpak.org/\">Flatpak</a> is a great tool for installing user applications in a self contained environment without polluting the host machine. This mitigates a range of issues, notably <a href=\"https://en.wikipedia.org/wiki/Dependency_hell\">dependency hell</a>. There’s even packages for popular code editors such as VSCode/VSCodium and Emacs.</p>\n\n<p>In fact, I code in Emacs purely through Flatpak. Not for the above reasons per-se, but for something more valuable - <em>to contain the blast radius</em>.</p>\n\n<h2 id=\"the-problem-with-modern-programming\">The problem with modern programming</h2>\n\n<p>An issue that plagues vitually every software development project nowadays is the abundant use of third-party dependencies. This issue is more prevalent in some ecosystems such as Node.js where many small packages tend to be preferred over larger, batteries-included packages. This means more code written by many different people.</p>\n\n<p>It’s impossible to vet every single dependency and the intentions of their maintainers. Hence it becomes an exercise of trust that the maintainers protect their publishing credentials from compromise or to not go rogue. But every now and then, <a href=\"https://www.bleepingcomputer.com/news/security/big-sabotage-famous-npm-package-deletes-files-to-protest-ukraine-war/\">it happens</a>.</p>\n\n<p>These malicious packages can be quickly authored and easily compromise a developer’s machine and privileged credentials. Hence, we need a broad, defensive approach towards mitigating the impact of such a compromise.</p>\n\n<h2 id=\"flatpak-sandboxing\">Flatpak sandboxing</h2>\n\n<p>This is where Flatpak sandboxing comes in. It restricts an application’s ability to access certain resources such as network, dbus, devices, and filesystem - the last one’s what we’ll talk about.</p>\n\n<p>In a perfect world, Flatpak apps would be configured to use <a href=\"https://docs.flatpak.org/en/latest/portal-api-reference.html\">Flatpak Portals</a> - A mechanism to give granular, just-in-time access to a certain directory or file in the host file system with explicit user consent. However, anecdotally most apps don’t support Portals. Furthermore, the subtle incompatibilities with certain tools and the inability to auto-revoke the access at the end of each session makes the experience feel especially clunky.</p>\n\n<p>As a compromise, it is by convention, that most Flatpak developer-centric apps are pre-configured with broad filesystem access. This provides out-of-the-box usability without the need for Portals. This does mean that the app environment can interact with most of the host filesystem.</p>\n\n<p>We can see the permissions with <code class=\"language-plaintext highlighter-rouge\">flatpak info --show-permissions &lt;app-id&gt;</code>:</p>\n\n<div class=\"language-sh highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code><span class=\"nv\">$ </span>flatpak info <span class=\"nt\">--user</span> <span class=\"nt\">--show-permissions</span> org.gnu.emacs\n<span class=\"o\">[</span>Context]\n<span class=\"nv\">shared</span><span class=\"o\">=</span>network<span class=\"p\">;</span>ipc<span class=\"p\">;</span>\n<span class=\"nv\">sockets</span><span class=\"o\">=</span>x11<span class=\"p\">;</span>pulseaudio<span class=\"p\">;</span>\n<span class=\"nv\">filesystems</span><span class=\"o\">=</span>/var/tmp<span class=\"p\">;</span>/tmp<span class=\"p\">;</span>host<span class=\"p\">;</span>\n\n<span class=\"o\">[</span>Session Bus Policy]\norg.freedesktop.Flatpak<span class=\"o\">=</span>talk\n</code></pre></div></div>\n\n<p>As we can see, my Flatpak-installed Emacs has access to the entire <code class=\"language-plaintext highlighter-rouge\">host</code> filesystem. If you’d like to learn more about these permissions, the <a href=\"https://docs.flatpak.org/en/latest/sandbox-permissions.html#filesystem-access\">Flatpak docs</a> is a great reference.</p>\n\n<p>Also note that I’m using the <code class=\"language-plaintext highlighter-rouge\">--user</code> flag as I did not install Emacs system-wide. If your app is installed system-wide, omit this flag.</p>\n\n<h2 id=\"clamping-down-with-flatpak-overrides\">Clamping down with Flatpak overrides</h2>\n\n<p>As the name suggests, Flatpak overrides allow us to override the default permissions. If we want to block <code class=\"language-plaintext highlighter-rouge\">host</code> filesystem access, we simply counter it with its negative:</p>\n\n<div class=\"language-sh highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code><span class=\"nv\">$ </span>flatpak override <span class=\"nt\">--user</span> <span class=\"nt\">--nofilesystem</span><span class=\"o\">=</span>host org.gnu.emacs\n</code></pre></div></div>\n\n<p>Running the same <code class=\"language-plaintext highlighter-rouge\">flatpak info</code> command as above, we can see the <code class=\"language-plaintext highlighter-rouge\">host</code> filesystem is no longer there:</p>\n\n<div class=\"language-plaintext highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code>$ flatpak info --user --show-permissions org.gnu.emacs\n[Context]\nshared=network;ipc;\nsockets=x11;pulseaudio;\nfilesystems=/var/tmp;/tmp;\n\n[Session Bus Policy]\norg.freedesktop.Flatpak=talk\n</code></pre></div></div>\n\n<blockquote>\n  <p>Note: When performing <code class=\"language-plaintext highlighter-rouge\">flatpak override</code>, double-check that the app name is spelled correctly. Flatpak does not verify if the app actually exists! To fix this, simply re-run the command with the correct app name. Though there’s still a stray override config that we might want to delete - I’ll explain how to find and delete it below.</p>\n</blockquote>\n\n<p>If we now create a new file in Flatpak Emacs, the file does not appear in the host filesystem. Instead, it’s saved in an ephemeral filesystem that gets wiped when this instance of Emacs is closed.</p>\n\n<h2 id=\"giving-granular-access\">Giving granular access</h2>\n\n<p>To give granular access to the filesystem, we need to decide what that granularity is. For me, access is given on a per-project basis (i.e. per-Git repository). This is a good compromise as it prevent unwanted access and alteration of other projects whilst allowing the tools in the active project to function correctly.</p>\n\n<p>With this setup, whenever we want to work on a project we can simply run these commands:</p>\n\n<div class=\"language-sh highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code><span class=\"nv\">$ </span><span class=\"nb\">cd</span> &lt;project directory&gt;\n<span class=\"nv\">$ </span>flatpak run <span class=\"nt\">--user</span> <span class=\"nt\">--filesystem</span><span class=\"o\">=</span><span class=\"s2\">\"</span><span class=\"si\">$(</span><span class=\"nb\">pwd</span><span class=\"si\">)</span><span class=\"s2\">\"</span> org.gnu.emacs\n</code></pre></div></div>\n\n<p>The main difference is the addition of <code class=\"language-plaintext highlighter-rouge\">--filesystem=\"$(pwd)\"</code> which gets the current working directory (via <code class=\"language-plaintext highlighter-rouge\">pwd</code>), and tells Flatpak to perform a one-time override to allow filesystem access. This override only applies to that instance of the app, and we can open multiple projects on separate instances with access to different parts of filesystem - no cross-mingling of permissions.</p>\n\n<p>We can even package this into a wrapper called <code class=\"language-plaintext highlighter-rouge\">emc</code> (my shorthand for Emacs):</p>\n\n<div class=\"language-sh highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code><span class=\"nv\">$ </span><span class=\"nb\">sudo </span>su <span class=\"nt\">-c</span> <span class=\"s1\">'cat &lt;&lt;EOF &gt;&gt;/usr/local/bin/emc\n#!/bin/sh\nflatpak run --user --filesystem=\"$(pwd)\" org.gnu.emacs @\nEOF'</span>\n\n<span class=\"nv\">$ </span><span class=\"nb\">sudo chmod</span> +x /usr/local/bin/emc\n</code></pre></div></div>\n\n<p>Now we can give just-in-time, granular access just as easily as starting any other programme:</p>\n\n<pre><code class=\"language-shpp\">$ cd &lt;project directory&gt;\n$ emc\n</code></pre>\n\n<h2 id=\"where-are-my-override-files\">Where are my override files?</h2>\n\n<p><code class=\"language-plaintext highlighter-rouge\">flatpak override</code> is quite rudementary, and it’s easy to make mistakes like typos in the app name. This can lead to stray or cluttered override files. Their location depends if the override was done with the <code class=\"language-plaintext highlighter-rouge\">--user</code> or <code class=\"language-plaintext highlighter-rouge\">--system</code> flag (no flag defaults to <code class=\"language-plaintext highlighter-rouge\">--system</code>).</p>\n\n<ul>\n  <li>For apps installed system-wide: <code class=\"language-plaintext highlighter-rouge\">/var/lib/flatpak/overrides/&lt;app-id&gt;</code></li>\n  <li>For apps installed per-user: <code class=\"language-plaintext highlighter-rouge\">~/.local/share/flatpak/overrides/&lt;app-id&gt;</code></li>\n</ul>\n\n<p>If we inspect the file, we can see that it contains our overrides, and has the same syntax as the output of <code class=\"language-plaintext highlighter-rouge\">flatpak info --show-permissions</code>:</p>\n\n<div class=\"language-plaintext highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code>$ cat ~/.local/share/flatpak/overrides/org.gnu.emacs\n[Context]\nfilesystems=!host;\n</code></pre></div></div>\n\n<p>We can modify this file by hand, or even delete it entirely if we want to get back the default permissions.</p>\n\n<h2 id=\"limitations\">Limitations</h2>\n\n<p>There are some limitations that I’ve personally stumbled into:</p>\n\n<ol>\n  <li>With certain apps, the overrides is unable to handle multiple instances. I’ve previously observed this with VSCodium, but I’m not sure if this issues still persists. It does not affect Emacs.</li>\n  <li>For apps that use Flatpak Portals, <a href=\"https://github.com/flatpak/flatpak/issues/3977\">it is not possible to disable Portals</a>, so you’ll need to manaully revoke the portals each session with <code class=\"language-plaintext highlighter-rouge\">flatpak document-unexport</code>. Automating this is left as an exercise for the reader.</li>\n</ol>\n\n<h2 id=\"in-conclusion\">In conclusion</h2>\n\n<p>Flatpak can be a simple but powerful tool to protect yourself from the impact of running malicious code. It’s not a full replacement for a true-sandboxed virtual machine environment nor for a proper antivirus solution, but it can signficantly mitigate the reach of the malware. When you get compromised, killing the Flatpak instance, then re-cloning the project should be enough for trivial cases.</p>\n\n<p>This just-in-time approach to filesystem sandboxing is something I use daily, and its ease of use has made it an easy habit to adopt with little downsides. If you’re just starting out on your Flatpak journey, or have already used it for a while, I hope this guide help you learn how you can control Flatpak to improve your security posture.</p>\n",
      "date_published": "Mon, 05 Aug 2024 00:00:00 +0000"
      },
    
    {
      "id": "https://www.achrinza.com/blog/2024/08/02/a-site-refresh",
      "url": "https://www.achrinza.com/blog/2024/08/02/a-site-refresh",
      "title": "A site refresh",
      "content_html": "<ul id=\"markdown-toc\">\n  <li><a href=\"#deciding-the-design\" id=\"markdown-toc-deciding-the-design\">Deciding the design</a></li>\n  <li><a href=\"#deciding-on-a-stack\" id=\"markdown-toc-deciding-on-a-stack\">Deciding on a stack</a></li>\n  <li><a href=\"#what-now\" id=\"markdown-toc-what-now\">What now?</a></li>\n</ul>\n\n<p>It’s been a while, and that means it’s time for a website refresh!</p>\n\n<p>The previous iteration of my personal website served its needs well - It was simple, a single page, and contained my a breif introducer, and how to reach out to me.</p>\n\n<p>Since then, I’ve continued to grow professionally and personally - I got my Diploma, took up my certifications, and had been on the job a bit longer. In addition, I wanted to share my knowledge and personal experiences - many of which are kept in my personal notes -  for others to read.</p>\n\n<p>The old website was no longer feasible - It was a plain HTML file crafted by hand, and did not have any blogging capabilities.</p>\n\n<p>Hence, the website you’re reading this on was born.</p>\n\n<h2 id=\"deciding-the-design\">Deciding the design</h2>\n\n<p>I wanted the design to be personal, yet easy to manage. Thus a content-first style was created.</p>\n\n<p>It retains the same simplicity as my previous website with few distractions and content right in the center. This works with the content-heavy nature of the website and is one I hope people can appreciate.</p>\n\n<p>If I were a website designer, it may have had more bling, but designer I am not. Though admittedly it’s still quite… empty. Nonetheless, it’s a starting point so that I can start publishing new content sooner than later, and I do plan to make minor tweaks and give it more personality over time.</p>\n\n<h2 id=\"deciding-on-a-stack\">Deciding on a stack</h2>\n\n<p>I wanted the most control over the generated HTML, without the bloat of unecessary JavaScript that comes with front-end frameworks. Naturally, a static site generator was a good fit - Most include a blogging feature, and don’t inject unecessary stuffs.</p>\n\n<p>As to why Jekyll? It was what’s most familiar. I may consider switching to Eleventy, but for now this’ll suffice.</p>\n\n<h2 id=\"what-now\">What now?</h2>\n\n<p>I intend to start pubishing on this blog with some frequency, maybe once a week or so. Whether its technical guides, personal experiences, or just some random topic, I hope this would encourage me to write, and learn how to better express my thoughts into something more engaging and readable over time.</p>\n\n<p>Or at least, that’s the intended goal. We’ll see how it goes.</p>\n",
      "date_published": "Fri, 02 Aug 2024 00:00:00 +0000"
      }
    
  ]
}
