Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dovecot: allow sasl_bind=yes in the LDAP driver. #46859

Merged
merged 1 commit into from Oct 6, 2018

Conversation

ju1m
Copy link
Contributor

@ju1m ju1m commented Sep 18, 2018

Dovecot has its own SASL implementation,
but needs Cyrus SASL's headers to bind to an LDAP server using SASL.

This is useful to avoid the need to manage a dnpass= in dovecot-ldap.conf
by using the Unix socket to authenticate.

This is done with sasl_mech=EXTERNAL in dovecot-ldap.conf, and some olcAccess: with
by dn="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" read
in the slapd's cn=config for the LDAP DN queried by dovecot/auth (which runs as root).

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

@ju1m
Copy link
Contributor Author

ju1m commented Sep 18, 2018

Note that I'm not sure if I'm correctly adding to the CFLAGS, it may be an overriding, I don't know.

@@ -67,7 +69,8 @@ stdenv.mkDerivation rec {
++ lib.optional (stdenv.isDarwin) "--enable-static"
++ lib.optional withMySQL "--with-mysql"
++ lib.optional withPgSQL "--with-pgsql"
++ lib.optional withSQLite "--with-sqlite";
++ lib.optional withSQLite "--with-sqlite"
++ lib.optional enableSASL "CFLAGS=-I${cyrus_sasl.dev}/include/sasl";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding cyrus_sasl to buildInputs should have the same effect because of our c wrapper.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ nix-shell -p cyrus_sasl --command 'echo $NIX_CFLAGS_COMPILE | grep sasl'
-isystem /nix/store/80rpfirmjs2zbckhk9srv6432jbzrpms-cyrus-sasl-2.1.26-dev/include -isystem /nix/store/80rpfirmjs2zbckhk9srv6432jbzrpms-cyrus-sasl-2.1.26-dev/include

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or is there a different sasl in the include path?

Dovecot has its own SASL implementation,
but needs Cyrus SASL's headers to bind to an LDAP server using SASL.

This is useful to avoid the need to manage a dnpass= in dovecot-ldap.conf
by using the Unix socket to authenticate.

This is done with sasl_mech=EXTERNAL in dovecot-ldap.conf, and some olcAccess: with
 by dn="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" read
in the slapd's cn=config for the LDAP database queried by dovecot/auth (which runs as root).
@ju1m
Copy link
Contributor Author

ju1m commented Sep 19, 2018

Thank you @Mic92, I didn't know that the C wrapper was already adding the right include flag. I've tested and updated a simplified commit.

@matthewbauer matthewbauer merged commit a0a7da8 into NixOS:master Oct 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants