Friday, May 27, 2005

FreeBSD Cyrus-SASLauthd + MS-Windows 2003 AD

我搞這東西是為了要 (幫某人) 做 Authenticated Relay 的整合, 他的 user 都建在 Windows 2003 AD 裡面, 想當然耳這個 email 服務也應該去參考到 AD 裡面的帳號密碼, 這樣才有一致性也才不會『擾民』... anyway, MS-Windows 真是沒有團隊精神的東西, 要他跟別人合作真是大工程.

LDAP Server: MS-Windows 2003 AD ( 管USER跟密碼 )
windows 2003 AD 的 ip 是 192.168.1.100 , 在 AD 上面開一個假的帳號: freebsd ( 密碼是 power123 )

SMTP server: FreeBSD 5.3-RELEASE-p15
上面裝了 postfix-2.2.2,1 + cyrus-sasl-saslauthd-2.1.20_1 + openldap-client-2.2.24

/etc/rc.conf
saslauthd_flags="-a ldap -c -t 30"

/usr/local/etc/saslauthd.conf
ldap_servers: ldap://192.168.1.100/
ldap_version: 3
ldap_bind_dn: CN=freebsd,OU=lab,DC=institute,DC=local
ldap_bind_pw: power123
ldap_group_scope: sub
ldap_search_base: OU=lab,DC=institute,DC=local
ldap_timeout: 10
ldap_filter: sAMAccountName=%u
ldap_default_domain: institute.local
ldap_auth_method: bind

以上的設定, AD 只用來管密碼, 不能像 pam_ldap 一樣可以管到帳號的資訊 (例如 home dir 之類的), 不過某人的需求只是去做 smtp 的 authenticated relay, 所以這樣就夠了.

重點是 ldap_auth_method: bind 這個設定, saslauthd 會用輸入的帳號與密碼去試著 bind 上 AD, 如果 bind 成功表示輸入的帳號密碼是對的, 就完成密碼認證的程序了.

No comments: