mirror of
https://seed.flo-the.dev/z3gWc1qgaeZaoGwL4WTstLNoqjayM.git
synced 2025-12-06 12:57:35 +01:00
104 lines
3.2 KiB
Markdown
104 lines
3.2 KiB
Markdown
|
|
# SMTPRD-NG
|
|
|
|
SMTP relay-daemon next-generation. Originally from https://www.hackitu.de/smtprd.
|
|
|
|
Listen locally on a predefined port for SMTP requests and relay them to another SMTP server.
|
|
|
|
A typical usecase would be to unify all local services which use email notification and let them relay through this script. This way you don't need to specify email, username and password each and everytime for locally running services.
|
|
|
|
This can also for example use `msmtp`. This way scripts can use `sendmail` which connect to `smtprd-ng` which relays the mail.
|
|
|
|
Additionally, we can sign and encrypt the emails with S/MIME certificates, which adds a layer of authentification and security for automated information delivery (think security notifications, logs, etc.)
|
|
|
|
For now, this is a proof-of-concept.
|
|
|
|
|
|
## Features
|
|
|
|
- Relay emails received on a locally listening SMTP server
|
|
- Encrypt and sign the relayed mails (experimental)
|
|
|
|
|
|
## Installation/Hacking
|
|
|
|
There is no real installation routine in place as of now. If you want to give this a try, there is a number of ways to do so:
|
|
|
|
### nix (non-flakes)
|
|
|
|
Clone this repo and run `nix-build .`
|
|
|
|
### nix (flakes)
|
|
|
|
`nix run git+https://seed.radicle.garden/z3gWc1qgaeZaoGwL4WTstLNoqjayM.git -- --config config.ini`
|
|
|
|
### python wheel
|
|
|
|
Clone this repo and run `python -m build`.
|
|
|
|
Note: `build` must be installed. You should use a `venv` for this.
|
|
|
|
### python (as is)
|
|
|
|
1. Clone this repo
|
|
2. Create a `venv`
|
|
3. Install requirements with `pip install -r requirements.txt`
|
|
4. Run `python smtprd_ng/smtprd.py`
|
|
|
|
### devenv
|
|
|
|
Clone this repo and run `devenv shell`
|
|
|
|
## Contributing
|
|
|
|
Contributions are always welcome!
|
|
|
|
Please read https://radicle.xyz/guides/user to get used to clone this repo with `radicle` and submit patch or issues.
|
|
|
|
If you just want to clone the repo without `radicle` you can clone the repo with `git clone https://seed.radicle.garden/z3gWc1qgaeZaoGwL4WTstLNoqjayM.git smtprd-ng`
|
|
|
|
Beware: This is very early alpha ;-)
|
|
|
|
## License
|
|
|
|
[AGPLv3](https://www.gnu.org/licenses/agpl-3.0.html)
|
|
|
|
## Usage/Examples
|
|
|
|
Copy config.example to config.ini and adjust to your usecase.
|
|
|
|
Run `smtprd-ng --config config.ini`
|
|
|
|
The script will listen on the specified port for smtp requests and forward them to the specified upstream SMTP serer.
|
|
|
|
If you want to give sign and encryption a go, you need to set
|
|
|
|
```ini
|
|
smime_cert = /path/to/cert
|
|
smime_cert_private = /path/to/cert.key
|
|
[emails]
|
|
monitoring.foo@example.com = /path/to/recipient_cert
|
|
```
|
|
Where
|
|
- `smime_cert` is the path to the S/MIME certificate of the sender in PEM format.
|
|
- `smime_cert_private` is the path to the S/MIME priate key of the sender in PEM format
|
|
- `monitoring.foo@example.com`is the recipient and `/path/to/recipient_cert` is the path to the certificate of the recipient in PEM format
|
|
|
|
Plese note: Right now, there is no way to set a password, so the private key is unprotected and should only be used for this automation and have appropiate file permissions. I might add the option to set a password through the config file in the future, though.
|
|
|
|
|
|
## Roadmap
|
|
|
|
- Add wheel for pypi
|
|
|
|
- Add systemd service
|
|
|
|
- Cleanup code
|
|
|
|
|
|
## Acknowledgements
|
|
|
|
- [Original software and blog post](https://www.hackitu.de/smtprd/)
|
|
|
|
|