Bastille (Jails aka “Containers”)

Bastille is a tool to help use jails and manage them on FreeBSD. To install Bastille enter the following using the super user account.

Installing Bastille

To have Bastille start automatically at boot, as well as its container management enter the following:

Start Bastille service by:

Verify Bastille is setup for ZFS.

FreeBSD on the Raspberry Pi uses the UNIX file system. Bastille is setup to use ZFS by default. To confirm this edit the Bastille configuration file.

You want to search through the file for the following lines and confirm they indicate your pool, and that zfs is enabled. To have Bastille setup to use your zpool for storing its data you must set the bastille prefix to point to your pool/Bastille . ZFS_PREFIX = "your dataset" , this will tell it what your dataset/directory is called, and bastille_zfs_zpool="xenodata", is the name of your pool. At this time, you also want to set the time zone.

Create the Bastille folder in your zpool, and update the permissions. 0750 = User:rwx Group:r-x World:--- (i.e. World: no access)

After confirming these modifications, you want to reboot the Bastille service.

Cloned loopback network interface

Based off of the bastille manual recommendation, we will setup a loopback interface. To create it we musth first allow cloned interfaces by editing the system rc file, then we must also enable the pf firewall.

Next we must setup the firewall rules. Before editing we need to know the network interface. So we go ahead and run the ifconfig command. The network interface is ue0.

To edit the firewall rules, we go edit /etc/pf.conf. When you edit the file for the first time the file is blank.

From the bastille manual, add the following to the pf.conf file. The website “Sharp Writing” recommends not including the lines highlighted in green. The first line scrub is for fragmented network frames, and correcting fragmented frames. This caused issue for their network file server. The second locked out said network server. I am leaving both in, for now, until, I find a reason to not include them.

Bootstrap FreeBSD 14.1

The next step is to setup a base installation of FreeBSD for the jail/container. In this example I use FreeBSD 14.2. Not the use of the cache dataset and bastille dataset.

Verify you have successfully added FreeBSD 14.1 to the list of available versions to create jails from. You do this by listing them.

To verify that your bootstrapped version of freeBSD is downloaded and extracted correctly, you can use the verify command argument.

For more detailed documentation you can go to Bastilles documentation.

Setup a Git Server Jail

Creating a jail, is done using the create argument for the bastille command. You pass the name of the jail, git-server in my case, and the release of freeBSD you intend to use., followed by the ipaddress you wish to assign from your virtual network. Note I used 10.0.0.126 even though my network is a 192.168.x.x network. This is because you can use any ip address, but to minimize conflicts, my virtual network uses different ip address assignments to my physical network. The executed command and its output follows.