FreeBSDqmail+vpopmail+etc



# /usr/local/bin/tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp 

準備

インストール2 まで終わっている事。

setenv PACKAGEROOT ftp://ftp3.jp.FreeBSD.org
mount_nfs 192.168.0.146:/back /back

qmail

沢山のパッチをあてた オリジナルpackage を用意しておく。

pkg_add /back/qmail_package/qmail-1.03_7.tbz
/var/qmail/scripts/enable-qmail


cd ~alias
echo '&info@zenno.com' > .qmail-root
echo '&root' > .qmail-postmaster
echo '&root' > .qmail-mailer-daemon


cd /var/qmail/control
touch badmailfrom
touch badmailto
echo '5000' > bouncemaxbytes
echo '120' > concurrencylocal
echo '120' > concurrencyremote
echo '10485760' > databytes
echo '#' > doublebounceto
echo '1000' > maxrcpt
echo '21600' > queuelifetime
ln -s rcpthosts senderhosts
touch smtproutes


echo "#\!/bin/sh" > /var/qmail/rc
echo 'exec env - PATH="/var/qmail/bin:$PATH" \' >> /var/qmail/rc
echo "qmail-start ./Maildir/" >> /var/qmail/rc
chmod +x /var/qmail/rc

daemontools

pkg_add -r daemontools
echo 'svscan_enable="YES"' >> /etc/rc.conf
mkdir /var/qmail/services
cd /var/qmail/services
mkdir qmail smtpd smtpd2 smtpsd pop3d pop3sd
chmod +t *
mkdir qmail/log smtpd/log smtpd2/log smtpsd/log pop3d/log pop3sd/log
cd qmail

echo "#\!/bin/sh" > run
echo "PATH=/var/qmail/bin:/usr/local/bin:/bin:/usr/bin" >> run
echo "exec /var/qmail/rc" >> run

echo "#\!/bin/sh" > log/run
echo "exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t s16777215 n30 \" >> log/run
echo "/var/log/qmail/qmail \" >> log/run
echo "-'*' \" >> log/run
echo "+'* status: *' \" >> log/run
echo "=/var/log/qmail/qmail/status" >> log/run
cd ../smtpd

echo "#\!/bin/sh" > run
echo "PATH=/var/qmail/bin:/usr/local/bin:/bin:/usr/bin" >> run
echo "exec tcpserver -c 120 -H -R -l $HOST -v -u 82 -g 81 \" >> run
echo "-x /usr/local/vpopmail/etc/tcp.smtp.cdb \" >> run
echo "0 smtp fixcrio recordio qmail-smtpd \" >> run
echo "$HOST /usr/local/vpopmail/bin/vchkpw true 2>&1" >> run

echo "#\!/bin/sh" > log/run
echo "exec /usr/local/bin/setuidgid qmails /usr/local/bin/multilog t s16777215 n30 \" >> log/run
echo "-'*' \" >> log/run
echo "+'* *tcpserver: *' \" >> log/run
echo "+'* * < AUTH *' \" >> log/run
echo "+'* * < MAIL *' \" >> log/run
echo "+'* * < RCPT *' \" >> log/run
echo "+'* * > 4*' \" >> log/run
echo "+'* * > 5*' \" >> log/run
echo "/var/log/qmail/smtpd \" >> log/run
echo "-'*' \" >> log/run
echo "+'* * status:*' \" >> log/run
echo "=/var/log/qmail/smtpd/status" >> log/run
cd ../smtpd2

echo "#\!/bin/sh" > run
echo "PATH=/var/qmail/bin:/usr/local/bin:/bin:/usr/bin" >> run
echo "exec tcpserver -c 120 -H -R -l $HOST -v -u 82 -g 81 \" >> run
echo "-x /usr/local/vpopmail/etc/tcp.smtp.cdb \" >> run
echo "0 587 fixcrio recordio qmail-smtpd \" >> run
echo "$HOST /usr/local/vpopmail/bin/vchkpw true 2>&1" >> run

echo "#\!/bin/sh" > log/run
echo "exec /usr/local/bin/setuidgid qmails /usr/local/bin/multilog t s16777215 n30 \" >> log/run
echo "-'*' \" >> log/run
echo "+'* *tcpserver: *' \" >> log/run
echo "+'* * < AUTH *' \" >> log/run
echo "+'* * < MAIL *' \" >> log/run
echo "+'* * < RCPT *' \" >> log/run
echo "+'* * > 4*' \" >> log/run
echo "+'* * > 5*' \" >> log/run
echo "/var/log/qmail/smtpd2 \" >> log/run
echo "-'*' \" >> log/run
echo "+'* * status:*' \" >> log/run
echo "=/var/log/qmail/smtpd2/status" >> log/run
cd ../smtpsd

echo "#\!/bin/sh" > run
echo "PATH=/var/qmail/bin:/usr/local/bin:/bin:/usr/bin" >> run
echo "exec tcpserver -c 120 -H -R -l $HOST -v -u 82 -g 81 \" >> run
echo "-x /usr/local/vpopmail/etc/tcp.smtp.cdb -s -n /var/qmail/cert.pem \" >> run
echo "0 smtps fixcrio recordio qmail-smtpd \" >> run
echo "$HOST /usr/local/vpopmail/bin/vchkpw true 2>&1" >> run

echo "#\!/bin/sh" > log/run
echo "exec /usr/local/bin/setuidgid qmails /usr/local/bin/multilog t s16777215 n30 \" >> log/run
echo "-'*' \" >> log/run
echo "+'* *tcpserver: *' \" >> log/run
echo "+'* * < AUTH *' \" >> log/run
echo "+'* * < MAIL *' \" >> log/run
echo "+'* * < RCPT *' \" >> log/run
echo "+'* * > 4*' \" >> log/run
echo "+'* * > 5*' \" >> log/run
echo "/var/log/qmail/smtpsd \" >> log/run
echo "-'*' \" >> log/run
echo "+'* * status:*' \" >> log/run
echo "=/var/log/qmail/smtpsd/status" >> log/run
cd ../pop3d

echo "#\!/bin/sh" > run
echo "PATH=/var/qmail/bin:/usr/local/bin:/bin:/usr/bin" >> run
echo "exec tcpserver -HRv -c120 \" >> run
echo "-l0 0 pop3 recordio qmail-popup $HOST \" >> run
echo "/home/vpopmail/bin/vchkpw qmail-pop3d Maildir 2>&1" >> run

echo "#\!/bin/sh" > log/run
echo "exec /usr/local/bin/setuidgid qmailp /usr/local/bin/multilog t s16777215 n30 \" >> log/run
echo "-'*' \" >> log/run
echo "+'* tcpserver: *' \" >> log/run
echo "+'* * < USER *' \" >> log/run
echo "+'* * < PASS *' \" >> log/run
echo "+'* * < APOP *' \" >> log/run
echo "+'* * > -ERR*' \" >> log/run
echo "/var/log/qmail/pop3d \" >> log/run
echo "-'*' \" >> log/run
echo "+'* * status: *' \" >> log/run
echo "=/var/log/qmail/pop3d/status" >> log/run
cd ../pop3sd

echo "#\!/bin/sh" > run
echo "PATH=/var/qmail/bin:/usr/local/bin:/bin:/usr/bin" >> run
echo "exec tcpserver -HRsv -c120 -n /var/qmail/cert.pem \" >> run
echo "-l0 0 pop3s recordio qmail-popup $HOST \" >> run
echo "/home/vpopmail/bin/vchkpw qmail-pop3d Maildir 2>&1" >> run

echo "#\!/bin/sh" > log/run
echo "exec /usr/local/bin/setuidgid qmailp /usr/local/bin/multilog t s16777215 n30 \" >> log/run
echo "-'*' \" >> log/run
echo "+'* tcpserver: *' \" >> log/run
echo "+'* * < USER *' \" >> log/run
echo "+'* * < PASS *' \" >> log/run
echo "+'* * < APOP *' \" >> log/run
echo "+'* * > -ERR*' \" >> log/run
echo "/var/log/qmail/pop3sd \" >> log/run
echo "-'*' \" >> log/run
echo "+'* * status: *' \" >> log/run
echo "=/var/log/qmail/pop3sd/status" >> log/run
cd ../
chmod +x */run
chmod +x */log/run 
mkdir /var/log/qmail
cd /var/log/qmail
mkdir qmail smtpd smtpd2 smtpsd pop3d pop3sd
chown qmaill:qnofiles qmail
chown qmails:qnofiles smtp*
chown qmailp:qnofiles pop3*
chmod 700 *

mkdir /var/service
cd /var/service
ln -s /var/qmail/services/qmail qmail
ln -s /var/qmail/services/smtpd smtpd
ln -s /var/qmail/services/smtpd2 smtpd2
ln -s /var/qmail/services/smtpsd smtpsd
ln -s /var/qmail/services/pop3d pop3d
ln -s /var/qmail/services/pop3sd pop3sd

ucspi-tcp

WITH_SSL=true にてオリジナルpackageで用意しておく。

pkg_add /back/qmail_package/ucspi-tcp-0.88_2.tbz

SSL証明書

SSL証明書 を済ませて置く事。

cd /usr/local/etc/apache22/
cat server.key server.crt > /var/qmail/cert.pem

mess822

受信拒否設定やヘッダーのみ転送などで使用。
パッケージが提供されていないので オリジナルpackageで用意しておく。

pkg_add /back/qmail_package/mess822-0.58_1.tbz

procmail

ステルス転送でヘッダの書き換えに使用。

pkg_add -r procmail

autorespond

pkg_add -r autorespond

vpopmail

WITH_MYSQL=yes WITH_CLEAR_PASSWD=yes
WITH_SMTP_AUTH_PATCH=yes RELAYCLEAR=20
にて オリジナルpackage を用意しておく。

pkg_add /back/qmail_package/vpopmail-5.4.30_4.tbz
ln -s /usr/local/vpopmail/ /home/vpopmail

# smtp-auth の為に権限変更
chown root /home/vpopmail/bin/vchkpw
chmod 4755 /home/vpopmail/bin/vchkpw
# MySQL用の設定
cd /home/vpopmail/etc/
echo "localhost|0|USER|PASS|vpopmail" > vpopmail.mysql
chown vpopmail:vchkpw vpopmail.mysql

mysql -u root -pPASS
CREATE DATABASE vpopmail;
GRANT select,insert,update,delete,create,drop ON vpopmail.*
TO USER@localhost IDENTIFIED BY 'PASS';
quit
echo '*/5 * * * * /usr/local/vpopmail/bin/clearopensmtp' >> /var/cron/tabs/root
patch -p0 < /back/src/vlimits.patch
chown vpopmail:vchkpw vlimits.default
  • ==> vlimits.patch <==
    --- vlimits.default.orig        2010-09-17 15:38:51.000000000 +0900
    +++ vlimits.default     2010-09-17 15:39:05.000000000 +0900
    @@ -14,7 +14,7 @@
    
     # default quota for newly created users (in bytes)
     # example shows a user with a 10MB quota and a limit of 1000 messages
    -#default_quota         10485760
    +default_quota          31457280
     #default_maxmsgcount   1000
    
     # uncomment the following lines to disable certain features
    
patch -p0 < /back/src/tcp_smtp.patch
chown vpopmail:vchkpw tcp.smtp
  • ==> tcp_smtp.patch <==
    --- tcp.smtp.orig       2010-09-07 11:11:07.000000000 +0900
    +++ tcp.smtp    2010-09-17 15:46:06.000000000 +0900
    @@ -1 +1,18 @@
    +##### for squirrelmail ######
    +192.168.0.135:allow,RELAYCLIENT=""
    +192.168.0.167:allow,RELAYCLIENT=""
    +##### for mail-gateway ######
    +192.168.0.142:allow,ALLOWEDHOST=""
    +192.168.0.144:allow,ALLOWEDHOST=""
    +192.168.0.146:allow,ALLOWEDHOST=""
    +192.168.0.147:allow,ALLOWEDHOST=""
    +192.168.0.148:allow,ALLOWEDHOST=""
    +192.168.0.149:allow,ALLOWEDHOST=""
    +192.168.0.150:allow,ALLOWEDHOST=""
    +192.168.0.151:allow,ALLOWEDHOST=""
    +192.168.0.152:allow,ALLOWEDHOST=""
    +192.168.0.:allow,ALLOWEDHOST=""
    +######## for localuser #######
     127.:allow,RELAYCLIENT=""
    +######## the others ##########
    +:allow
    

