Puffy Spezial

Page content

Some OpenBSD Tipps and Trick. But you better check the Blogs directly … this may also works on other platforms

PF Rule Expander

# ipv4
echo "pass log inet proto tcp from any to self port 22" |pfctl -nvf - |sort

# ipv6
echo "pass log inet proto tcp from any to self port 22" |pfctl -nvf - |sort

# dualstack
echo "pass log proto tcp from any to self port 22" |pfctl -nvf - |sort

remove File based on Inode

you have files with strange name which you can’t delete. try this.

ls -il -> grab nr
mynr=xxx
find . -inum $mynr -exec ls -i {} \;
find . -inum $mynr -exec rm -i {} \;

boot from usb stick

if you attach your usb stick, you will get an additional drive, here hd1+. you can boot from this stick and do a fresh install, upgrade, autoinstall as you want :)

Using drive 0, partition 3.
Loading......
probing: pc0 com0 com1 mem[638K 1918M a20=on]
disk: hd0+ hd1+
>> OpenBSD/amd64 BOOT 3.33
boot> boot hd1d:/bsd.rd

Backup File

simple backup a file with shell expanding

doas cp /etc/hosts{,.bak}

Test SSH Config and Failback

need to test a config and failback if you locked out yourself ? -> you’ve got two minutes to reattach tmux and stop the command or your sshd_config will fail back :)

cd /etc/ssh
cp sshd_config{,.bak}
update your sshd_config with your dirty hack
tmux
rcctl restart sshd && sleep 120 && mv sshd_config{.bak,} && rcctl restart sshd

Count Open File Descriptors for Process ID

# fstat -np 43704 |echo $(($(wc -l)-1))
204

8 Port USB/Serial Box, how to activate Port 5-8

cd /dev; ./MAKEDEV ttyU4 ttyU5 ttyU6 ttyU7

OpenBSD Crontab

@reboot
Run once, at startup
@yearly   Every January 1 (0 0 1 1 *)
@monthly  Run the first day of every month (0 0 1 * *)
@weekly   Run every Sunday (0 0 * * 0)
@daily    Run every (0 0 * * *)
@hourly   Every hour (0 * * * *)

ASCII to binary

$ echo ASCII to binary | xxd -b -c1 | cut -d\  -f2
01000001
01010011
01000011
...

OpenBSD hier — layout of filesystems

hier manpage

Default Mail Forwarder

echo gott@world.net > $HOME/.forward

is your host ready for virtualization ?

dmesg | egrep ‘(VMX/EPT|SVM/RVI)’

Firmware for APU

https://pcengines.github.io/

or local mirror

Firmware for APU2/APU3/APU4

sha256: 53b906dbf9f592d6c9af204636061b54e148816d70ae512da1a507096b90594c