mirror of
https://seed.flo-the.dev/z3gWc1qgaeZaoGwL4WTstLNoqjayM.git
synced 2025-12-06 04:47:35 +01:00
add README and config sample
Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
This commit is contained in:
107
README.md
Normal file
107
README.md
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
|
||||||
|
# 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)
|
||||||
|
|
||||||
|
1. Clone the repo
|
||||||
|
2. `nix run . # just run or`
|
||||||
|
3. `nix build . # to build locally`
|
||||||
|
|
||||||
|
### 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
|
||||||
|
smime_to_cert = /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
|
||||||
|
- `smime_to_cert` is the path to a S/MIME certificate of the recipiant in PEM or DER 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
|
||||||
|
|
||||||
|
- Clenup code
|
||||||
|
|
||||||
|
- Add list of recipients and their certificates
|
||||||
|
|
||||||
|
- Add tests
|
||||||
|
|
||||||
|
|
||||||
|
## Acknowledgements
|
||||||
|
|
||||||
|
- [Original software and blog post](https://www.hackitu.de/smtprd/)
|
||||||
|
|
||||||
|
|
||||||
17
config.example
Normal file
17
config.example
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# [server]
|
||||||
|
# hostname = localhost
|
||||||
|
# port = 8025
|
||||||
|
|
||||||
|
[client]
|
||||||
|
hostname = smtp.mail.example.com
|
||||||
|
port = 465
|
||||||
|
username = foo@example.com
|
||||||
|
password = s3cr3t
|
||||||
|
sender = foo@example.com
|
||||||
|
recipients = monitoring.foo@example.com, John Foobar <foo@baz.org>
|
||||||
|
# set_reply_to = false
|
||||||
|
# use_tls = true
|
||||||
|
# start_tls = false
|
||||||
|
# smime_cert = /path/to/cert
|
||||||
|
# smime_cert_private = /path/to/cert.key
|
||||||
|
# smime_to_cert = /path/to/recipient_cert
|
||||||
Reference in New Issue
Block a user