BindCaptain

Containerized BIND DNS Server with Smart Management

View the Project on GitHub randyoyarzabal/bindcaptain

Chief Remote Plugin for BindCaptain

Optional Chief plugin that lets you control a remote BindCaptain installation from your local machine. All DNS and service commands are executed on the remote host over SSH.

Use case: BindCaptain runs on a server (e.g. wolfman.homelab.io); you use Chief on your laptop and run bc.create, bc.list, etc.; the plugin runs the corresponding commands on the server via SSH.

Chief is a separate project. If you are not familiar with it, see the Chief GitHub project for what it is, how to install it, and how to use plugins:
https://github.com/randyoyarzabal/chief

Overview

Prerequisites

Requirement Details
Chief Separate shell framework that loads user plugins. See Chief on GitHub for more info.
SSH Access to the remote host as a user that can run sudo (typically root).
Remote host BindCaptain installed (e.g. under /opt/bindcaptain) with tools/bindcaptain_manager.sh and, if you use service commands, the systemd unit bindcaptain.
SSH auth Key-based authentication is recommended so commands run without a password prompt.

Configuration variables

Set these before sourcing the plugin, or edit the defaults inside bc_chief-plugin.sh.

Variable Description Default
BC_HOST SSH target: user@host. Must be able to sudo on the remote. root@wolfman.homelab.io
BC_MANAGER Absolute path to bindcaptain_manager.sh on the remote host. /opt/bindcaptain/tools/bindcaptain_manager.sh

Overriding without editing the file

export BC_HOST="root@dns.example.com"
export BC_MANAGER="/opt/bindcaptain/tools/bindcaptain_manager.sh"
# Then load the plugin (e.g. Chief does this automatically for the bc plugin)
source /path/to/bc_chief-plugin.sh

Installation

  1. Copy the plugin into Chief’s user plugins so Chief loads it as the bc plugin. The exact path depends on your Chief setup (e.g. chief_plugins/user_plugins/bc_chief-plugin.sh or equivalent). You can copy from the BindCaptain repo:
    cp bindcaptain/chief-plugin/bc_chief-plugin.sh /path/to/chief/user_plugins/
    
  2. Set BC_HOST and BC_MANAGER for your BindCaptain server (see above).
  3. Load the plugin (e.g. start a new Chief shell or run chief.plugin bc if your Chief supports it).
  4. Run bc.help to confirm and see usage.

Commands (summary)

After loading the plugin:

Command Description
bc.create <fqdn> <ip> Create A record (and PTR when applicable).
bc.create_cname <fqdn> <target> Create CNAME record.
bc.create_txt <name> <domain> <value> Create TXT record.
bc.delete <fqdn> [type] Delete a DNS record.
bc.list [domain] List records (all zones or one domain).
bc.refresh Validate and reload BIND on the remote.
bc.git_refresh Run git pull in the BindCaptain repo on the remote.
bc.status Show BindCaptain service and container status.
bc.start / bc.stop / bc.restart Control the BindCaptain systemd service.
bc.ssh Open an interactive SSH session to the BindCaptain host.
bc.help Show full usage and current BC_HOST / BC_MANAGER.

Examples

# Create A record
bc.create webserver.homelab.io 172.25.50.100

# Create CNAME
bc.create_cname www.homelab.io webserver

# TXT record
bc.create_txt @ homelab.io "v=spf1 -all"

# List records
bc.list homelab.io

# Delete record
bc.delete webserver.homelab.io

# Refresh BIND config on remote
bc.refresh

# Update BindCaptain from Git on remote
bc.git_refresh

# SSH to the BindCaptain host
bc.ssh

How it works

Troubleshooting

See also