diff --git a/README.md b/README.md index 9861eb0..d9b3646 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ 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) +- Encrypt and sign the relayed mails ## 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` -Beware: This is very early alpha ;-) +Beware: This is alpha ;-) ## 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. +### 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 - Add wheel for pypi -- Add systemd service - - Cleanup code diff --git a/default.nix b/default.nix index 59ce8f2..cc86358 100644 --- a/default.nix +++ b/default.nix @@ -1,11 +1,8 @@ -{ pkgs ? import { } -, lib ? pkgs.lib -, -}: +{ pkgs ? import { }, lib ? pkgs.lib, }: pkgs.python3Packages.buildPythonPackage rec { pname = "smtprd-ng"; - version = "git"; + version = "0.1.0"; pyproject = true; src = lib.cleanSource ./.; @@ -24,7 +21,8 @@ pkgs.python3Packages.buildPythonPackage rec { meta = { 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; maintainers = [ lib.maintainers.gador ]; }; diff --git a/devenv.nix b/devenv.nix index a736435..0e47b80 100644 --- a/devenv.nix +++ b/devenv.nix @@ -6,15 +6,6 @@ in { # https://devenv.sh/packages/ 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/ languages.nix.enable = true; languages.python = { @@ -42,9 +33,4 @@ in { detect-private-keys.excludes = [ "tests/" ]; }; - - # https://devenv.sh/processes/ - # processes.ping.exec = "ping example.com"; - - # See full reference at https://devenv.sh/reference/options/ } diff --git a/pyproject.toml b/pyproject.toml index a720972..86b38cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "smtprd-ng" -version = "0.0.1" +version = "0.1.0" description = "SMTP forwarding relay daemon with signing and encryption" authors = [{ name = "Florian Brandes", email = "dev@mail.flo-the.dev" }] classifiers = [ diff --git a/smtprd_ng/smtprd.py b/smtprd_ng/smtprd.py index 08b68c4..74be8d7 100644 --- a/smtprd_ng/smtprd.py +++ b/smtprd_ng/smtprd.py @@ -139,6 +139,7 @@ class Config: password=cls._read_from_file( (config.get("client", "password_file", fallback="")) ), + # TODO: Remove or add nixos option set_reply_to=config.getboolean( "client", "set_reply_to", fallback=False ),