Qmail Webserver

From Pruonckk.org

Conteúdo

Prefácio

Vamos tratar aqui de uma instalacao de qmail para o envio de formularios de sites

Baixando os pacotes

 mkdir /usr/src/downloads
 cd /usr/src/downloads

 wget -c http://shupp.org/software/netqmail-1.05.tar.gz
 wget -c http://shupp.org/software/toaster-scripts-0.7.tar.gz
 wget -c http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
 wget -c http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz
 wget -c http://www.enderunix.org/spamguard/spamguard-1.6.tar.gz


Descompactando o netqmail

 tar -xzvf netqmail-1.05.tar.gz
 cd netqmail-1.05
 ./collate.sh


Instalando o DaemonsTools

  mkdir -p /package
  chmod 1755 /package
  cd /package
  tar -xzvf /usr/src/downloads/damontools-0.76.tar.gz
  cd admin/daemontools-0.76/
  patch -p1 < /usr/src/downloads/netqmail-1.05/other-patches/daemontools-0.76.errno.patch
  ./package/install
  ps ax | grep svscan

A saida devera ser similar a abaixo

        12592 ?        Ss     0:00 /bin/sh /command/svscanboot
        12594 ?        S      0:00 svscan /service
        12598 pts/0    S+     0:00 grep svscan


Instalando o ucspi-tcp

  cd /usr/src/downloads
  tar -xzvf ucspi-tcp-0.88.tar.gz
  cd ucspi-tcp-0.88
  patch -p1 < ../netqmail-1.05/other-patches/ucspi-tcp-0.88.errno.patch
  make
  make setup check


Instalando o qmail

  mkdir /var/qmail
  groupadd nofiles
  useradd -g nofiles -d /var/qmail/alias alias
  useradd -g nofiles -d /var/qmail qmaild
  useradd -g nofiles -d /var/qmail qmaill
  useradd -g nofiles -d /var/qmail qmailp
  groupadd qmail
  useradd -g qmail -d /var/qmail qmailq
  useradd -g qmail -d /var/qmail qmailr
  useradd -g qmail -d /var/qmail qmails

  cd /usr/src/downloads
  tar -xzvf toaster-scripts-0.7.tar.gz
  cd netqmail-1.05/netqmail-1.5/
  make
  make setup check

  echo 3 > /var/qmail/control/spfbehavior

configurar o endereço de email primario este endereco ira receber os emails para o root, postmaster, e mailer-daemon troque "admin@exemplo.com" para seu endereço de email

  cd ~alias 
  echo "admin@exemplo.com" > .qmail-postmaster
  echo "admin@exemplo.com" > .qmail-mailer-daemon
  echo "admin@exemplo.com" > .qmail-root
  chmod 644 .qmail*

na proxima linha, troque full.hostname pelo hostname que seu servidor tera

  cd /usr/src/downloads/netqmail-1.05/netqmail-1.05/ 
  ./config-fast full.hostname

configurar:

adicione as manpages do qmail ao MANPATH

vi /etc/manpath.config

adicione a seguinte entrada

MANDATORY_MANPATH		/var/qmail/man

salve o arquivo e saia


cd /usr/src/downloads/toaster-scripts-0.7/
cp rc /var/qmail/rc
chmod 755 /var/qmail/rc
mkdir /var/log/qmail
echo ./Maildir > /var/qmail/control/defaultdelivery
cp qmailctl /var/qmail/bin/
chmod 755 /var/qmail/bin/qmailctl
ln -s /var/qmail/bin/qmailctl /usr/bin
ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail
ln -s /var/qmail/bin/sendmail /usr/lib/sendmail


Agora criamos os diretorios/scripts do supervise para os servicos do qmail

 mkdir -p /var/qmail/supervise/qmail-send/log
 mkdir -p /var/qmail/supervise/qmail-smtpd/log

 cd /usr/src/downloads/toaster-scripts-0.7

 cp send.run /var/qmail/supervise/qmail-send/run
 cp send.log.run /var/qmail/supervise/qmail-send/log/run
 cp smtpd.run /var/qmail/supervise/qmail-smtpd/run
 cp smtpd.log.run /var/qmail/supervise/qmail-smtpd/log/run

 echo 20 > /var/qmail/control/concurrencyincoming

 chmod 644 /var/qmail/control/concurrencyincoming

 find /var/qmail/supervise -name "run" -exec chmod 755 {} \;

 mkdir -p /var/log/qmail/smtpd

  chown -R qmaill.nofiles /var/log/qmail

  ln -s /var/qmail/supervise/qmail-send /var/qmail/supervise/qmail-smtpd /service 

  echo "127.:allow,RELAYCLIENT=\"\"" > /etc/tcp.smtp

  tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp

  vi /var/qmail/supervise/qmail-smtpd/run

altere a linha:
      /home/vpopmail/etc/tcp.smtp.cdb para /etc/tcp.smtp.cdb

  echo 20 > /var/qmail/control/concurrencyincoming

  qmailctl stop
  qmailctl start

Instalando o Spamguard

  cd /usr/src/downloads
  tar -xzvf spamguard-1.7.tar.gz
  cd spamguard-1.7
  ./configure
  make
  make install

  cd /usr/local/etc/spamguard
  vi spamguard.conf

Configure-o da seguinte maneira

 #spamguard 1.6 Configuration file

 logtype = "qmail"
 logfile = "/var/log/qmail/current"
 ignorefile = "/usr/local/etc/spamguard/spam-ignore.txt"
 badmailfile = "/var/qmail/control/badmailfrom"
 highfile = "/usr/local/etc/spamguard/spam-high.txt"

 sysadmin = "linux@001hosting.com.br"
 hostname = "001admin.com.br"

 mail_command = "/bin/mail"

 wcnt =  40
 bcnt = 100
 pcnt = 300
 statfile = "/usr/local/etc/spamguard/spamguard.stat";

 ##

Adicione ao crontab a checagem dos logs

crontab -e
* * * * * /usr/local/bin/spamguard > /dev/null


Agora configure os logs do qmail-send para rodarem por mais tempo

vi /var/qmail/supervise/qmail-send/log/run
    troque: exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t /var/log/qmail
    por: exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t s5000 /var/log/qmail
qmailctl stop
qmailctl start


Voltar

Ferramentas pessoais
Inutilidades