go-miab
go-miab is a simple command-line tool, designed to manage a Mail-in-a-Box, written in Go.

Overview
go-miab contains the package miab
that wraps the API of a Mail-in-a-Box instance.
Additionally there is an command-line interface (CLI) to access the Mail-in-a-Box API directly.
Most of the endpoints, that the Mail-in-a-Box API provides should be covered (Mail-in-a-Box v0.42b).
- Query custom DNS records
- Add or set (overwrite) custom DNS records
- Delete custom DNS records
- Query e-mail users
- Create e-mail users and mail-domains
- Delete e-mail users
- Set e-mail users privileges
- Query e-mail aliases
- Create e-mail aliases
- Delete e-mail aliases
There is also a small tool to update a custom DNS address record regularly.
I use this tool, running in a docker container on my NAS, to update my address record
(changing IP's) at home. This tool was the occasion to write go-miab at all :-).
Installation
Binary Release
Download a binary release from the release page.
Build miab in the official golang docker container:
git clone https://github.com/rverst/go-miab.git
cd go-miab
sudo docker run --rm -it -v "$PWD":/usr/src/miab -w /usr/src/miab golang:1.12.9 ./build_miab.sh
Go
go get github.com/rverst/go-miab
// to install the cli
cd $GOPATH/src/github.com/rverst/go-miab
go install ./cmd/cli/miab.go
Usage
First you have to provide the credentials and endpoint for your Mail-in-a-Box instance.
There are several ways to do so:
-
Command-line
miab --user admin@example.org --password secretpassword --endpoint https://box.example.org
or
miab -u admin@example.org -p secretpassword -e https://box.example.org
-
Environment variables
MIAB_USER=admin@example.org \
export MIAB_USER \
MIAB_PASSWORD=secretpassword \
export MIAB_PASSWORD \
MIAB_ENDPOINT=https://box.example.org \
export MIAB_ENDPOINT
-
Config file
user: admin@example.org
password: supersectet
endpoint: https://box.example.org
The default location for the config file is $HOME/.config/go-miab/miab.yaml
.
The location can be specified via the config
flag.
Run miab help
for available commands.
Dependencies
go-miab uses and relies on the following, awesome libraries (in lexical order):