git.iko.soy/typeable/nixpkgs
on master help sign in
opensmtpd: add two configuration options
e0ef352obadz
pkgs/servers/mail/opensmtpd/default.nix+18−1
@@ -1,5 +1,12 @@
1−{ stdenv, fetchurl, autoconf, automake, libtool, bison
1+{ stdenv, lib, fetchurl, autoconf, automake, libtool, bison
2, libasr, libevent, zlib, openssl, db, pam
2, libasr, libevent, zlib, openssl, db, pam
3+
4+# opensmtpd requires root for no reason to encrypt passwords, this patch fixes it
5+# see also https://github.com/OpenSMTPD/OpenSMTPD/issues/678
6+, unpriviledged_smtpctl_encrypt ? true
7+
8+# This enables you to override the '+' character which typically separates the user from the tag in user+tag@domain.tld
9+, tag_char ? null
3}:
10}:
4
11
5stdenv.mkDerivation rec {
12stdenv.mkDerivation rec {
@@ -16,6 +23,16 @@ stdenv.mkDerivation rec {
16
23
17 patches = [ ./proc_path.diff ];
24 patches = [ ./proc_path.diff ];
18
25
26+ postPatch = with builtins; with lib;
27+ optionalString (isString tag_char) ''
28+ sed -i -e "s,TAG_CHAR.*'+',TAG_CHAR '${tag_char}'," smtpd/smtpd-defines.h
29+ '' +
30+ optionalString unpriviledged_smtpctl_encrypt ''
31+ substituteInPlace smtpd/smtpctl.c --replace \
32+ 'if (geteuid())' \
33+ 'if (geteuid() != 0 && !(argc > 1 && !strcmp(argv[1], "encrypt")))'
34+ '';
35+
19 configureFlags = [
36 configureFlags = [
20 "--sysconfdir=/etc"
37 "--sysconfdir=/etc"
21 "--localstatedir=/var"
38 "--localstatedir=/var"