SOLARIS+QMAIL+VPOPMAIL+IGENUS+QMAILAMDIN

网络整理 - 06-30

  一准备工作
  安装gccmakeautoconfautomake等编译工具建立网络连接配置域名
  
  二安装patch工具
  # gzip –d patchsolintellocalgz
  # pkgadd –d patchsolintellocal
  # mv /usr/bin/patch /usr/bin/patchbak
  # cp /usr/local/bin/patch /usr/bin/patch
  
  三安装ucspitcp
  # gzip d ucspitcptargz
  # tar xvf ucspitcptar
  # cd ucspitcp
  # patch p < /ucspitcpa_recordpatch
  # patch p < /ucspitcperrnopatch
  # patch p < /ucspitcpnobasepatch
  # make
  # make setup check
  
  四安装qmail
  .建目录
  # mkdir /var/qmail
  # mkdir /var/qmail/alias
  建组及用户
  # groupadd nofiles
  # groupadd qmail
  # useradd g nofiles m d /var/qmail/alias s /bin/false alias
  # useradd g nofiles m d /var/qmail s /bin/false qmaild
  # useradd g nofiles m d /var/qmail s /bin/false qmaill
  # useradd g nofiles m d /var/qmail s /bin/false qmailp
  # useradd g qmail m d /var/qmail s /bin/false qmailq
  # useradd g qmail m d /var/qmail s /bin/false qmailr
  # useradd g qmail m d /var/qmail s /bin/false qmails
  
  打补丁及编绎安装qmail
  
  # gzip d qmailtargz
  # tar xvf qmailtar
  # gzip d qmailsmtpdauthtargz
  # tar xvf qmailsmtpdauthtar
  # cp qmailsmtpdauth/base* qmail
  # patch d qmail < qmailsmtpdauth/authpatch
  # cd qmail
  # patch p < /qmailpatch
  # patch p < /qmailqueuepatch
  # patch p < /qmailqmail_localpatch
  # patch p < /qmailmaildir++patch
  # patch p < /qmailerrnopatch
  
  修改qmailsmtpdc将函数straynewline中的改为(在行)
  查找//两次改其中的url如下(这样可以使QMAIL更安全些)
  
  void straynewline() { out( See \r\n);
  out( llzqq home page: \r\n);
  
  # make setup check
  出现错误后修改autoccldsh文件中CCLD成你所用的环境就可以了
  # /configfast
  
  添加别名用户
  # touch /var/qmail/alias/qmailroot
  # touch /var/qmail/alias/qmailpostmaster
  # touch /var/qmail/alias/qmailmailerdaemon
  
  如果存在postfix和sendmail停用现在的mail服务
  # ln s /var/qmail/bin/sendmail /usr/sbin/sendmail
  # chmod /usr/sbin/sendmail
  
  五安装vpopmail
  建立目录
  # mkdir /export/home/vpopmail
  # mkdir /export/home/vpopmail/etc
  
  添加用户和组
  # groupadd vchkpw
  # useradd g vchkpw s /bin/false m d /export/home/vpopmail vpopmail
  
  添加mysql的vpopmail用户用于操作vpopmail数据库
  
  # mysql u root –p******
  mysql>create database vpopmail;
  mysql>grant all on vpopmail* to vpopmail@localhost identified by password;
  
  编译安装vpopmail
  
  # gzip d vpopmailtargz
  # tar xvf vpopmailtar
  # cd vpopmail
  # vi vmysqlh
  ========================= vmysqlh========================
  #define MYSQL_UPDATE_SERVER localhost (mysql服务器名)
  #define MYSQL_UPDATE_USER vpopmail (用户名)
  #define MYSQL_UPDATE_PASSWD ***** (改成你设置的密码)
  
  #define MYSQL_READ_SERVER localhost (mysql服务器名)
  #define MYSQL_READ_USER vpopmail (用户名)
  #define MYSQL_READ_PASSWD ***** (改成你设置的密码)
  
  在行和行后加 \
  #define TABLE_LAYOUT pw_name char() not null \
  pw_domain char() not null <=====
  pw_passwd char() \
  pw_uid int pw_gid int \
  pw_gecos char( \
  pw_dir char() <=====
  pw_shell char() \
  primary key (pw_name pw_domain )
  ========================= vmysqlh========================
  
  创建tcpsmtp文件(或者使用/etc/tcpsmtp)
  
  # vi /export/home/vpopmail/etc/tcpsmtp
  
  :allowRELAYCLIENT=
  :allow
  
  # cd /export/home/vpopmail/etc
  # tcprules tcpsmtpcdb tcpsmtptmp < tcpsmtp
  
  进行编译
  /configure
  prefix=/export/home/vpopmail
  enablemysql=y
  enableincdir=/opt/sfw/mysql/include/mysql enablelibdir=/opt/sfw/mysql/lib/mysql enabledefaultdomain=
  enablepasswd=n
  enabledefaultquota=s enabletcprulesprog=/usr/local/bin/tcprules enabletcpserverfile=/export/home/vpopmail/etc/tcpsmtp enablevpopuser=vpopmail
  enablevpopgroup=vchkpw
  enableipaliasdomains=n
  
  需要改下面两个文件中的cc s为gcc s
  /cdb/confcc
  /cdb/confld
  
  # make
  # make installstrip
  
  创建虚拟域
  
  # cd /export/home/vpopmail/bin
  # /vadddomain
  
  如果不成功的话则必须先删除创建的域(vdeldomain 域名)
  # /vadduser
  # /vadduser
  如果添加domain时提示Domain already exists但却删除domain又提示Domain does not exist.则采用下面的处理方法.
  删除/var/qmail/control目录下rcpthostsvirtualdomains文件中有关domain的信息同时删除/var/qmail/user目录下assign文件中有关domain的信息;然后运行/var/qmail/bin/qmailnewu.这时候就可以正常添加domain了.
  
  六smtpauth的设置
  修改vchkpw的属性
  # cd /export/home/vpopmail/bin
  # chmod vchkpw
  # chown root:sys vchkpw
  
  如果使用带验证的smtpsmtp进程要调用密码验证程序则必须要使用 setuid 和setgid提高vchkpw的权限才能完成setgid操作
  
  安装cmdcheckpw
  # gzip d cmdcheckpwtargz
  # tar xvf cmdcheckpwtar
  # cd cmdcheckpw
  # make
  # mkdir /usr/man/man
  # make install
  
  七生成qmail的启动脚本
  # cp /var/qmail/boot/home /var/qmail/rc
  对rc文件进行修改以决定投送方式:
  # vi /var/qmail/rc
  这里要注意这三个文件中的命令最好写在一行
  =====================================rc=====================================
  #!/bin/sh
  # Using splogger to send the log through syslog
  # Using dotforward to support sendmailstyle ~/forward files
  # Using qmaillocal to deliver messages to ~/Mailbox by default
  
  exec env PATH=/var/qmail/bin:$PATH qmailstart /Maildir/ splogger qmail &
  =====================================rc=====================================
  编辑smtp服务的启动脚本
  # vi /var/qmail/smtp
  ====================================smtp====================================
  #!/bin/sh
  QMAILDUID=qmaild
  NOFILESGID=nofiles
  /usr/local/bin/tcpserver H R l t v p x /export/home/vpopmail/etc/tcpsmtpcdb u $QMAILDUID g $NOFILESGID smtp /var/qmail/bin/qmailsmtpd /export/home/vpopmail/bin/vchkpw /bin/true /bin/cmdcheckpw /bin/true >& | /var/qmail/bin/splogger smtpd &
  ====================================smtp====================================
  编辑pop服务的启动脚本
  # vi /var/qmail/pop
  ====================================pop====================================
  #!/bin/sh
  /usr/local/bin/tcpserver H R pop /var/qmail/bin/qmailpopup
  /export/home/vpopmail/bin/vchkpw /var/qmail/bin/qmailpopd Maildir &
  ====================================