Perl

From securityrouter.org, an OpenBSD-based firewall
Jump to: navigation, search

OpenBSD ships with Perl by default (as part of base) but is removed as part of the security router release script. It's however required by some system tools such as pkg_add, and in order to use these you need to re-add Perl by following the guide below.

Installing Perl

Enable root access and log in using for example SSH, video or serial console, then follow one of the two guides below (with or without verification). You can replace ftp.openbsd.org with a local mirror such as ftp.eu.openbsd.org for a faster download.

Install Perl with verification

This method installs Perl, and verifies the downloaded data before doing so. Thus, it requires additional temporary disk space.

RELEASEDOT=`uname -r`
RELEASE=$(echo $RELEASEDOT | tr -d .)
cd /root
mount -uw /
ftp http://ftp.openbsd.org/pub/OpenBSD/$RELEASEDOT/`uname -m`/SHA256.sig
ftp http://ftp.openbsd.org/pub/OpenBSD/$RELEASEDOT/`uname -m`/base$RELEASE.tgz
signify -C -p /etc/signify/openbsd-$RELEASE-base.pub -x SHA256.sig base$RELEASE.tgz && tar -xzpf base$RELEASE.tgz -C / ./usr/libdata/perl5
rm SHA256.sig base$RELEASE.tgz
mount -ur /

Install Perl without verification

This streaming method doesn't require any extra temporary disk space, but has the disadvantage of not verifying the data.

mount -uw /
ftp -o - -m http://ftp.openbsd.org/pub/OpenBSD/`uname -r`/`uname -m`/base`uname -r | tr -d .`.tgz | tar -xzpf /dev/stdin -C / ./usr/libdata/perl5
mount -ur /

Making Perl persistent after software updates

You can use skeleton files to re-install Perl if it's missing (typically after an software update). Create a script as /cfg/perl.sh with the contents from one of the installation methods above, and then invoke it from /cfg/skel/rc.local by running

echo "[ ! -d /usr/libdata/perl5 ] && sh /cfg/perl.sh" >> /cfg/skel/rc.local