Compiling win32 assembly on OpenBSD

Recently I’ve finished the Practical Malware Analysis book and I’ve wanted to familiarise myself a bit more with the Win32 API. After spending a good amount of time on setting up Visual Studio C++ for MASM (Microsoft Macro Assembler) I wanted to stab myself in the eye with a rusty fork due to the overload of visual clutter. Alas, running plain MASM on Windows 10 seems to be a no-go these days.

WireGuard on OpenBSD

Earlier this week I imported a port for WireGuard into the OpenBSD ports tree. At the moment we have the userland daemon and the tools available. The in-kernel implementation is only available for Linux. At the time of writing there are packages available for -current.As of June 2020 support for WireGuard has been committed to the kernel as wg(4) along with support in ifconfig(8). Please see these two posts on the WireGuard mailinglist on how to set it up or how migrate from a setup as described below: setup and migrate from Linux.

nasm on OpenBSD

Recently I decided to study for the SLAE64 course from Pentester Academy to work on my assembly knowledge, specifically on x86_64. Through the course does focus on Linux I want to apply the knowledge to OpenBSD/amd64 too and thus I installed NASM and looked at what I needed to adjust on my Linux samples to get it working on OpenBSD. Turns out, not that much actually! Both operating systems use same calling convention, namely the System V AMD64 ABI.

Setting up NetBox on OpenBSD

The following documents the steps needed to setup NetBox on OpenBSD. I am running NetBox on a PC Engines APU which holds up fairly well and I have since migrated my own setup from RackTables to NetBox, primarily because of the API functionality NetBox offers which allows for integration with SaltStack. But more on that some other time. I have ported a few dependencies but gave up after realising all of the Django applications/modules needed to be ported including their dependencies.

OpenBSD pkg.conf installpath handling with Ansible

Probably everyone using Ansible on OpenBSD figured this out already, but I thought it was quite a nifty application of Jinja templating. The way pkg.conf is built when using multiple installpath lines is: installpath = mirror1 installpath += mirror2 The template I settled on is: {# Magic for handling the '=' vs '+=' #} {% if 'installpath' in base_openbsd_pkgconf %} {% set first = True -%} {% for i in base_openbsd_pkgconf['installpath'] %} installpath {% if not first %}+{% endif %}= {{ i }} {% set first = False -%} {% endfor -%} {% endif -%} Where base_openbsd_conf[‘installpath’] is an array of mirror addresses:

OpenBSD (U)EFI bootloader howto

Here’s a quick howto of getting started with the new UEFI bootloader support in OpenBSD -current. This does assume the entire disk will be allocated by OpenBSD. Dual-booting in an UEFI setup requires extra steps which are not covered here. By far the easiest method is to copy the miniroot58.fs to a USB stick and boot from it. This already includes an EFI boot partition so to be sure the BIOS can correctly boot the new bootloader, start by disabling the Legacy boot option in the BIOS.

Portscout for OpenBSD

Portscout is a neat tool that scans an entire ports tree and then checks the upstream sites for any new releases. This tool was originally written for FreeBSD and this weekend I hacked it up to work on the OpenBSD ports tree too. Welcome, OpenBSD! While adding initial OpenBSD support was surprisingly easy once a few small issues were sorted out (use show=FOO\ BAR instead of chaining -V FOO -V BAR) I actually added some new features to it.