go-miab

module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2019 License: MIT

README

go-miab

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

Go Report Card

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:

  1. 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
    
  2. 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
    
  3. 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):

Dependency License
github.com/mitchellh/go-homedir MIT License
github.com/spf13/cobra Apache License 2.0
github.com/spf13/pflag BSD 3-Clause "New" or "Revised" License
github.com/spf13/viper MIT License
gopkg.in/yaml.v3 MIT License and Apache License 2.0

Directories

Path Synopsis
cmd
cli
Package miab is a wrapper for the API of a Mail-in-a-Box instance (https://mailinabox.email).
Package miab is a wrapper for the API of a Mail-in-a-Box instance (https://mailinabox.email).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL