ports/88684: New port: mail/qmail-activedir Programs to allow qmail to authenticate users through a MS AD
Jean Milanez Melo
jmelo at freebsdbrasil.com.br
Tue Nov 8 19:40:32 UTC 2005
>Number: 88684
>Category: ports
>Synopsis: New port: mail/qmail-activedir Programs to allow qmail to authenticate users through a MS AD
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Tue Nov 08 19:40:13 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Jean Milanez Melo
>Release: FreeBSD 5.3-STABLE i386
>Organization:
>Environment:
System: FreeBSD capeta.freebsdbrasil.com.br 5.3-STABLE FreeBSD 5.3-STABLE #5: Wed Mar 2 15:03:19 BRT 2005 eksffa at capeta.freebsdbrasil.com.br:/usr/obj/usr/src/sys/CAPETA i386
>Description:
- New port with few programs to allow qmail to authenticate users through a Microsoft Active Directory.
>How-To-Repeat:
>Fix:
--- qmail-activedir.shar begins here ---
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# qmail-activedir
# qmail-activedir/pkg-descr
# qmail-activedir/Makefile
# qmail-activedir/distinfo
# qmail-activedir/files
# qmail-activedir/files/patch-ad_func.h
# qmail-activedir/files/pkg-message.in
#
echo c - qmail-activedir
mkdir -p qmail-activedir > /dev/null 2>&1
echo x - qmail-activedir/pkg-descr
sed 's/^X//' >qmail-activedir/pkg-descr << 'END-of-qmail-activedir/pkg-descr'
XA few programs to allow qmail to authenticate users through a Microsoft
XActive Directory.
X
XAuthor: Leslie VanExel <prok at fo2k.com>
XWWW: http://fo2k.com/qmail-activedir/
END-of-qmail-activedir/pkg-descr
echo x - qmail-activedir/Makefile
sed 's/^X//' >qmail-activedir/Makefile << 'END-of-qmail-activedir/Makefile'
X# New ports collection makefile for: qmail-activedir
X# Date created: 2005-11-08
X# Whom: Jean Milanez Melo <jmelo at freebsdbrasil.com.br>
X#
X# $FreeBSD$
X#
X
XPORTNAME= qmail-activedir
XPORTVERSION= 0.15
XCATEGORIES= mail
XMASTER_SITES= http://fo2k.com/qmail-activedir/
X
XMAINTAINER= jmelo at freebsdbrasil.com.br
XCOMMENT= Programs to allow qmail to authenticate users through a MS ad
X
XNO_BUILD= yes
XSUB_FILES= pkg-message
XSUB_LIST= PREFIX=${PREFIX} \
X QMAIL_PREFIX=${QMAIL_PREFIX} \
X DOCSDIR=${DOCSDIR}
XUSE_OPENLDAP= yes
XMAKE_ENV+= QMAIL_PREFIX=${QMAIL_PREFIX}
XQMAIL_PREFIX?= /var/qmail
X
XCC?= gcc
XCFLAGS+= -I${LOCALBASE}/include -L${LOCALBASE}/lib -Wall -O2 -lldap
X
XPLIST_FILES= bin/checkadpassword \
X bin/create_alias_files \
X bin/qmail-adgetpw
X
X.if !defined(NOPORTDOCS)
XPORTDOCS= INSTALL README
X.endif
X
X.if defined(WITH_OPENLDAP_VER)
XWANT_OPENLDAP_VER= ${WITH_OPENLDAP_VER}
X.endif
X
X.include <bsd.port.pre.mk>
X
Xpre-install:
X ${CC} ${CFLAGS} ${WRKSRC}/checkadpassword.c ${WRKSRC}/ad_func.c -o \
X ${WRKSRC}/checkadpassword
X ${CC} ${CFLAGS} ${WRKSRC}/qmail-adgetpw.c ${WRKSRC}/ad_func.c -o \
X ${WRKSRC}/qmail-adgetpw
X ${CC} ${CFLAGS} ${WRKSRC}/create_alias_files.c ${WRKSRC}/ad_func.c -o \
X ${WRKSRC}/create_alias_files
X
Xdo-install:
X ${INSTALL_PROGRAM} ${WRKSRC}/checkadpassword ${PREFIX}/bin/
X ${INSTALL_PROGRAM} ${WRKSRC}/qmail-adgetpw ${PREFIX}/bin/
X ${INSTALL_PROGRAM} ${WRKSRC}/create_alias_files ${PREFIX}/bin/
X ${CHMOD} 700 ${PREFIX}/bin/checkadpassword
X ${CHMOD} 711 ${PREFIX}/bin/qmail-adgetpw
X ${CHMOD} 700 ${PREFIX}/bin/create_alias_files
X ${CHOWN} root:qmail ${PREFIX}/bin/qmail-adgetpw
X ${CHOWN} root:wheel ${PREFIX}/bin/create_alias_files
X.if !defined(NOPORTDOCS)
X ${MKDIR} ${DOCSDIR}
X.for i in ${PORTDOCS}
X ${INSTALL_DATA} ${WRKSRC}/${i} ${DOCSDIR}
X.endfor
X.endif
X ${CAT} ${PKGMESSAGE}
X
X.include <bsd.port.post.mk>
END-of-qmail-activedir/Makefile
echo x - qmail-activedir/distinfo
sed 's/^X//' >qmail-activedir/distinfo << 'END-of-qmail-activedir/distinfo'
XMD5 (qmail-activedir-0.15.tar.gz) = f0e839132db948f047dee61fb701ff38
XSIZE (qmail-activedir-0.15.tar.gz) = 12005
END-of-qmail-activedir/distinfo
echo c - qmail-activedir/files
mkdir -p qmail-activedir/files > /dev/null 2>&1
echo x - qmail-activedir/files/patch-ad_func.h
sed 's/^X//' >qmail-activedir/files/patch-ad_func.h << 'END-of-qmail-activedir/files/patch-ad_func.h'
X--- ad_func.h.old Tue Nov 8 13:30:17 2005
X+++ ad_func.h Tue Nov 8 13:31:22 2005
X@@ -3,11 +3,11 @@
X
X /*set to 1 to use the global catalog, 0 to use LDAP.
X * LDAP is fine, except to span multiple subdomains*/
X-#define AD_USE_GC 1
X+#define AD_USE_GC 0
X
X /* Set to 1 to only allow SSL type active directory connections
X * 0 to use no encryption*/
X-#define AD_ONLY_USE_SSL 1
X+#define AD_ONLY_USE_SSL 0
X
X /* Change to wherever you want to log to
X * i.e. LOG_AUTH, LOG_MAIL, LOG_SYSLOG, etc.*/
X@@ -24,19 +24,19 @@
X #define ALIAS_NAME "alias"
X #define ALIAS_UID 1001
X #define ALIAS_GID 101
X-#define ALIAS_DIR_HEADER "/var/qmail/alias"
X+#define ALIAS_DIR_HEADER "$(QMAIL_PREFIX)/alias"
X
X /* Creates the home directory if it doesn't exist*/
X #define CREATE_HOME_DIR 1
X
X /* Also create the maildir within the homedir when creating the home dir*/
X #define CREATE_MAILDIR 1
X-#define QMAIL_MAILDIRMAKE "/var/qmail/bin/maildirmake"
X+#define QMAIL_MAILDIRMAKE "$(QMAIL_PREFIX)/bin/maildirmake"
X
X /* Convert the mailusername to lowercase for the delivery directory*/
X #define CONVERT_MAILNAME_TO_LOWERCASE 1
X
X-#define CONTROL "/var/qmail/control/"
X+#define CONTROL "$(QMAIL_PREFIX)/control/"
X #define AD_DEFAULTUID_LOC CONTROL "ad_uid"
X #define AD_DEFAULTGID_LOC CONTROL "ad_gid"
X #define AD_DEFAULTMAILROOT_LOC CONTROL "ad_mailroot"
END-of-qmail-activedir/files/patch-ad_func.h
echo x - qmail-activedir/files/pkg-message.in
sed 's/^X//' >qmail-activedir/files/pkg-message.in << 'END-of-qmail-activedir/files/pkg-message.in'
X*****************************************************************************
XYou have installed the qmail-activedir.
X
XNow you need follow this steps:
X
X1) create the control files.
X
X2.a) Test
X
X# %%QMAIL_PREFIX%%/bin/qmail-popup blah %%PREFIX%%/bin/checkadpassword id
X
XPut in a valid username and password and it should give you the results of id.
XDo the same with pwd to make sure that the user, group and directory are
Xcorrect.
X
XDo it again with an invalid username and password to verify that it will
Xactually reject failures.
X
XCheck the auth log to verify that the failure occurred.
X
X2.b) Test some more
X
XNext test the ad_getpw:
X
X# %%PREFIX%%/bin/ad_getpw user
XIt should return the user, uid, gid, homedir, separated by NULL character
X
X2.c) Just using create_alias_files will let you know if it works...
XDo %%PREFIX%%/bin/create_alias_files -h for more info.
X
X3) Copy the original someplace and rename:
X# mv %%QMAIL_PREFIX%%/bin/qmail-getpw %%QMAIL_PREFIX%%/bin/qmail-getpw_old
X# cp %%PREFIX%%/bin/qmail-adgetpw %%QMAIL_PREFIX%%/bin/qmail-getpw
X
X4) Update your qmail pop scripts (run file) like this:
X...
X%%QMAIL_PREFIX%%/bin/qmail-popup "${POPUPHOST-`sed 1q %%QMAIL_PREFIX%%/control/me`}" \
X%%PREFIX%%/checkadpassword \
X%%QMAIL_PREFIX%%/bin/qmail-pop3d "${MAILDIRNAME-Maildir}"
X...
X
Xand restart. Run some trial tests.
X
XFor more information you should read %%DOCSDIR%%/README.
X
END-of-qmail-activedir/files/pkg-message.in
exit
--- qmail-activedir.shar ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list