Skip to content

Commit de7859b

Browse files
committed
Make SRP work and SASL|normal ldap uses and import the SRP password bug fix
Ref: cyrusimap/cyrus-sasl#740
1 parent 4c85911 commit de7859b

File tree

7 files changed

+48
-10
lines changed

7 files changed

+48
-10
lines changed

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ FROM alpine:3.16 as build-env-sasl
1313
WORKDIR /workspace
1414

1515
COPY saslauth-APKBUILD /workspace/APKBUILD
16+
COPY fix-srp-setpass.patch /workspace/fix-srp-setpass.patch
1617
ENV RSA_PRIVATE_KEY_NAME="sudo-bot@wdes.fr-temp.rsa"
1718

1819
RUN apk add --no-cache --update alpine-sdk && \
@@ -74,7 +75,6 @@ RUN apk add --no-cache --update \
7475
echo '/root/packages/' > /root/packages/repositories && \
7576
apk add --allow-untrusted --keys-dir=/root/packages/ --no-network --no-cache --repositories-file=/root/packages/repositories \
7677
cyrus-sasl=${CYRUS_SASL_VERSION} \
77-
cyrus-sasl-sql=${CYRUS_SASL_VERSION} \
7878
cyrus-sasl-static=${CYRUS_SASL_VERSION} \
7979
cyrus-sasl-srp=${CYRUS_SASL_VERSION} && \
8080
rm -rv /root/packages/* && \

docker/fix-srp-setpass.patch

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From 61e358da45d1740a722058d74aaecde76ae0abb0 Mon Sep 17 00:00:00 2001
2+
From: Howard Chu <hyc@symas.com>
3+
Date: Sat, 23 Jul 2022 19:51:42 +0100
4+
Subject: [PATCH] Fix SRP setpass
5+
6+
Wrong argument to MakeBuffer. Fixes #740.
7+
8+
Signed-off-by: Howard Chu <hyc@symas.com>
9+
---
10+
plugins/srp.c | 2 +-
11+
1 file changed, 1 insertion(+), 1 deletion(-)
12+
13+
diff --git a/plugins/srp.c b/plugins/srp.c
14+
index 7cf36c27..67bee323 100644
15+
--- a/plugins/srp.c
16+
+++ b/plugins/srp.c
17+
@@ -2296,7 +2296,7 @@ static int srp_setpass(void *glob_context __attribute__((unused)),
18+
19+
r = MakeBuffer(text->utils, &text->out_buf, &text->out_buf_len,
20+
&bufferlen, "%s%m%o",
21+
- server_mda->name, &v, saltlen, salt);
22+
+ server_mda->name, v, saltlen, salt);
23+
24+
if (r) {
25+
sparams->utils->seterror(sparams->utils->conn, 0,

docker/sasl2-slapd.conf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# mech_list: PLAIN EXTERNAL CRAM-MD5
2-
# EXTERNAL gssapi DIGEST-MD5 NTLM CRAM-MD5 LOGIN PLAIN SAML
31
pwcheck_method: saslauthd
42
saslauthd_path: /var/run/saslauthd/mux
53
log_level: 0

docker/saslauth-APKBUILD

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ arch="all"
1010
license="custom"
1111
options="!check" # No test suite.
1212
subpackages="
13+
$pkgname-dbg
1314
$pkgname-static
1415
$pkgname-dev
1516
$pkgname-doc
1617
libsasl
1718
$pkgname-srp:_plugin
1819
$pkgname-sql:_plugin
20+
$pkgname-ldapdb:_plugin
1921
"
2022
# use heimdal to avoid circular dep: cyrus-sasl -> krb5 -> openldap -> cyrus-sasl
2123
makedepends="
@@ -31,6 +33,7 @@ makedepends="
3133
libtool
3234
"
3335
source="https://github.com/cyrusimap/cyrus-sasl/releases/download/cyrus-sasl-$pkgver/cyrus-sasl-$pkgver.tar.gz
36+
fix-srp-setpass.patch
3437
"
3538

3639
# secfixes:
@@ -72,33 +75,35 @@ build() {
7275
--with-devrandom=/dev/urandom \
7376
--with-ldap \
7477
--with-pam \
78+
--with-ldapdb \
7579
--enable-static \
7680
--enable-shared \
7781
--enable-anon \
7882
--enable-plain \
7983
--enable-srp \
8084
--enable-srp-setpass \
8185
--enable-sql \
86+
--enable-ldapdb \
8287
--disable-otp \
8388
--disable-sia \
8489
--disable-digest \
8590
--disable-cram \
8691
--disable-scram \
8792
--disable-passdss \
88-
--disable-anonymous \
8993
--disable-httpform \
9094
--disable-auth-sasldb \
9195
--disable-login \
9296
--disable-ntlm \
9397
--disable-krb4 \
9498
--disable-gssapi \
95-
--disable-ldapdb \
9699
--disable-alwaystrue
97100
make
101+
# Use this line instead, to have a debug build
102+
# make CFLAGS="-g -O0"
98103
}
99104

100105
package() {
101-
make -j1 DESTDIR="$pkgdir" install
106+
make -j1 DESTDIR="$pkgdir" install STRIP=""
102107
install -D -m644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING
103108
}
104109

@@ -125,4 +130,5 @@ libsasl() {
125130

126131
sha512sums="
127132
db15af9079758a9f385457a79390c8a7cd7ea666573dace8bf4fb01bb4b49037538d67285727d6a70ad799d2e2318f265c9372e2427de9371d626a1959dd6f78 cyrus-sasl-2.1.28.tar.gz
133+
7f2c9e966e17a449dcb33964f5df9eb52003460e8c418fecad176ccfd72c76e5d62525b5ef541b5d5f6236f2c0da2eb2ba5a4e7fa03f8597df21ec5eecafcb94 fix-srp-setpass.patch
128134
"

docker/saslauthd.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
ldap_servers: ldapi:///
2-
ldap_use_sasl: no
2+
ldap_use_sasl: yes
33
ldap_start_tls: no
44
ldap_version: 3
55
ldap_auth_method: bind
6-
ldap_mech: PLAIN
6+
ldap_mech: SRP
77
ldap_bind_dn: cn=admin,{{ LDAP_BASE_DN }}
88
ldap_bind_pw: admin
99
ldap_search_base: {{ LDAP_AUTH_BASE_DN }}

docker/slapd.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,15 @@ authz-regexp
2626
uid=(.*)@(.*),cn=[^,]*,cn=auth
2727
mail=$1@$2,o=$2,{{ LDAP_AUTH_BASE_DN }}
2828

29+
#sasl-regexp
30+
# uid=(.*)@(.*),cn=[^,]*,cn=auth
31+
# mail=$1@$2,o=$2,{{ LDAP_AUTH_BASE_DN }}
32+
2933
sasl-host 127.0.0.1
3034
# https://www.cyrusimap.org/sasl/sasl/authentication_mechanisms.html#summary
3135
sasl-secprops noanonymous,noactive,noplain
36+
# Not configured (yet)
37+
#sasl-auxprops ldapdb
3238
password-hash {SSHA} {CRYPT}
3339

3440
#######################################################################

docker/tests/run.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,14 @@ ldapwhoami -H ldap://openldap -D "cn=Cyrielle Pondu,ou=people,dc=example,dc=org"
5353
echo 'Login as email 3'
5454
ldapwhoami -H ldap://openldap -D "mail=alice@warz.eu,o=warz.eu,ou=people,dc=example,dc=org" -w 'oHHGf7YyJSihb6ifSwNWZPtEGzijjp8'
5555

56+
# -a slapd will make it use slapd.conf in the plugin config folder
57+
#echo "oHHGf7YyJSihb6ifSwNWZPtEGzijjp8" | saslpasswd2 -a slapd -n -p -c -u warz.eu edwin@warz.eu
58+
5659
echo 'Login as email 4'
57-
#echo -e "\tUsing simple auth"
58-
#ldapwhoami -H ldap://openldap -D "mail=edwin@warz.eu,o=warz.eu,ou=people,dc=example,dc=org" -w 'oHHGf7YyJSihb6ifSwNWZPtEGzijjp8'
5960
echo -e "\tUsing SASL auth"
6061
ldapwhoami -Q -H ldap://openldap -U edwin@warz.eu -w 'oHHGf7YyJSihb6ifSwNWZPtEGzijjp8'
62+
echo -e "\tUsing simple auth"
63+
ldapwhoami -H ldap://openldap -D "mail=edwin@warz.eu,o=warz.eu,ou=people,dc=example,dc=org" -w 'oHHGf7YyJSihb6ifSwNWZPtEGzijjp8'
6164

6265
echo 'Login as email 5'
6366
ldapwhoami -H ldap://openldap -D "mail=elana@caldin.eu,o=caldin.eu,ou=people,dc=example,dc=org" -w 'bandedetsylish'

0 commit comments

Comments
 (0)