/aykroyd

📬 Email forwards via PostFix

Primary LanguageGoMIT LicenseMIT

GoDoc Go Report Card MIT License

Aykroyd — Email forwards via Postfix

Aykroyd is an HTTP server and web application that allows the user to manage email forwards in Postfix.

Installation

Binaries

Pre-built binaries are available on the release page. Simply download, make executable, and move it to a folder in your PATH:

curl -L https://github.com/tja/aykroyd/releases/download/v2.1.0/aykroyd-`uname -s`-`uname -m` >/tmp/aykroyd
chmod +x /tmp/aykroyd
sudo mv /tmp/aykroyd /usr/local/bin/aykroyd

Docker

Aykroyd is also available as a Docker image from Docker Hub. Configuration can be done via a config file or environment variables (see below for details).

Setup

MariaDB / MySQL

Install MariaDB or MySQL, create a schema postfix, and grant a user access to it:

CREATE SCHEMA `postfix`;
GRANT SELECT ON `postfix`.* TO `postfix`@`localhost` IDENTIFIED BY '<password>';

Postfix

Install Postfix with MySQL support. Here is an example for Debian/Ubuntu:

sudo apt -y install postfix postfix-mysql

Add the Postfix domain config file /etc/postfix/mysql_virtual_alias_domains.cf:

user = postfix
password = <password>
hosts = 127.0.0.1
dbname = postfix
table = domains
select_field = name
where_field = name

Add the Postfix forwards config file /etc/postfix/mysql_virtual_alias_forwards.cf:

user = postfix
password = <password>
hosts = 127.0.0.1
dbname = postfix
table = forwards
select_field = target
where_field = source

Append the references to the two aforementioned files to /etc/postfix/main.cf:

virtual_alias_domains = mysql:/etc/postfix/mysql_virtual_alias_domains.cf
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_forwards.cf

Usage

Binary

Run aykroyd in the command line like this:

aykroyd --host "0.0.0.0:8080"

Open a browser and visit http://localhost:8080 to bring up the web interface. See below for how to configure host, port, and database access.

Docker

Run the Docker image neathack/aykroyd and proxy port 80 to a port of your choice:

docker run -ti --rm -p "8080:80" neathack/aykroyd:latest

Open a browser and visit http://localhost:8080 to bring up the web interface. See below for how to configure database access.

Configuration

Aykroyd can be configured via command line switches, a configuration file (in the current folder, in ~/.config/aykroyd/config.yml, or in /etc/aykroyd/config.yml), or environment variables. The following options are available:

Command Line Config File ENV Variable Description
-l, --listen listen AYKROYD_LISTEN IP and port the server will listen on (default "0.0.0.0:80")
-a, --asset asset AYKROYD_ASSET Path to static web assets (default uses embedded assets)
-H, --db-host db-host AYKROYD_DB_HOST MySQL host (default "localhost")
-d, --db-database db-database AYKROYD_DB_DATABASE MySQL database (default "postfix")
-u, --db-username db-username AYKROYD_DB_USERNAME MySQL username (default "postfix")
-p, --db-password db-password AYKROYD_DB_PASSWORD MySQL password
-v, --verbose verbose AYKROYD_DB_VERBOSE Write more

License

Copyright (c) 2018–2019 Thomas Jansen. Released under the MIT License.

Email icon made by Pixel Buddha from www.flaticon.com is licensed by CC 3.0 BY.