UP | HOME

Deftly.net

Table of Contents

Unlocking SSH FIDO keys on device connect.   OpenSSH YubiKey OpenBSD

OpenSSH - Configuring FIDO2 Resident Keys   OpenSSH YubiKey

Websockets with OpenBSD's relayd   OpenBSD relayd

date: Wed, 23 Oct 2019 08:00:00 MST

Test packages for Node on OpenBSD   OpenBSD Node js

description: Have your nodes and eat them too! tags: OpenBSD,Node.js date: Thu, 30 Aug 2018 08:00:00 MST

OpenBSD on the Lenovo A485   OpenBSD Hardware

description: Hack up or put up! tags: OpenBSD,Hardware date: Mon, 15 Oct 2018 08:00:00 MST

I am going to attempt to do a jcs@ style review of the Lenovo A485. I have stolen his format, slacked on detail.. and generally not done as good of a job reviewing as he has. Please check out his work at [jcs.org](https://jcs.org)

Passing off the Complexity   OpenBSD Passwords

description: How I have settled into the pass ecosystem. tags: OpenBSD,Passwords date: Fri, 29 Dec 2017 08:00:00 MST

Using cabal on OpenBSD   OpenBSD Software Haskell

description: Quick rundown for using cabal in a WX'd world. tags: OpenBSD,Software,Haskell date: Tue, 12 Sep 2017 16:35:00 MDT

Since [WX became mandatory](https://undeadly.org/cgi?action=article&sid=20160527203200) in OpenBSD, WX'd binaries are only allowed to be executed from designated locations (mount points). If you used the auto partition layout during install, your `/usr/local/` will be mounted with `wxallowed`. For example, here is the entry for my current machine:

``` /dev/sd2g on /usr/local type ffs (local, nodev, wxallowed, softdep) ```

This is a great feature, but if you build applications outside of the `wxallowed` partition, you are going to run into some issues, especially in the case of `cabal` (python as well).

Here is an example of what you would see when attempting to do `cabal install pandoc`:

``` qbit@slip[1]:~λ cabal update Config file path source is default config file. Config file home/qbit.cabal/config not found. Writing default configuration to home/qbit.cabal/config Downloading the latest package list from hackage.haskell.org qbit@slip[0]:~λ cabal install pandoc Resolving dependencies… ….. cabal: user error (Error: some packages failed to install: JuicyPixels-3.2.8.3 failed during the configure step. The exception was: home/qbit.cabal/setup-exe-cache/setup-Simple-Cabal-1.22.5.0-x8664-openbsd-ghc-7.10.3: runProcess: runInteractiveProcess: exec: permission denied (Permission denied) ```

The error isn't actually what it says. The untrained eye would assume permissions issue. A quick check of `dmesg` reveals what is really happening:

``` home/qbit.cabal/setup-exe-cache/setup-Simple-Cabal-1.22.5.0-x8664-openbsd-ghc-7.10.3(22924): WX binary outside wxallowed mountpoint ```

OpenBSD is killing the above binary because it is violating WX and hasn't been safely kept in its `/usr/local` corral!

We could solve this problem quickly by marking our `/home` as `wxallowed`, however, this would be heavy handed and reckless (we don't want to allow other potentially unsafe binaries to execute.. just the cabal stuff).

Instead, we will build all our cabal stuff in `/usr/local` by using a symlink!

``` doas mkdir -p /usr/local/{cabal,cabal/build} # make our cabal and build dirs doas chown -R user:wheel usr/local/cabal # set perms rm -rf ~.cabal # kill the old non-working cabal ln -s usr/local/cabal ~.cabal # link it! ```

We are almost there! Some cabal packages build outside of `~/.cabal`:

``` cabal install hakyll ….. Building foundation-0.0.14… Preprocessing library foundation-0.0.14… hsc2hs: dist/build/Foundation/System/Bindings/Posixhscmake: runProcess: runInteractiveProcess: exec: permission denied (Permission denied) Downloading time-locale-compat-0.1.1.3… ….. ```

Fortunately, all of the packages I have come across that do this all respect the `TMPDIR` environment variable!

``` alias cabal='env TMPDIR=/usr/local/cabal/build/ cabal' ```

With this alias, you should be able to cabal without issue (so far pandoc, shellcheck and hakyll have all built fine)!

## TL;DR

```

doas mkdir -p /usr/local/{cabal,cabal/build} doas chown -R user:wheel usr/local/cabal rm -rf ~.cabal ln -s usr/local/cabal ~.cabal alias cabal='env TMPDIR=/usr/local/cabal/build/ cabal' cabal install pandoc ```

Measuring the weight of an electron   OpenBSD Electron Software

description: Electrons are small, should be easy. Right?! tags: OpenBSD,Electron,Software date: Thu, 01 Jun 2017 07:18:00 MST

I am going to "Measure the weight of an electron"! By "weight", I mean what it takes to make [Electron](https://github.com/electron/electron) work on OpenBSD.

*This is a long rant. A rant intended to document lunacy, hopefully aid others in the future and make myself fell better about something I think is crazy. It may seem like I am making an enemy of electron, but keep in mind that isn't my intention! The enemy here, is complexity!*

My friend Henry, a canary, is coming along for the ride!

Tab completion in OpenBSD's ksh   OpenBSD ksh

description: How did I not know about this until now!? tags: OpenBSD,ksh date: Mon, 01 May 2017 17:18:00 MST

SSH Fingerprint Verification via Tor   SSH Tor

description: Using Tor to validate SSH fingerprints. tags: SSH,Tor date: Mon, 27 Feb 2017 09:30:00 MST

Why I Run OpenBSD   OpenBSD Linux

description: A story of how OpenBSD came to be my favorite OS. tags: OpenBSD,Linux date: Tue, 31 May 2016 15:04:05 MST

This post is about my journey down the OS rabbit hole and how it landed me in OpenBSD land as a happy and productive user.

It contains information that is highly opinionated, wildly inaccurate, mostly speculation. It is, after all, on the internet!

On Shells and Static Paths   Shell OpenBSD

description: How static paths are actively harming the industry. tags: Shell,OpenBSD date: Tue, 26 Apr 2016 00:00:00 UTC

> ***In a previous post, I told people not to start their scripts with `#!/bin/bash`. In this post, I will explain in more detail why you shouldn't do this if you want your script to be portable!***

Operating systems, they are neat, aren't they? So much diversity, so many options! Don't like the shell that comes stock on your OS because it doesn't connect to the internet, download a list of packages that might be similar to a mistyped command you haphazardly pasted into your terminal? Great, you can install one that does! So many options!

With all these options available to us, how can someone settle on a single PATH to contain all this greatness? Why put `bash` in `/bin`? Why not `/opt/fancy/oh-bash-my-face/bin`?

Well.. lets not get crazy here… That's clearly a terrible location for `bash`, no way it's standard!

pledge(2)'ing Xmonad   OpenBSD

description: Bringing OpenBSD's pledge(2) to Xmonad tags: OpenBSD date: Sun, 06 Mar 2016 12:00:00 MST

Experiments in Wood Carving   Carving Ceder

description: Using ceder to create a beard comb! tags: Carving,Ceder date: Sat, 23 Jan 2016 12:00:00 MST

Setting up networking on OpenBSD hosted VMs   OpenBSD

description: Quick tutorial on networking OpenBSD VMs tags: OpenBSD date: Sat, 14 Nov 2015 12:00:00 MST

With OpenBSD getting a [native hypervisor](http://undeadly.org/cgi?action=article&sid=20151101223132), I figured I would quickly describe my setup for allowing the VMs to access network resources!

This setup is using NAT and IP forwarding.

First thing, enable forwarding:

doas echo "net.inet.ip.forwarding=1" >> /etc/sysctl.conf
# Only run the above if you want this all to start at boot
sysctl net.inet.ip.forwarding=1

Next we need to configure a [tap](http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man4/tap.4?query=tap) interface at `tap0`.

`cat /etc/hostname.tap0`:

inet 10.10.10.1 255.255.255.0 up

Now tell `pf` what to do with the packets coming from the `tap0` interface:

match out on $extif inet from tap0:network nat-to ($extif)

At this point, you could just manually assign ips to your VMs when booting / installing.

For a bit more automation, we can run `dhcpd` on the `tap0` interface: `cat /etc/dhcpd.conf`

option domain-name "vm.bolddaemon"; option domain-name-servers 8.8.8.8, 8.8.4.4;

subnet 10.10.10.0 netmask 255.255.255.0 { option routers 10.10.10.1; range 10.10.10.5 10.10.10.30; }

Pretty nifty, and all of it is in base (on amd64 and i386)!!

Experiments in Bone Carving - Hei matau   Carving Bone

description: Experiment 2 in bone carving, a Māori fish hook tags: Carving,Bone date: Sat, 21 Mar 2015 12:00:00 MST

Round two in my experiments with bone carving is a [Hei matau](https://en.wikipedia.org/wiki/Hei_matau) - a stylised fish hook from Māori legend. I still have quite a bit of finishing to do, but the general shape is complete!

The bone I used (part of a femur) to create this piece is much more suitable to carving than the [rib bone](/posts/2015-03-08-bone-carving-experiment-one.html) I had previously used in for the beard comb. It is extremely strong!

The next steps are to finish off the edging and polish!

![Front](/images/bone-front.jpg)

![Back](/images/bone-back.jpg)

Experiments in Coffee Roasting   Coffee Roasting

description: First record of coffee roasting experiments. tags: Coffee,Roasting date: Sun, 15 Mar 2015 12:00:00 MST

Experiments in Bone Carving - part one   Carving Bone

description: Bone carving failure with a side of success! tags: Carving,Bone date: Sun, 08 Mar 2015 12:00:00 MST

Revisiting the PicoLCD 256x64   OpenBSD

description: Officially added the code to make picoLCD work! tags: OpenBSD date: Thu, 20 Mar 2014 12:00:00 MST

![OpenBSD Banner](/images/banner1.gif)

Today marks my first commits ([1](http://www.openbsd.org/cgi-bin/cvsweb/src/sys/dev/usb/usbdevs.diff?r1=1.626;r2=1.627;f=h), [2](http://www.openbsd.org/cgi-bin/cvsweb/src/sys/dev/usb/usbdevs.h.diff?r1=1.638;r2=1.639;f=h), [3](http://www.openbsd.org/cgi-bin/cvsweb/src/sys/dev/usb/usb_quirks.c.diff?r1=1.72;r2=1.73;f=h)) to the OpenBSD `src` tree (up until now it has all bee in `ports` and one in `www`)!

add USBPRODUCTITUNERUSBLCD256x64 as UQBADHID so libusb can talk via interrupt transfers

OK sthen@

The last commit makes the PicoLCD 256x64 not attach as a `HID`, so that it can be used by applications that talk to usb devices with `libusb`!

The next step is to finish up the lcdproc driver for it - currently I can only turn on or of the backlight and +,- the contrast!

Hey Kid, I'ma Interpreter!! Stop all the static interpreter referenci'n!   Scripting OpenBSD

description: Please stop using '/bin/bash'! tags: Scripting,OpenBSD date: Mon, 17 Mar 2014 12:00:00 MST

If you have ever explicitly set the path of an interpreter at the top of a script.. This post is about you.

Using a picoLCD 256×64 on OpenBSD 4.7   OpenBSD

description: Bit of hacking to get the picoLCD working on OpenBSD tags: OpenBSD date: Thu, 12 Jan 2012 12:00:00 MST

The first thing you will notice if you connect your fancy picoLCD 256×64 to your OpenBSD box, is that it shows up as a Human Interface Device.

Unfortunately libusb doesn’t know what to do with devices on bsd systems that are NOT using the ugen driver:

464     if (strncmp(di.udi_devnames[0], "ugen", 4) != 0)
465       /* best not to play with things we don't understand */
466       continue;

Fine libusb! We will have to come up with another way to use this screen! OR! We could tell OpenBSD to use ugen when ever it sees the lcd! :D

To do that – you need the the OpenBSD source, knowledge of how to build Open’s kernel, and my patch! Getting the source is beyond the scope of this little post.. so you will have to rtfm that action.

  1. cd to the usb source directory: cd /usr/src/sys/dev/usb
  2. Download the patch ( md5: 85e7498826635c612ede672f5e295e7a ): [picoLCD256x64.patch]( http://qbit.devio.us/picoLCD256x64.patch).
  3. Apply said patch: patch -p1 < picoLCD256x64.patch
  4. pkgadd libusb
  5. Compile your kernel, install and reboot!
  6. Once you are running your freshly compiled kernel, download the lcd4linux-256×64 source from http://picolcd.com/drivers/ . Apply this patch ( md5: 3852103e3e5a13a3cd6b0c49389688f6 ): [lcd4linux-256×64.patch](http://qbit.devio.us/lcd4linux-256x64.patch), compile ( You will have to play around with the plugins as some of them use linux’s proc fs and are not compatible with OpenBSD ).

Now check out the sample config files and have fun!

Using VIM to make erlang pretty   Erlang Vim

description: Quick hack to format erlang code in vim tags: Vim,Erlang date: Fri, 12 Mar 2010 12:15:00 MST

I recently read an article ( Which no longer exists ) talking about purtifying erlang. This inspired me to create a quick function in vim to do this for me! Here it is:

function! ErlPretty()
    silent !erl -noshell -eval 'erl_tidy:file("%",[verbose]).' -s erlang halt
endfunction
nmap ep :execute ErlPretty()

Concurrent Hello with Erlang   Erlang

description: A concurrent Hello World with Erlang date: Fri, 12 Mar 2010 12:01:00 MST

I recently picked up a copy of Joe Armstrong’s superb Programming Erlang book ( from the folks @ pragprog.com ). While reading the chapter on concurrent programming I was completely stumped by one of the examples. It basically creates a “server” and “client” and allows for message passing between the two. I found it very difficult to follow the passing of messages from a to b, and back.

Enter `chello.erl`! I created a slightly modified version of Joe’s example that uses some `io:format` to tell you what’s going on. Hope someone finds this useful.

-module (chello).
-export ([loop/0, rpc/2]).

rpc(Pid, Request) ->
    io:format("rpc[~p]  sending ~p to ~p~n", [self(), Request, Pid]),
    Pid ! {self(), Request},
    receive
	Response ->
	    io:format("rpc[~p]  responding with : ~p~n", [self(), Response]),
	    {Pid,Response}
    end.

loop() ->
receive
    {From, {hello}} ->
	io:format("loop[~p] received info from: ~p~n", [self(), From]),
	From ! {self(), "Hello"},
	loop();
    {From, {goodbye}} ->
	io:format("loop[~p] received info from: ~p~n", [self(), From]),
	From ! {self(),"Goodbye"},
	loop();
    {From, Other} ->
	io:format("loop[~p] received info from: ~p~n", [self, From]),
	From ! {self(),{error, Other}},
	loop()
    end.

Run from the erl shell with:

1> Pid = spawn(fun chello:loop/0).

<0.38.0>

2> chello:rpc(Pid, {hello}).
rpc[<0.31.0>] sending {hello} to <0.38.0>

loop[<0.38.0>] received info from: <0.31.0>

rpc[<0.31.0>] responding with : {<0.38.0>,”Hello”}

{<0.38.0>,{<0.38.0>,”Hello”}}

Author: Aaron Bieber

Created: 2021-02-10 Wed 17:45

Validate