summary refs log tree commit diff
path: root/pkgs/servers/mail/opensmtpd
diff options
context:
space:
mode:
authorobadz <obadz-git@obadz.com>2016-05-23 22:07:05 +0100
committerobadz <obadz-git@obadz.com>2016-05-23 22:10:33 +0100
commite0ef352ae76da647d837c3405263c34c11191f8e (patch)
tree6216f7a69a5f8988c500079a4ba4ed6a61c18d36 /pkgs/servers/mail/opensmtpd
parent19ee3baa32d9cf74db392c1c88855a22f9391aff (diff)
downloadnixpkgs-e0ef352ae76da647d837c3405263c34c11191f8e.tar
nixpkgs-e0ef352ae76da647d837c3405263c34c11191f8e.tar.gz
nixpkgs-e0ef352ae76da647d837c3405263c34c11191f8e.tar.bz2
nixpkgs-e0ef352ae76da647d837c3405263c34c11191f8e.tar.lz
nixpkgs-e0ef352ae76da647d837c3405263c34c11191f8e.tar.xz
nixpkgs-e0ef352ae76da647d837c3405263c34c11191f8e.tar.zst
nixpkgs-e0ef352ae76da647d837c3405263c34c11191f8e.zip
opensmtpd: add two configuration options
unpriviledged_smtpctl_encrypt (defaults to true) -- lets you invoke
smtpctl encrypt without being root

tag_char -- lets you override the + as in user+tag@domain.tld
Diffstat (limited to 'pkgs/servers/mail/opensmtpd')
-rw-r--r--pkgs/servers/mail/opensmtpd/default.nix19
1 files changed, 18 insertions, 1 deletions
diff --git a/pkgs/servers/mail/opensmtpd/default.nix b/pkgs/servers/mail/opensmtpd/default.nix
index 4edee78898e..4dada752cf6 100644
--- a/pkgs/servers/mail/opensmtpd/default.nix
+++ b/pkgs/servers/mail/opensmtpd/default.nix
@@ -1,5 +1,12 @@
-{ stdenv, fetchurl, autoconf, automake, libtool, bison
+{ stdenv, lib, fetchurl, autoconf, automake, libtool, bison
 , libasr, libevent, zlib, openssl, db, pam
+
+# opensmtpd requires root for no reason to encrypt passwords, this patch fixes it
+# see also https://github.com/OpenSMTPD/OpenSMTPD/issues/678
+, unpriviledged_smtpctl_encrypt ? true
+
+# This enables you to override the '+' character which typically separates the user from the tag in user+tag@domain.tld
+, tag_char ? null
 }:
 
 stdenv.mkDerivation rec {
@@ -16,6 +23,16 @@ stdenv.mkDerivation rec {
 
   patches = [ ./proc_path.diff ];
 
+  postPatch = with builtins; with lib;
+    optionalString (isString tag_char) ''
+      sed -i -e "s,TAG_CHAR.*'+',TAG_CHAR '${tag_char}'," smtpd/smtpd-defines.h
+    '' +
+    optionalString unpriviledged_smtpctl_encrypt ''
+      substituteInPlace smtpd/smtpctl.c --replace \
+        'if (geteuid())' \
+        'if (geteuid() != 0 && !(argc > 1 && !strcmp(argv[1], "encrypt")))'
+    '';
+
   configureFlags = [
     "--sysconfdir=/etc"
     "--localstatedir=/var"