You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
2 weeks ago | |
|---|---|---|
| .. | ||
| config | 2 weeks ago | |
| other/lego | 2 weeks ago | |
| tmpfiles.d | 2 weeks ago | |
| Makefile | 2 weeks ago | |
| README.md | 2 weeks ago | |
| SPECS.md | 2 weeks ago | |
| overlay.bu | 2 weeks ago | |
| smtprelay-build.timer | 2 weeks ago | |
| smtprelay.build | 2 weeks ago | |
| smtprelay.container | 2 weeks ago | |
| smtprelay.target | 2 weeks ago | |
README.md
Podman Quadlet: smtprelay
Overview
smtprelay is a small Golang based SMTP relay/proxy server that accepts mail via SMTP and forwards it to an upstream smarthost (ex: Mailgun, Gmail, ...).
This cookbook:
- Builds a custom smtprelay container image locally, from CentOS Stream 10.
- Runs smtprelay directly as a dedicated, unprivileged UID/GID (no user namespace mapping).
- Listens on the submission port (587) with STARTTLS, authenticating clients against a local user/password file.
- Loads TLS certificates issued by the
legocookbook and reloads them automatically when renewed. - Includes a timer to periodically rebuild the container image.
Prerequisites
- Configuration file
/etc/quadlets/smtprelay/smtprelay.inimust exist. - File
/etc/quadlets/smtprelay/allowed_users.txtmust exist, listing the users allowed to relay mail. - The
legocookbook should be configured to provide TLS certificates.
Usage
In a separate terminal, follow the logs.
sudo make tail-logs
Install the Podman Quadlets and start smtprelay.
sudo make clean install
You should see the smtprelay-build.service building the smtprelay container image. Then, the smtprelay.service should start up.
Verify smtprelay is running:
sudo systemctl status smtprelay.service
Send a test mail with swaks:
swaks --to youremail@example.com --from youremail@example.com --auth-user yourusername --auth-password yourpassword --port 587 --tls
When Let's Encrypt certificates are renewed, the renewal hook automatically restarts smtprelay so it picks up the new certificates.
Restart the smtprelay.target unit.
sudo systemctl restart smtprelay.target
Finally, remove the quadlets, their configuration and their data.
sudo make uninstall clean
Integration tests
sudo make test