After several errors and misconfigurations, I decided to install a machine with CentOS 5.5 in BASE mode (minimal installation) and there could successfully validate the user for both SMTP and IMAP using kerberos and ActiveDirectory
This is how i did it:
Artica with cyrus-imap validating against Active Directory using kerberos (R&D)
My windows Server is a Windows 2008 with Active Directory in Mixed mode (Native for 2003) installed for this lab
Windows machine name: hadesw2008 Domain: GZISNET.AD (dc=gzisnet,dc=ad)
Ip address: 192.168.254.2
Linux Server: Centos 5.5 minimal installation
Name: LinuxPostfix
ip address 192.168.254.3, dns: 192.168.254.2 (active directory resolution for kerberos validation: _kerberos._tcp.gzisnet.ad)
Linux Machine:
- Install postfix and cyrus-imapd ( yum install postfix cyrus-imapd)
- Test dns resolution with active directory:
- Code: Select all
[root@LinuxPostfix ~]# host -t any _kerberos._tcp.gzisnet.ad
_kerberos._tcp.gzisnet.ad has SRV record 0 100 88 hadesw2008.gzisnet.ad.
[root@LinuxPostfix ~]#
Modify /etc/krb5.conf, here final modification:
- Code: Select all
[logging]
default = FILE:/var/log/krb5libs.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log
[libdefaults]
default_realm = GZISNET.AD
dns_lookup_realm = true
dns_lookup_kdc = true
ticket_lifetime = 24h
forwardable = yes
[realms]
GZISNET.AD = {
kdc = gzisnet.ad:88
admin_server = gzisnet.ad:749
default_domain = gzisnet.ad
}
[domain_realm]
.gzisnet.ad = GZISNET.AD
gzisnet.ad = GZISNET.AD
[appdefaults]
pam = {
debug = false
ticket_lifetime = 36000
renew_lifetime = 36000
forwardable = true
krb4_convert = false
}
Now test for ldap search and kerberos validation (no answer is VALIDATED):
- Code: Select all
[root@LinuxPostfix ~]# kinit garaujo
Password for garaujo@GZISNET.AD:
[root@LinuxPostfix ~]#
If there is errors in the configuration, the command fail with a state and description, like this one for incorrect password:
- Code: Select all
Password for garaujo@GZISNET.AD:
kinit(v5): Preauthentication failed while getting initial credentials
[root@LinuxPostfix ~]#
Now kerberos is configured, and the linux machine can validate agains AD, now we need to configure cyrus ..
The Postfix Cyrus SASL support is used to authenticate clients and local mailboxes to the Postfix SMTP server. We will use the Pluggable Authentication Modules (PAM) in Linux to configure Cyrus SASL and delegate the authentication process to the Active Directory server.
so, we need to configure pam module, Edit the file /etc/pam.d/smtp and /etc/pam.d/imap
- Code: Select all
auth sufficient pam_krb5.so no_user_check validate
account sufficient pam_permit.so
Now restart saslauthd service
- Code: Select all
service saslauthd restart
Ok, now we will test the validation using testsaslauthd command with -s smtp param
- Code: Select all
[root@LinuxPostfix ~]# testsaslauthd -u garaujo -p 1q2w3e. -s imap
0: OK "Success."
[root@LinuxPostfix ~]#
Now, to be sure that Active directory is working, i go to my windows machine and change the user password for demo.2010 and test again:
- Code: Select all
[root@LinuxPostfix ~]# testsaslauthd -u garaujo -p 1q2w3e. -s imap
0: NO "authentication failed"
[root@LinuxPostfix ~]#
Now using the new password:
- Code: Select all
[root@LinuxPostfix ~]# testsaslauthd -u garaujo -p demo.2010 -s imap
0: OK "Success."
[root@LinuxPostfix ~]#
Waiting for comments.

