Skip to content

hduoc2003/hns-email

Repository files navigation

MoonMail - Docker based mail server with Handshake domain

Introduction

MoonMail is built on top of Mailu. It is a simple yet full-featured mail server as a set of Docker images. We've enhanced Mailu to support interaction with Handshake domains, including:

  • Automatically issuing TLS certificates for Handshake domains.
  • Exclusively engage with Handshake HNS domain names, guaranteeing compatibility and full support within the Handshake ecosystem.

Main features include:

  • E2E Encryption, secure email communications, safeguarding the privacy and confidentiality of messages exchanged.
  • Standard email server, IMAP and IMAP+, SMTP and Submission with autoconfiguration profiles for clients
  • Advanced email features, aliases, domain aliases, custom routing
  • Web access, multiple Webmails and administration interface
  • User features, aliases, auto-reply, auto-forward, fetched accounts
  • Admin features, global admins, announcements, per-domain delegation, quotas
  • Security, enforced TLS, DANE, MTA-STS, Letsencrypt!, outgoing DKIM, anti-virus scanner, Snuffleupagus, block malicious attachments
  • Antispam, auto-learn, greylisting, DMARC and SPF, anti-spoofing
  • Freedom, all FOSS components, no tracker included

Setup

First, you need to clone this repository. We will use an Ubuntu server, moon.allinpepetothemoon as the domain name, and 14.225.217.169 as the IP address.

Prerequisites

  • Docker CLI
  • Python 3
  • Root user

Setup HNSD for DNS resolution

Run HNSD locally

docker run -d --name hnsd --restart always -p 53:53/udp namebasehq/hnsd "/opt/hnsd/dist/hnsd" -p 4 -r 0.0.0.0:53

Add the following line to the top of the /etc/resolv.conf file

nameserver 127.0.0.1

It took a while for HNSD to finish running. You can ping a Handshake domain to check everything is working properly

ping mail.moon.allinpepetothemoon

Setup DNS records

We use Namebase.io as Handshake domain provider. We need to add a few records as follows:

Setup a new mail server

First, in the root directory of the project, edit the content of the config.json file according to your configuration

{
    "STORAGE_PATH": "/moonmail",
    "DOMAIN": "moon.allinpepetothemoon",
    "HOSTNAMES": "mail.moon.allinpepetothemoon",
    "WEBSITE_NAME": "Moon Mail",
    "IP_ADDRESS": "14.225.217.169"
}

Then run script.py

python3 script.py

After running these commands, the following files will be created: 

  • cert.key (private key)
  • cert.crt (public key)
  • tlsa
  • nginx.conf
  • mailu.env
  • docker-compose.yml

Then copy tlsa file content and add a DNS record as follow:

Run

docker compose up -d

Before you can use MoonMail, you must create the primary administrator user account. This should look like [email protected]. Use the following command, changing PASSWORD to your liking:

docker compose exec admin flask mailu admin admin moon.allinpepetothemoon PASSWORD

Then access your domain with HTTPS, and the website interface will look like this

Demo

  • Demo of sending an email between 2 servers with E2E encryption

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published