version 0.1.0

- add nixosModules config part to readme
- cleanup
- add version tag 0.1.0

Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
This commit is contained in:
2024-07-12 21:48:00 +02:00
parent e860cf24f1
commit f40359baec
5 changed files with 55 additions and 25 deletions

View File

@@ -17,7 +17,7 @@ For now, this is a proof-of-concept.
## Features ## Features
- Relay emails received on a locally listening SMTP server - Relay emails received on a locally listening SMTP server
- Encrypt and sign the relayed mails (experimental) - Encrypt and sign the relayed mails
## Installation/Hacking ## Installation/Hacking
@@ -57,7 +57,7 @@ Please read https://radicle.xyz/guides/user to get used to clone this repo with
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` 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 ;-) Beware: This is alpha ;-)
## License ## License
@@ -86,13 +86,58 @@ Where
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. 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.
### Systemd
An example `systemd` file is in the `sytemd` subfolder. Be sure to replace @smtprd@ with a path to the python executable.
For `NixOS` you yan use the provided `nixosModule` like so:
```nix
# flake.nix
{
inputs.smtp = {
url = "git+https://seed.radicle.garden/z3gWc1qgaeZaoGwL4WTstLNoqjayM.git";
};
outputs = inputs@{ ... }: {
nixosConfigurations = {
my-config = inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
inputs.smtp.nixosModules.smtprd-ng
{
services.smtprd-ng = {
enable = true;
client = {
hostname = "smtp.example.com";
username = "username";
password_file = "/etc/smtp_pw";
sender = "username@example.com";
start_tls = true;
smime_cert = "${./smime.crt}";
smime_cert_private = "/etc/private.key";
};
emails = {
"monitor@example.com" = "${./cert_for_monitor_example_com}";
"second_monitor@example.com" = "";
};
};
}
];
};
};
};
}
```
## Roadmap ## Roadmap
- Add wheel for pypi - Add wheel for pypi
- Add systemd service
- Cleanup code - Cleanup code

View File

@@ -1,11 +1,8 @@
{ pkgs ? import <nixpkgs> { } { pkgs ? import <nixpkgs> { }, lib ? pkgs.lib, }:
, lib ? pkgs.lib
,
}:
pkgs.python3Packages.buildPythonPackage rec { pkgs.python3Packages.buildPythonPackage rec {
pname = "smtprd-ng"; pname = "smtprd-ng";
version = "git"; version = "0.1.0";
pyproject = true; pyproject = true;
src = lib.cleanSource ./.; src = lib.cleanSource ./.;
@@ -24,7 +21,8 @@ pkgs.python3Packages.buildPythonPackage rec {
meta = { meta = {
description = "SMTP forwarding relay daemon with signing and encryption"; description = "SMTP forwarding relay daemon with signing and encryption";
homepage = "https://app.radicle.xyz/nodes/seed.radicle.garden/rad:z3gWc1qgaeZaoGwL4WTstLNoqjayM"; homepage =
"https://app.radicle.xyz/nodes/seed.radicle.garden/rad:z3gWc1qgaeZaoGwL4WTstLNoqjayM";
license = lib.licenses.agpl3Only; license = lib.licenses.agpl3Only;
maintainers = [ lib.maintainers.gador ]; maintainers = [ lib.maintainers.gador ];
}; };

View File

@@ -6,15 +6,6 @@ in {
# https://devenv.sh/packages/ # https://devenv.sh/packages/
packages = [ pkgs.file pkgs.swig4 pkgs.openssl ]; packages = [ pkgs.file pkgs.swig4 pkgs.openssl ];
# https://devenv.sh/tests/
# enterTest = ''
# echo "Running tests"
# git --version | grep "2.42.0"
# '';
# https://devenv.sh/services/
# services.postgres.enable = true;
# https://devenv.sh/languages/ # https://devenv.sh/languages/
languages.nix.enable = true; languages.nix.enable = true;
languages.python = { languages.python = {
@@ -42,9 +33,4 @@ in {
detect-private-keys.excludes = [ "tests/" ]; detect-private-keys.excludes = [ "tests/" ];
}; };
# https://devenv.sh/processes/
# processes.ping.exec = "ping example.com";
# See full reference at https://devenv.sh/reference/options/
} }

View File

@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "smtprd-ng" name = "smtprd-ng"
version = "0.0.1" version = "0.1.0"
description = "SMTP forwarding relay daemon with signing and encryption" description = "SMTP forwarding relay daemon with signing and encryption"
authors = [{ name = "Florian Brandes", email = "dev@mail.flo-the.dev" }] authors = [{ name = "Florian Brandes", email = "dev@mail.flo-the.dev" }]
classifiers = [ classifiers = [

View File

@@ -139,6 +139,7 @@ class Config:
password=cls._read_from_file( password=cls._read_from_file(
(config.get("client", "password_file", fallback="")) (config.get("client", "password_file", fallback=""))
), ),
# TODO: Remove or add nixos option
set_reply_to=config.getboolean( set_reply_to=config.getboolean(
"client", "set_reply_to", fallback=False "client", "set_reply_to", fallback=False
), ),