courier-imap

WITHOUT_IPV6=true WITH_AUTH_VCHKPW=true にてオリジナルpackageで用意しておく。
また、パッケージのcourier-authlib-vchkpwはmysql非対応なのでこちらもportsからオリジナルpackageで用意しておく。

pkg_add -r sysconftool
pkg_add -r courier-authlib-base
pkg_add /back/qmail_package/courier-authlib-vchkpw-0.63.0_1.tbz
pkg_add /back/qmail_package/courier-imap-4.8.0,2.tbz
echo 'courier_authdaemond_enable="YES"' >> /etc/rc.conf
echo 'courier_imap_imapd_enable="YES"' >> /etc/rc.conf
echo 'courier_imap_imapd_ssl_enable="YES"' >> /etc/rc.conf

cd /usr/local/etc/apache22/
cat server.key server.crt > /usr/local/share/courier-imap/imapd.pem
cd /usr/local/etc/courier-imap
patch -p0 < /back/src/courier.patch
  • ==> courier.patch <==
    --- imapd.dist  2010-09-07 11:27:49.000000000 +0900
    +++ imapd       2010-09-25 17:07:16.000000000 +0900
    @@ -57,7 +57,7 @@
     #
     #  Maximum number of connections to accept from the same IP address
    
    -MAXPERIP=4
    +MAXPERIP=5
    
     ##NAME: PIDFILE:0
     #
    
    --- imapd-ssl.dist      2010-09-07 11:27:49.000000000 +0900
    +++ imapd-ssl   2010-09-25 17:08:53.000000000 +0900
    @@ -322,7 +322,7 @@
     # problems with SSL clients.  Disable SSL caching by commenting out the
     # following settings: 
    
    -TLS_CACHEFILE=/usr/local/var/couriersslcache
    +TLS_CACHEFILE=/var/run/couriersslcache
     TLS_CACHESIZE=524288
    
     ##NAME: MAILDIRPATH:0
    

qmailmrtg

pkg_add -r qmailmrtg7

mkdir /usr/local/www/qmailmrtg
cd /usr/local/www/qmailmrtg
cp /back/src/qmail.mrtg.cfg  qmail.mrtg.cfg
cp /back/src/index.html  index.html
cp /back/src/qmailmrtg.conf /usr/local/etc/apache22/Includes/qmailmrtg.conf

echo '*/5 * * * * /usr/local/bin/mrtg /usr/local/www/qmailmrtg/qmail.mrtg.cfg' >> /var/cron/tabs/root
  • ==> qmailmrtg.conf <==
        Alias /qmailmrtg "/usr/local/www/qmailmrtg/"
    
        <Directory "/usr/local/www/qmailmrtg/">
            Options none
            AllowOverride Limit
    
            Order Deny,Allow
            Deny from all
            Allow from 192.168.
        </Directory>
    
  • ==> index.html <==
    <!-- Begin Head -->
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
    <HTML>
    <HEAD>
    <TITLE> kenji.zenno.net - Qmail Mrtg Stats</TITLE>
    <META HTTP-EQUIV="Refresh" CONTENT="300">
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
    </HEAD>
    <BODY BGCOLOR="#ffffff" text="#000000" link="#000000" vlink="#000000"
    alink="#000000">
    
    <B>kenji.zenno.net Qmail Mrtg Stats</B>
    <table BORDER=0 CELLPADDING=0 CELLSPACING=0>
    
    <tr>
    <td>
    <B><a href=msg.html>Messages</a> (5 Minute Average)</B><BR>
    <a href=msg.html><IMG BORDER=1 SRC="msg-day.png" width=450 height=185 ALT="day"></a>
    </td>
    <td>
    <B><a href=concurrency.html>Local/Remote Concurrency</a> (5 Minute Average)</B><BR>
    <a href=concurrency.html><IMG BORDER=1 SRC="concurrency-day.png" width=450 height=185 ALT="day"></a>
    </td>
    </tr>
    
    <tr>
    <td>
    <B><a href=smtpad.html>SMTP Totals</a> (5 Minute Average)</B><BR>
    <a href=smtpad.html><IMG BORDER=1 SRC="smtpad-day.png" width=450 height=185 ALT="day"></a>
    </td>
    <td>
    <B><a href=smtp.html>SMTP Concurrency</a> (5 Minute Average)</B><BR>
    <a href=smtp.html><IMG BORDER=1 SRC="smtp-day.png" width=450 height=185 ALT="day"></a>
    </td>
    </tr>
    
    <tr>
    <td>
    <B><a href=smtpad2.html>SMTP2 Totals</a> (5 Minute Average)</B><BR>
    <a href=smtpad2.html><IMG BORDER=1 SRC="smtpad2-day.png" width=450 height=185 ALT="day"></a>
    </td>
    <td>
    <B><a href=smtp2.html>SMTP2 Concurrency</a> (5 Minute Average)</B><BR>
    <a href=smtp2.html><IMG BORDER=1 SRC="smtp2-day.png" width=450 height=185 ALT="day"></a>
    </td>
    </tr>
    
    <tr>
    <td>
    <B><a href=pop3ad.html>POP3 Totals</a> (5 Minute Average)</B><BR>
    <a href=pop3ad.html><IMG BORDER=1 SRC="pop3ad-day.png" width=450 height=185 ALT="day"></a>
    </td>
    <td>
    <B><a href=pop3.html>POP3 Concurrency</a> (5 Minute Average)</B><BR>
    <a href=pop3.html><IMG BORDER=1 SRC="pop3-day.png" width=450 height=185 ALT="day"></a>
    </td>
    </tr>
    
    <tr>
    <td>
    <B><a href=bits.html>Bits Transfered</a> (5 Minute Average)</B><BR>
    <a href=bits.html><IMG BORDER=1 SRC="bits-day.png" width=450 height=185 ALT="day"></a>
    </td>
    <td>
    <B><a href=messstatus.html>Message Status</a> (5 Minute Average)</B><BR>
    <a href=messstatus.html><IMG BORDER=1 SRC="messstatus-day.png" width=450 height=185 ALT="day"></a>
    </td>
    </tr>
    
    
    <tr>
    <td><B><a href=queue-size.html>Queue Size</a> (5 Minute Average)</B><BR>
    <a href=queue-size.html><IMG BORDER=1 SRC="queue-size-day.png" width=450 height=185 ALT="day"></a>
    </td>
    </tr>
    
    </table>
    </BODY>
    </HTML>
  • ==> qmail.mrtg.cfg <==
    WorkDir: /usr/local/www/qmailmrtg/
    #############################################################
    
    Title[msg]: Messages - kenji.zenno.net
    MaxBytes[msg]: 10000
    AbsMax[msg]: 20000
    Options[msg]: gauge
    Target[msg]: `/usr/local/bin/qmailmrtg7 m /var/log/qmail/qmail`
    PageTop[msg]: <B>kenji.zenno.net Messages</B><br>
    ShortLegend[msg]: msg
    YLegend[msg]: msg/hour
    Legend1[msg]: Total Msg&nbsp;
    LegendI[msg]: Deliveries:&nbsp;
    LegendO[msg]: Attempts:&nbsp;
    WithPeak[msg]: ymwd
    XSize[msg]: 350
    YSize[msg]: 150
    
    #-------------------------------------------------------------------
    
    Title[queue-size]: Queue Size - kenji.zenno.net
    MaxBytes[queue-size]: 10000
    AbsMax[queue-size]: 100000
    Options[queue-size]: gauge
    Target[queue-size]: `/usr/local/bin/qmailmrtg7 q /var/qmail/queue`
    PageTop[queue-size]: <B>kenji.zenno.net Queue Size</B><br>
    ShortLegend[queue-size]: Msg
    YLegend[queue-size]: msg total
    Legend1[queue-size]: msg&nbsp;
    LegendI[queue-size]: msg&nbsp;
    LegendO[queue-size]: unprocessed msg:&nbsp;
    WithPeak[queue-size]: ymwd
    XSize[queue-size]: 350
    YSize[queue-size]: 150
    
    #-------------------------------------------------------------------
    
    Title[concurrency]: Local/Remote Concurrency - kenji.zenno.net
    MaxBytes[concurrency]: 500
    AbsMax[concurrency]: 10000
    Options[concurrency]: gauge
    Target[concurrency]: `/usr/local/bin/qmailmrtg7 c /var/log/qmail/qmail`
    PageTop[concurrency]: <B>kenji.zenno.net - Local/Remote Concurrency</B><br>
    ShortLegend[concurrency]: concurrency
    YLegend[concurrency]: max concurrency
    Legend1[concurrency]: concurrency&nbsp;
    LegendI[concurrency]: local&nbsp;
    LegendO[concurrency]: remote&nbsp;
    WithPeak[concurrency]: ymwd
    XSize[concurrency]: 350
    YSize[concurrency]: 150
    
    #-------------------------------------------------------------------
    
    Title[messstatus]: Message Status - kenji.zenno.net
    MaxBytes[messstatus]: 10000
    AbsMax[messstatus]: 100000
    Options[messstatus]: gauge
    Target[messstatus]: `/usr/local/bin/qmailmrtg7 s /var/log/qmail/qmail`
    PageTop[messstatus]: <B>kenji.zenno.net - Message Status</B><BR>
    ShortLegend[messstatus]: msg
    YLegend[messstatus]: msg/hour
    Legend1[messstatus]: msg&nbsp;
    LegendI[messstatus]: success&nbsp;
    LegendO[messstatus]: failures&nbsp;
    WithPeak[messstatus]: ymwd
    XSize[messstatus]: 350
    YSize[messstatus]: 150
    
    #-------------------------------------------------------------------
    
    Title[bits]: Bits Transfered - kenji.zenno.net
    MaxBytes[bits]: 1540000
    AbsMax[bits]: 100000000
    Options[bits]: gauge
    Target[bits]: `/usr/local/bin/qmailmrtg7 b /var/log/qmail/qmail`
    PageTop[bits]: <B>kenji.zenno.net - Bits Transfered</B><br>
    ShortLegend[bits]: bits
    YLegend[bits]: bits/sec
    Legend1[bits]: bits&nbsp;
    LegendI[bits]: bits&nbsp;
    LegendO[bits]: bits&nbsp;
    WithPeak[bits]: ymwd
    XSize[bits]: 350
    YSize[bits]: 150
    
    #-------------------------------------------------------------------
    
    Title[smtp]: SMTP Concurrency - kenji.zenno.net
    MaxBytes[smtp]: 100
    AbsMax[smtp]: 500
    Options[smtp]: gauge
    Target[smtp]: `/usr/local/bin/qmailmrtg7 t /var/log/qmail/smtpd`
    PageTop[smtp]: <B>kenji.zenno.net - SMTP Concurrency</B><BR>
    ShortLegend[smtp]: SMTP
    YLegend[smtp]: max SMTP
    Legend1[smtp]: SMTP&nbsp;
    LegendI[smtp]: SMTP&nbsp;
    LegendO[smtp]: SMTP&nbsp;
    WithPeak[smtp]: ymwd
    XSize[smtp]: 350
    YSize[smtp]: 150
    
    #-------------------------------------------------------------------
    
    Title[smtpad]: SMTP Totals - kenji.zenno.net
    MaxBytes[smtpad]: 1000
    AbsMax[smtpad]: 100000
    Options[smtpad]: gauge
    Target[smtpad]: `/usr/local/bin/qmailmrtg7 a /var/log/qmail/smtpd`
    PageTop[smtpad]: <B>kenji.zenno.net - SMTP Totals</B><BR>
    ShortLegend[smtpad]: SMTP
    YLegend[smtpad]: SMTP/hour
    Legend1[smtpad]: SMTP&nbsp;
    LegendI[smtpad]: Allow&nbsp;
    LegendO[smtpad]: Deny&nbsp;
    WithPeak[smtpad]: ymwd
    XSize[smtpad]: 350
    YSize[smtpad]: 150
    
    #-------------------------------------------------------------------
    Title[pop3]: POP3 Concurrency - kenji.zenno.net
    MaxBytes[pop3]: 100
    AbsMax[pop3]: 500
    Options[pop3]: gauge
    Target[pop3]: `/usr/local/bin/qmailmrtg7 t /var/log/qmail/pop3d`
    PageTop[pop3]: <B>kenji.zenno.net POP3 Concurrency</B><BR>
    ShortLegend[pop3]: POP3
    YLegend[pop3]: max POP3
    Legend1[pop3]: POP3&nbsp;
    LegendI[pop3]: POP3&nbsp;
    LegendO[pop3]: POP3&nbsp;
    WithPeak[pop3]: ymwd
    XSize[pop3]: 350
    YSize[pop3]: 150
    
    #-------------------------------------------------------------------
    
    Title[pop3ad]: POP3 Totals - kenji.zenno.net
    MaxBytes[pop3ad]: 1000
    AbsMax[pop3ad]: 100000
    Options[pop3ad]: gauge
    Target[pop3ad]: `/usr/local/bin/qmailmrtg7 a /var/log/qmail/pop3d`
    PageTop[pop3ad]: <B>kenji.zenno.net - POP3 Totals</B><BR>
    ShortLegend[pop3ad]: POP3
    YLegend[pop3ad]: POP3/hour
    Legend1[pop3ad]: POP3&nbsp;
    LegendI[pop3ad]: Allow&nbsp;
    LegendO[pop3ad]: Deny&nbsp;
    WithPeak[pop3ad]: ymwd
    XSize[pop3ad]: 350
    YSize[pop3ad]: 150
    
    #-------------------------------------------------------------------
    
    Title[smtp2]: SMTP2 Concurrency - kenji.zenno.net
    MaxBytes[smtp2]: 100
    AbsMax[smtp2]: 500
    Options[smtp2]: gauge
    Target[smtp2]: `/usr/local/bin/qmailmrtg7 t /var/log/qmail/smtpd2`
    PageTop[smtp2]: <B>kenji.zenno.net - SMTP2 Concurrency</B><BR>
    ShortLegend[smtp2]: SMTP2
    YLegend[smtp2]: max SMTP2
    Legend1[smtp2]: SMTP2&nbsp;
    LegendI[smtp2]: SMTP2&nbsp;
    LegendO[smtp2]: SMTP2&nbsp;
    WithPeak[smtp2]: ymwd
    XSize[smtp2]: 350
    YSize[smtp2]: 150
    
    #-------------------------------------------------------------------
    
    Title[smtpad2]: SMTP2 Totals - kenji.zenno.net
    MaxBytes[smtpad2]: 1000
    AbsMax[smtpad2]: 100000
    Options[smtpad2]: gauge
    Target[smtpad2]: `/usr/local/bin/qmailmrtg7 a /var/log/qmail/smtpd2`
    PageTop[smtpad2]: <B>kenji.zenno.net - SMTP2 Totals</B><BR>
    ShortLegend[smtpad2]: SMTP2
    YLegend[smtpad2]: SMTP2/hour
    Legend1[smtpad2]: SMTP2&nbsp;
    LegendI[smtpad2]: Allow&nbsp;
    LegendO[smtpad2]: Deny&nbsp;
    WithPeak[smtpad2]: ymwd
    XSize[smtpad2]: 350
    YSize[smtpad2]: 150
    

