SMTP-AUTH:Qmail+vpopmail(转)
本文介绍如何让 qmail 增加 smtpd-auth 功能. <br><br>
1. 安装 qmail-smtpd <br>
<br>
下载 qmail-smptd.patch <a target=_blank href=http://www.elysium.pl/members/brush/>http://www.elysium.pl/members/brush/</a> <br>
<br>
在 /usr/ports/mail/qmail 目录下面,patch <qmail-smptd.patch <br>
重新编译 qmail,并拷贝 qmail-smtpd 到 /var/qmail/bin <br>
<br>
2. 安装 vpopmail <br>
<br>
使用mysql数据库的,需要注意的是一定要改动 vmysql.h 文件中的 mysql密码为你的 vpopmail 用户密码; <br>
<br>
然后改动 vchkpw.c 文件中:下面的内容,分别在相应的位置加上 #ifdef AUTHVCHKPW 和 #endif <br>
<br>
/* Since the vpopmail system runs under a uid/gid <br>
* file system security, and since qmail-pop3d <br>
* is required to run as the pop users uid/gid <br>
* change to the vpasswds uid and gid <br>
*/ <br>
<br>
#ifdef AUTHVCHKPW <br>
<br>
if (setgid(pwent->pw_gid) == -1) { <br>
log_exit(LOG_NOTICE, 4, "vchkpw: setgid() failed"); <br>
} <br>
<br>
/* captn' changing group permissions, Eye Eye! */ <br>
if (setuid(pwent->pw_uid) == -1) { <br>
log_exit(LOG_NOTICE, 5, "vchkpw: setuid() failed"); <br>
} <br>
<br>
/* hop into thier email directory */ <br>
if (chdir(pwent->pw_dir) == -1) { <br>
<br>
/* if the dir does not exist, create it */ <br>
if (vmake_maildir(pwent->pw_dir, pwent->pw_uid, pwent->pw_gid)==-1) { <br>
log_exit(LOG_NOTICE, 5, "vchkpw: make user dir failed"); <br>
} <br>
} <br>
/* set up some environment variables */ <br>
scopy(envbuf1, VCHKPW_USER, MAX_ENV_BUF); <br>
scat(envbuf1, pwent->pw_name, MAX_ENV_BUF); <br>
if (putenv(envbuf1) == -1) <br>
log_exit(LOG_NOTICE,7,"vchkpw: putenv(USER) failed"); <br>
<br>
/* now HOME */ <br>
scopy(envbuf2, VCHKPW_HOME, MAX_ENV_BUF); <br>
scat(envbuf2, pwent->pw_dir, MAX_ENV_BUF); <br>
if (putenv(envbuf2) == -1) <br>
log_exit(LOG_NOTICE, 8, "vchkpw: putenv(HOME) failed"); <br>
<br>
/* Now shell */ <br>
scopy(envbuf3, VCHKPW_SHELL, MAX_ENV_BUF); <br>
if (putenv(envbuf3) == -1) <br>
log_exit(LOG_NOTICE, 9, "vchkpw: putenv(SHELL) failed"); <br>
<br>
/* and a vpopuser */ <br>
scopy(envbuf4, VCHKPW_VPOPUSER, MAX_ENV_BUF); <br>
scat(envbuf4, name, MAX_ENV_BUF); <br>
if (putenv(envbuf4) == -1) <br>
log_exit(LOG_NOTICE, 9, "vchkpw: putenv(VPOPUSER) failed"); <br>
<br>
/* close the auth module connection */ <br>
<br>
/* kick off the next program and exit */ <br>
execvp(argv,argv+1); <br>
<br>
/* yikes! the exec failed, log error */ <br>
log_exit(LOG_NOTICE, 10, "vchkpw: execvp() failed"); <br>
<br>
#endif <br>
/* exit code of 0 */ <br>
return(0); <br>
<br>
然后重新编译 make <br>
<br>
cd work/vpopmail* 目录,cp vchkpw /home/vpopmail/bin/authvchkpw <br>
<br>
chmod a+s /home/vpopmail/bin/authvchkpw <br>
<br><br>
<br>
以下ports安装是在vpopmail老的版本上通过,心版本没有测试,因此不建议采用 ports 安装。 <br>
<br>
在 /usr/ports/mail/vpopmail/下面增加 files 目录,并建立下面两个 patch 文件 <br>
<br>
文件patch-aa,内容如下: <br>
<br>
+++ vmysql.h <br>
27c27 <br>
< #define MYSQL_PASSWD "gipgap" <br>
--- <br>
> #define MYSQL_PASSWD "mypassword" <br>
<br>
文件 patch-bb,内容如下: <br>
+++ vchkpw.c <br>
310a311 <br>
> <br>
311a313 <br>
> <br>
313a316,317 <br>
> #ifdef AUTH_VCHKPW <br>
> <br>
359a364,365 <br>
> <br>
> #endif <br>
<br>
然后make -D WITHOUT_ROAMING -D WITH_MYSQL DEFAULT_DOMAIN=sczg.net,重新编译 <br>
<br>
cd work/vpopmail* 目录,cp vchkpw /home/vpopmail/bin/authvchkpw <br>
<br>
chmod a+s /home/vpopmail/bin/authvchkpw <br>
<br>
3. 把 smtp 的 tcpserver 命名改为: <br>
<br>
/usr/local/bin/tcpserver -u 82 -g 81 0 smtp /var/qmail/bin/qmail-smtpd \ <br>
/usr/local/vpopmail/bin/authvchkpw \ <br>
2>&1 | /var/qmail/bin/splogger smtpd 3 & <br>
<br>
重新启动相应的 tcpserver即可. <br>
<br>
Re:怎么查看Exchange2K里的邮件记录?
详细点好吗<br>Re:SMTP-AUTH:Qmail+vpopmail(转)
我做的老不成功Re:SMTP-AUTH:Qmail+vpopmail(转)
太复杂啦,直接下载打过补丁的qmail-smtp.c文件,重新make 然后cp qmail-smtpd /var/qmail/bin,根本不用修改vchkpw.c。
页:
[1]