diff --git a/flake-module.nix b/flake-module.nix index 8d06ec0..0531612 100644 --- a/flake-module.nix +++ b/flake-module.nix @@ -63,7 +63,7 @@ overlays = [ (_: prev: { inherit (self'.packages) alias-to-sieve; # add custom package to convert alias files to sieve scripts on the stalwart machine - stalwart-mail = assert lib.assertMsg (prev.stalwart-mail.version == "0.11.7") '' + stalwart-mail = assert lib.assertMsg (prev.stalwart-mail.version == "0.11.6-unstable-2025-02-04") '' 1. If the bug https://github.com/stalwartlabs/sieve/issues/11 is resolved to our satisfaction, try to remove this overlay. 2. Check whether sieve-rs recieved new updates that our patch needs to be rebased upon. 3. Check whether the sieve-rs patch below that exchanges the dependency needs updates. @@ -90,7 +90,7 @@ ./patches/sieve-rs.patch ]; # Replace the string with `lib.fakeHash` after version changes in order to get the new hash value. - cargoHash = "sha256-fP5dyTmuwydPGCgpP6XtVFSHE0HwGfvw5UjwNz0R3ek="; + cargoHash = "sha256-0U0Z13a2vRxMFnaaHeXBjvYDjKStgqmuDboUVssVMQw="; } ); }; diff --git a/flake.lock b/flake.lock index 157977f..8cb1fc0 100644 --- a/flake.lock +++ b/flake.lock @@ -698,11 +698,11 @@ }, "nixpkgs_6": { "locked": { - "lastModified": 1744932701, - "narHash": "sha256-fusHbZCyv126cyArUwwKrLdCkgVAIaa/fQJYFlCEqiU=", + "lastModified": 1743827369, + "narHash": "sha256-rpqepOZ8Eo1zg+KJeWoq1HAOgoMCDloqv5r2EAa9TSA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b024ced1aac25639f8ca8fdfc2f8c4fbd66c48ef", + "rev": "42a1c966be226125b48c384171c44c651c236c22", "type": "github" }, "original": { @@ -849,11 +849,11 @@ ] }, "locked": { - "lastModified": 1744669848, - "narHash": "sha256-pXyanHLUzLNd3MX9vsWG+6Z2hTU8niyphWstYEP3/GU=", + "lastModified": 1743910657, + "narHash": "sha256-zr2jmWeWyhCD8WmO2aWov2g0WPPuZfcJDKzMJZYGq3Y=", "owner": "Mic92", "repo": "sops-nix", - "rev": "61154300d945f0b147b30d24ddcafa159148026a", + "rev": "523f58a4faff6c67f5f685bed33a7721e984c304", "type": "github" }, "original": { diff --git a/nixos/machines/nodens/hardware-configuration.nix b/nixos/machines/nodens/hardware-configuration.nix index f65d7fb..756354c 100644 --- a/nixos/machines/nodens/hardware-configuration.nix +++ b/nixos/machines/nodens/hardware-configuration.nix @@ -51,7 +51,6 @@ "subvol=nix" "users" # Allows any user to mount and unmount "nofail" # Prevent system from failing if this drive doesn't mount - "exec" # needed for the nixos-install command ]; }; diff --git a/packages/alias-to-sieve/Cargo.lock b/packages/alias-to-sieve/Cargo.lock index 0ed3cd8..f7dffe3 100644 --- a/packages/alias-to-sieve/Cargo.lock +++ b/packages/alias-to-sieve/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.172" +version = "0.2.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" [[package]] name = "log" @@ -170,9 +170,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ "unicode-ident", ] diff --git a/packages/alias-to-sieve/Cargo.toml b/packages/alias-to-sieve/Cargo.toml index 9debbdd..77b7e28 100644 --- a/packages/alias-to-sieve/Cargo.toml +++ b/packages/alias-to-sieve/Cargo.toml @@ -4,11 +4,7 @@ version = "0.1.0" edition = "2021" rust-version = "1.68.2" -description = "Convert an alias file to a sieve script for stalwart-mail" -readme = "README.md" -license = " AGPL-3.0-only" -keywords = ["mail", "sieve", "alias", "stalwart"] [dependencies] -fqdn = {version = "0.4.6", features = ["domain-label-length-limited-to-63", "domain-name-without-special-chars"]} +fqdn = {version = "0.4.2", features = ["domain-label-length-limited-to-63", "domain-name-without-special-chars"]} email-address-parser = "2.0.0" diff --git a/packages/alias-to-sieve/README.md b/packages/alias-to-sieve/README.md deleted file mode 100644 index 66d21ff..0000000 --- a/packages/alias-to-sieve/README.md +++ /dev/null @@ -1,82 +0,0 @@ -This script converts an alias file to a sieve script for [stalwart-mail](https://stalw.art/). - -All local-parts are considered to be case-insensitive. - -## Usage -Given an alias file [`testdata/example.aliases`](testdata/example.aliases) that contains lines of redirects of the form local-part with optional `@fqdn` followed by a space followed by a list (space or comma+space separated) list of destinations that consist of a local-part and optionally an `@fqdn`. -If you don't define an fqdn along any of the addresses, the default domain from your commandline input will be appended. - -An example using the testdata directory of this repository: -```shell -$ ./alias_to_sieve testdata/example.aliases example.com -``` -```sieve -require ["variables", "copy", "vnd.stalwart.expressions", "envelope", "editheader"]; - -let "i" "0"; -while "i < count(envelope.to)" { - let "redirected" "false"; - if eval "eq_ignore_case(envelope.to[i], 'cali@example.com')" { - addheader "Delivered-To" "cali@example.com"; - redirect :copy "camilia@example.com"; - - deleteheader :index 1 :is "Delivered-To" "cali@example.com"; - let "redirected" "true"; - } - if eval "eq_ignore_case(envelope.to[i], 'camila@example.com')" { - addheader "Delivered-To" "camila@example.com"; - redirect :copy "camila@example.edu"; - - deleteheader :index 1 :is "Delivered-To" "camila@example.com"; - let "redirected" "true"; - } - if eval "eq_ignore_case(envelope.to[i], 'jaiden@example.com')" { - addheader "Delivered-To" "jaiden@example.com"; - redirect :copy "jaiden@example.edu"; - - deleteheader :index 1 :is "Delivered-To" "jaiden@example.com"; - let "redirected" "true"; - } - if eval "eq_ignore_case(envelope.to[i], 'priscilla@example.com')" { - addheader "Delivered-To" "priscilla@example.com"; - redirect :copy "baldwin@example.org"; - - deleteheader :index 1 :is "Delivered-To" "priscilla@example.com"; - let "redirected" "true"; - } - if eval "eq_ignore_case(envelope.to[i], 'root@example.com')" { - addheader "Delivered-To" "root@example.com"; - redirect :copy "baldwin@example.org"; - redirect :copy "jaiden@example.edu"; - - deleteheader :index 1 :is "Delivered-To" "root@example.com"; - let "redirected" "true"; - } - if eval "eq_ignore_case(envelope.to[i], 'webteam@example.com')" { - addheader "Delivered-To" "webteam@example.com"; - redirect :copy "baldwin@example.org"; - redirect :copy "camilia@example.com"; - redirect :copy "jaiden@example.edu"; - - deleteheader :index 1 :is "Delivered-To" "webteam@example.com"; - let "redirected" "true"; - } - if eval "!redirected" { - let "destination" "envelope.to[i]"; - redirect :copy "${destination}"; - } - let "i" "i+1"; -} -discard; -``` - -If you have multiple domains with multiple alias files, pass them all in one run: `$ ./alias_to_sieve simple.aliases example.com example.aliases example.org`. - -## Limitations -You cannot use apostrophes (') in any mail addresses although allowed by [RFC 5322](https://www.rfc-editor.org/rfc/rfc5322) since they would break termination of strings in sieve. - -This parser is not designed with security in mind. While the above gives some basic protection against code injection, I have no idea whether sieve has other pitfalls that might allow them. - -This is my first rust project, consume the code with care. - -The generated code is specific to stalwart-mail and contains non-standard sieve features. diff --git a/packages/alias-to-sieve/testdata/example.aliases b/packages/alias-to-sieve/testdata/example.aliases deleted file mode 100644 index ba95a1f..0000000 --- a/packages/alias-to-sieve/testdata/example.aliases +++ /dev/null @@ -1,8 +0,0 @@ -priscilla baldwin@example.org -jaiden jaiden@example.edu -camila camila@example.edu - -cali camilia - -webteam root, camilia -root priscilla jaiden