Bastille Template: AdGuard Home

AdGuard Home is network-wide software for blocking ads & tracking.

AdGuard Home is network-wide software for blocking ads & tracking.

Bastille is an open-source system for automating deployment and management containerized applications on FreeBSD.

Template: AdGuard Home

Bastille is more than just lightweight containers for FreeBSD. The template command allows you to automatically deploy a wide range of software! This post begins a series highlighting examples of deploying popular applications using Bastille on FreeBSD.

We begin the series with something I run in my homelab. I run three instances if I’m being honest. A network-wide service for blocking ads & online tracking, AdGuard Home.

AdGuard Home provides a privacy focused DNS server inside your home network giving you network-wide blocking of ads and tracking. This means ad blocking for your phones, laptops, desktops, TVs and any other Internet connected devices in your home all in one place. No apps to install or browser plugins to update. Simply point everything to the AdGuard Home server(s) and you’re done.

As I mentioned, I run three of these instances in my homelab supporting fifty devices. The dashboard results have been enlightening in understanding DNS behavior on my network. Who knew the streaming device connected to my TV would be a top offender!

If you’d like to run AdGuard Home with Bastille follow these steps:


bastille bootstrap

Output Example

ishmael ~ # bastille bootstrap
Cloning into '/usr/local/bastille/templates/bastillebsd-templates/adguardhome'...
warning: redirecting to
remote: Enumerating objects: 30, done.
remote: Counting objects: 100% (15/15), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 30 (delta 4), reused 2 (delta 0), pack-reused 15
Receiving objects: 100% (30/30), 7.62 KiB | 7.63 MiB/s, done.
Resolving deltas: 100% (8/8), done.
Detected Bastillefile hook.
PKG ca_root_nss adguardhome
CP usr /
SYSRC adguardhome_enable=YES
SERVICE adguardhome start
RDR tcp 80 80
RDR udp 53 53

Template ready to use.


bastille create adguardhome 13.0-RELEASE bastille0

Output Example

ishmael ~ # bastille create adguardhome 13.0-RELEASE bastille0
Valid: (
Valid: (bastille0).

adguard: created

Applying template: default/thin...
Applying template: default/base...

syslogd_flags: -s -> -ss

sendmail_enable: NO -> NO

sendmail_submit_enable: YES -> NO

sendmail_outbound_enable: YES -> NO

sendmail_msp_queue_enable: YES -> NO

cron_flags:  -> -J 60

/etc/resolv.conf -> /usr/local/bastille/jails/adguardhome/root/etc/resolv.conf

Template applied: default/base

Template applied: default/thin

adguard: removed

adguard: created


bastille template adguardhome bastillebsd-templates/adguardhome

Output Example

ishmael ~ # bastille template adguardhome bastillebsd-templates/adguardhome
Applying template: bastillebsd-templates/adguardhome...
Bootstrapping pkg from pkg+, please wait...
Verifying signature with trusted certificate done
[adguardhome] Installing pkg-1.17.5...
[adguardhome] Extracting pkg-1.17.5: 100%
Updating FreeBSD repository catalogue...
[adguardhome] Fetching meta.conf: 100%    163 B   0.2kB/s    00:01
[adguardhome] Fetching packagesite.pkg: 100%    6 MiB   6.7MB/s    00:01
Processing entries: 100%
FreeBSD repository update completed. 31159 packages processed.
All repositories are up to date.
Updating database digests format: 100%
The following 2 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	adguardhome: 0.107.0.b.7
	ca_root_nss: 3.69_1

Number of packages to be installed: 2

The process will require 33 MiB more space.
6 MiB to be downloaded.
[adguardhome] [1/2] Fetching ca_root_nss-3.69_1.pkg: 100%  249 KiB 255.0kB/s    00:01
[adguardhome] [2/2] Fetching adguardhome-0.107.0.b.7.pkg: 100%    6 MiB   6.5MB/s    00:01
Checking integrity... done (0 conflicting)
[adguardhome] [1/2] Installing ca_root_nss-3.69_1...
[adguardhome] [1/2] Extracting ca_root_nss-3.69_1: 100%
[adguardhome] [2/2] Installing adguardhome-0.107.0.b.7...
[adguardhome] [2/2] Extracting adguardhome-0.107.0.b.7: 100%
Message from ca_root_nss-3.69_1:

FreeBSD does not, and can not warrant that the certification authorities
whose certificates are included in this package have in any way been
audited for trustworthiness or RFC 3647 compliance.

Assessment and verification of trust is the complete responsibility of the
system administrator.

This package installs symlinks to support root certificates discovery by
default for software that uses OpenSSL.

This enables SSL Certificate Verification by client software without manual

If you prefer to do this manually, replace the following symlinks with
either an empty file or your site-local certificate bundle.

  * /etc/ssl/cert.pem
  * /usr/local/etc/ssl/cert.pem
  * /usr/local/openssl/cert.pem
Message from adguardhome-0.107.0.b.7:

You installed AdGuardHome: Network-wide ads & trackers blocking DNS server.

In order to use it please start the service 'adguardhome' and
then access the URL in your favorite browser.

/usr/local/bastille/templates/bastillebsd-templates/adguardhome/usr -> /usr/local/bastille/jails/adguardhome/root/usr
/usr/local/bastille/templates/bastillebsd-templates/adguardhome/usr/local -> /usr/local/bastille/jails/adguardhome/root/usr/local
/usr/local/bastille/templates/bastillebsd-templates/adguardhome/usr/local/bin -> /usr/local/bastille/jails/adguardhome/root/usr/local/bin
/usr/local/bastille/templates/bastillebsd-templates/adguardhome/usr/local/bin/AdGuardHome.yaml -> /usr/local/bastille/jails/adguardhome/root/usr/local/bin/AdGuardHome.yaml

adguardhome_enable:  -> YES

Starting adguardhome.

tcp 80 80
udp 53 53
Template applied: bastillebsd-templates/adguardhome


Now that the container is running you can access the service through the host machine. Using the redirected ports on tcp/80 and udp/53 we can now point to the host system IP address and access the container service.

In this example the IP of the host machine is Entering that IP in my browser will show the AdGuard Home login page. The template sets the default username to adguard and password to BastilleBSD!

Changing the password is done by editing the AdGuardHome.yaml located alongside the main AdGuard binary. Note: stop the AdGuard Home service before making changes to the configuration.

Christer Edwards
Creator of Bastille

FreeBSD die-hard, software developer, author, educator, man behind BastilleBSD. I build cool stuff.