Omada Custom Dynamic DNS for Mail-In-A-Box

The repository contains a Flask-based API proxy that allows Omada controller to update DNS records in a Mail-In-A-Box (MIAB) server. The Omada SDN software does not natively support MIAB as a Dynamic DNS provider, so this proxy bridges that gap.

Features

  • Provides endpoints for listing, setting, and deleting DNS records.
  • Relays authentication credentials from Omada supplied username and password to MIAB.

Requirements

  • Python 3.x
  • Flask
  • Flask-HTTPAuth
  • Requests
  • Base64

Installation

On an Ubuntu/Debian system, you can install the required packages using apt:

sudo apt install -y python3 python3-dotenv python3-flask python3-flask-httpauth python3-requests gunicorn

Copy the app.py file to your desired location, and run it using Python:

flask run app.py

or use Gunicorn for production:

gunicorn --bind 0.0.0.0:8080 app:app

Self-Signed SSL Certificate (Optional)

To run the Flask app with HTTPS, you can create a self-signed SSL certificate:

openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj "/CN=localhost" -addext "subjectAltName=DNS:localhost"

Then run the Flask app with SSL context:

flask run --cert=cert.pem --key=key.pem

To use the Mail In A Box server's SSL certificate, use the following files:

  • certificate: /miab-data/ssl/ssl_certificate.pem
  • private key: /miab-data/ssl/ssl_private_key.pem

Note: You have to run the web server as root to access the private key file.

Service Installation

sudo mkdir -p /opt/dns-updater
sudo cp app.py /opt/dns-updater/
sudo cp dns-updater.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now dns-updater.service
sudo systemctl status dns-updater.service
Description
A Dynamic DNS proxy for MIAB usable by Omada.
Readme 52 KiB
Languages
Python 85.8%
Shell 8.8%
Dockerfile 5.4%