OpenBSD

2023/04/16

Categories: technology Tags: openbsd peervpn

OpenBSD initial setup

Some steps that I take when setting up OpenBSD system

First of all, some useful links (yes, I know that the OpenBSD documentaiton is excellent, but sometimes a blogpost is helpful also!).

PeerVPN

I’ve a guide on setting up peervpn here: https://acronymchile.com/post/2018/07/18/peervpn/ Most of that still applies to OpenBSD. I needed to make one small change In the file platform/io.c (two lines added):

#if defined(__FreeBSD__)
#define IO_BSD
/*
Next two lines added... 
*/
#elif defined(__OpenBSD__)
#define IO_BSD
#elif defined(__APPLE__)
#define IO_BSD
#elif defined(WIN32)
#define IO_WINDOWS
#ifdef WINVER
#if WINVER < 0x0501
#undef WINVER
#endif

Based on that, things compile just fine.

In configuration, the device must be a tapfile (e.g. tap1). Otherwise, nothing special required.

To enable the service, you need a file in /etc/rc.d such as the following (depends on specific paths, of course)

#!/bin/ksh

daemon="/usr/local/bin/peervpn /etc/peervpn/peervpn_joy_configfile.conf"

. /etc/rc.d/rc.subr

rc_cmd $1

Can then start/stop/enable the service with commands like

doas rcctl start peervpn
doas rcctl stop peervpn
doas rcctl enable peervpn

Dotfiles and Fossil

I’ve started keeping dotfiles in a fossil repository (just been giving fossil a go). Of course, because this is the only fossil repository, I couldn’t remember quickly how to clone it.

fossil clone ssh://user@hostname//path_info/FossilRepos/mc_dotfiles_rep.fossil \
    ~/FossilRepos/mc_dotfiles_rep.fossil
mkdir ~/mc_dotfiles && cd ~/mc_dotfiles
fossil open ~/FossilRepos/mc_dotfiles_rep.fossil
doas pkg_add stow

and so on… (note, host-names and details of paths removed)

XFCE and desktop

I’m lifting heavily from https://www.birkey.co/2022-01-29-openbsd-7-xfce-desktop.html for these instructions

doas pkg_add xfce xfce-extras
doas usermod -G operator <user>
doas usermod -G wheel <user>
echo "exec startxfce4" >> ~/.xsession
## In reality, you probably want ">", but I'm always a bit nervous of
## that and so prefer to play it safe...
>> Home