queue-fix

pkg_add -r queue-fix

管理用スクリプト

mkdir /usr/local/scripts
ln -s /usr/local/scripts /usr/local/src
cp -p /back/src/queue* /usr/local/scripts
cp -p /back/src/fw2.sh /usr/local/scripts
cp -p /back/src/find-rm.sh /usr/local/scripts
cp -p /back/src/spam2.sh /usr/local/scripts
cp -p /back/src/back.sh /usr/local/scripts
cp -p /back/src/send-q.sh /usr/local/scripts
 
echo '0 * * * * /usr/local/scripts/queue.sh' >> /var/cron/tabs/root
echo '0 2 * * * /usr/local/scripts/find-rm.sh' >> /var/cron/tabs/root
echo '0 3 * * * /usr/local/scripts/back.sh' >> /var/cron/tabs/root
echo 'MAILTO="i@zenno.com"' >> /var/cron/tabs/root
echo '*/4 * * * * /usr/local/src/queue2.sh' >> /var/cron/tabs/root

他のマシンとの連携

  • rshの設定
    patch -p0 < /back/src/rsh.patch
    cp /back/src/rhosts.txt  /root/.rhosts
  • cat /root/.rhosts
    +               root  #/etc/hosts.allow で許可した範囲はやり放題
    192.168.0.135   www   #Web上のPHPからコマンド実行の為
    192.168.0.161   vpopmail    #ステルス送信のコピーを保存する為
    
  • Mysql権限設定 + 旧クライアント対応パスワード設定
    GRANT ALL PRIVILEGES ON * . * TO 'kenji'@'192.168.0.%' IDENTIFIED BY 'PASS';
    SET PASSWORD FOR 'kenji'@'192.168.0.%' = OLD_PASSWORD( 'PASS' );
    

