git.iko.soy/typeable/nixpkgs
on master help sign in
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

commite0ef352ae76da647d837c3405263c34c11191f8e authorobadz <obadz-git@obadz.com> dateMon 23 May 2016, 22:07 (11 years ago) parent19ee3ba
1 file changed+18−1
pkgs/servers/mail/opensmtpd/default.nix+18−1
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
22, 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
310}:
411
512stdenv.mkDerivation rec {
@@ -16,6 +23,16 @@ stdenv.mkDerivation rec {
1623
1724 patches = [ ./proc_path.diff ];
1825
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+
1936 configureFlags = [
2037 "--sysconfdir=/etc"
2138 "--localstatedir=/var"