Mysqlチューニング

echo "[mysqld]" > /var/db/mysql/my.cnf
echo "max_connections=1000" >> /var/db/mysql/my.cnf
echo "thread_cache=100" >> /var/db/mysql/my.cnf
/usr/local/etc/rc.d/mysql-server restart

Labelのカスタマイズ

mkdir /data /log

vi /etc/fstab
------
# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/ad4s1a             /               ufs     rw              1       1
/dev/ad4s1b             none            swap    sw              0       0
/dev/ad4s1d             /log            ufs     rw              2       2
/dev/ad4s1e             /data           ufs     rw              2       2
/dev/ad4s1f             /back           ufs     rw              2       2
/dev/acd0               /cdrom          cd9660  ro,noauto       0       0
-----

mount -a
df -h
-----
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/ad4s1a    4.8G    578M    3.9G    13%    /
devfs          1.0K    1.0K      0B   100%    /dev
/dev/ad4s1d    4.8G    478K    4.5G     0%    /log
/dev/ad4s1e     19G     66K     18G     0%    /data
/dev/ad4s1f    189G     53M    174G     0%    /back
-----
  
/usr/local/etc/rc.d/mysql-server stop
/usr/local/etc/rc.d/svscan stop

cd /data
mkdir vpopmail domains
chown mysql:mysql vpopmail
chown vpopmail:vchkpw domains
chmod 700 *

cd /var/db/mysql
rm -r vpopmail
ln -s /data/vpopmail vpopmail

cd /home/vpopmail
rm -r domains
ln -s /data/domains domains

cd /log
mkdir qmail smtpd smtpd2 smtpsd pop3d pop3sd
chown qmaill:qnofiles qmail
chown qmails:qnofiles smtp*
chown qmailp:qnofiles pop3*
chmod 700 *

cd /var/log/
rm -r qmail
ln -s /log qmail

/usr/local/etc/rc.d/mysql-server start
/usr/local/etc/rc.d/svscan start

dump [qmail]

  • ココまでの状態をqmailの第三段階として dump しておく
    shutdown -r now
    
    mount_nfs 192.168.0.146:/back /back
    
    dump 0uafL /back/kenji/03_qmail.dump /
    

FreeBSD


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2016-07-02 (土) 17:29:10 (1932d)