sendmailからの移行レシピ

以下のテキストは、執筆時当時の情報を元に書いたものであり、 現在の情勢にそぐわないことを含む場合があるので注意されたい。 また、テキストは最終提出原稿で校正を経る前のものなので、実際にUNIXUSER 本誌に記載されたものとは異なる。誤字脱字等そのままである。

致命的な誤り以外は加筆修正等は行なわないので情報の鮮度に気をつけつつ 利用して欲しい。

目次


Part IV sendmail

Part II, III Postfixqmail

MTA




Part IV 







sendmailMTA







	* 
	* 
	* /





MTA





	* 
	*  mail.foo.ymzk.org(10.0.250.25)
	   newmta.foo.ymzk.org(10.0.250.24) 
	* sendmail  Postfix  qmail 
	* mbox Maildir 





	()
	1. DNS

	()
	2. 
	3. MX
	4. MTA
	5. popper

	()
	6. MTA
	7. 
	8. 2
	9. 



(1) DNS

PCPOP/IMAP 
SMTP


POP

	mercury.example.com(10.0.0.25)

PCSMTP/POP


	;;(BIND)
	smtp		IN	A	10.0.0.25
	pop		IN	A	10.0.0.25
	------------------------------------------
	# (djbdns)
	+smtp.example.com:10.0.0.25:86400
	+pop.example.com:10.0.0.25:86400

smtp.example.com, pop.example.com 
SMTPPOPPCMUA

MUA


(2) 





(
)





(3) MX








()
Postfix, qmail 
Part2, Part3 

 @foo.ymzk.org 
mail.foo.ymzk.org(10.0.250.25) 

 cushion.foo.ymzk.org(10.0.250.26) 


	A (foo.ymzk.org)
	B  mail.foo.ymzk.org 



[qmail]
	A : /var/qmail/control/rcpthosts 
	    foo.ymzk.org
	    
	B : /var/qmail/control/smtproutes 
	    foo.ymzk.org:mail.foo.ymzk.org
	    

[Postfix]
	A : /etc/postfix/main.cf 
	    relaydomain = $mydestination, foo.ymzk.org
	    (foo.ymzk.org)
	B : /etc/postfix/main.cf 
	    transport_maps = hash:/etc/postfix/relay
	    /etc/postfix/relay 
	    foo.ymzk.org	smtp:[mail.foo.ymzk.org]
	    
	    # postmap hash:/etc/postfix/relay
	    
	
	# postfix reload
	

@foo.ymzk.org  mail.foo.ymzk.org 
(qmail)

cushion# tail -f /var/log/maillog &
cushion# echo 'This is test.' | Mail -s relaytest testuser@foo.ymzk.org
Feb  5 21:23:04 cushion qmail: 981375784.342141 info msg 7253: bytes 253 from  qp 2556 uid 0
Feb  5 21:23:04 cushion qmail: 981375784.344272 starting delivery 5: msg 7253 to remote testuser@foo.ymzk.org
Feb  5 21:23:04 cushion qmail: 981375784.364771 status: local 0/10 remote 1/20
Feb  5 21:23:05 cushion qmail: 981375785.375679 delivery 5: success: 10.0.250.25_accepted_message./Remote_host_said:_250_ok_981384392_qp_374/


@foo.ymzk.org DNS MX


	;;(BIND) [foo.zone]
	foo.ymzk.org.	IN	MX	0  cushion.foo.ymzk.org.
			IN	MX	10 mail.foo.ymzk.org.
	------------------------------------------
	# (djbdns)
	@foo.ymzk.org::cushion.foo.ymzk.org.:0:10800
	@foo.ymzk.org::mail.foo.ymzk.org.:10:10800

MX

TTL

MX @foo.ymzk.org 



(4) MTA


MTA
Part2, part3


(5) popper

MTAPOP
IMAPsendmail
Maildir
MaildirPOP


(6) MTA


sendmailkill

(/etc/rc*)sendmail

sendmail
()


(7) 

Maildir
 /var/mail/*  ~/Maildir/



  1. /var/mail/* 

     
     NFS
      /var/mail/* 
     UID
     

  2. Maildir

     mboxMaildir
     http://www.qmail.org/mbox2maildir 
     CD-ROM
     mbox

      mbox2maildir  /usr/local/bin sudo 
     [] 
     root /bin/sh 
     /var/mail 

--[]------------------------------------------------------------
 UID
 http://www.courtesan.com/sudo/
  su OS
 susudo
--------------------------------------------------------------------

	# unset MAILDIR
	# for u in `cat /etc/passwd | awk -F: '{print $1}'`
        > do
	> if [ -f /var/mail/$u ]; then
	>   MAIL=/var/mail/$u sudo -u $u -H \
	>	sh -c 'MAILDIR=$HOME/Maildir' perl /usr/local/bin/mbox2maildir
	> fi
	> done

     mboxMaildir 
     
     Maildir
     Maildir
     

	# cd /home
	# for u in */
	> do
	> sudo -u $u /var/qmail/bin/maildirmake $u/Maildir
	> done

     qmail
      ./Maildir/ 

(8) 2

    
    MTA

[qmail]
	# csh -cf '/var/qmail/rc &'

[Postfix]
	# /usr/local/postfix/postfix start

    (
    )MTA
    []
    

--[]------------------------------------------------------------
 
 
 
--------------------------------------------------------------------

    
    

	A (foo.ymzk.org)
	B  mail.foo.ymzk.org 

    B

	B  newmta.foo.ymzk.org 
                                   ~~~~~~~
    

[qmail]
	1. qmail
	   # tail -f /var/log/maillog &		(Solaris/var/log/syslog)
	   # kill `qmail-sendPID'
	2. maillog
Feb  7 18:20:42 cushion qmail: 981537642.371423 status: exiting
           []
	3. 

	   /var/qmail/control/smtproutes 
	    foo.ymzk.org:mail.foo.ymzk.org
	   
	    foo.ymzk.org:newmta.foo.ymzk.org
	   
	4. qmail
	   # csh -cf '/var/qmail/rc &'
--[]------------------------------------------------------------
 
 
 
 
 /var/qmail/control/timeoutconnect 
--------------------------------------------------------------------

[Postfix]

	1. Postfix
	   # tail -f /var/log/maillog &
	   # /usr/local/postfix/postfix stop
	2. maillog
Feb  7 18:20:42 cushion postfix/master[24004]: terminating on signal 15
	   []
	3. 
	   main.cf transport_maps
	   /etc/postfix/relay 
	    foo.ymzk.org	smtp:[mail.foo.ymzk.org]
	   
	    foo.ymzk.org	smtp:[newmta.foo.ymzk.org]
	   
	    # /usr/local/postfix/postmap hash:/etc/postfix/relay
	   
	4. Postfix
	   # /usr/local/postfix/postfix start

--[]------------------------------------------------------------
 qmail
 
  main.cf 
 smtp_connect_timeout = 10s
 
--------------------------------------------------------------------

qmail, Postfix 4




(9) 

MX


	;;(BIND) [foo.zone]
	foo.ymzk.org.	   IN	MX	0  newmta.foo.ymzk.org.
			   IN	MX	10 cushion.foo.ymzk.org.
	------------------------------------------
	# (djbdns)
	@foo.ymzk.org::newmta.foo.ymzk.org.:0:10800
	@foo.ymzk.org::cushion.foo.ymzk.org.:10:10800





virtual domain


 Postfix, qmail 
virtual domain 

 virtual domain 
virtual domain 
MySQL
SQL
Postfix, qmail  virtual domain 


  virtual domain(qmail)
  
  qmail virtual domain 
  
  Postfix Postfix
  

  qmail /var/qmail/control/virtualdomains 

	DomainName:MailPrefix

  anyname@DomainName 
   MailPrefix-anyname 
   ~MailPrefix/.qmail-anyname 
  []
  @old.foo.ymzk.org  qmail 
   virtual domain 
   oldfoo 
   /home/virtual/old.foo.ymzk.org 
--[]----------------------------------------------------------------------
  MailPrefix  user-suffix 
 ~user/.qmail-suffux-anyname 
------------------------------------------------------------------------------

	# useradd -d /home/virtual/old.foo.ymzk.org -m oldfoo

   virtual domain 
  
  CSV() 
  userlist 

	sh# OLD=/home/virtual/old.foo.ymzk.org
	sh# cd $OLD
	sh# for u in `awk -F, '{print $1}' userlist`
	> do
	> echo $OLD/maildir-$u/ > .qmail-$u
	> /var/qmail/bin/maildirmake maildir-$u
	> done

   x  ~/.forward 
   ~oldfoo/.qmail-x 
  ~/.forward 
  

  Postfix  qmail  virtual domain 

  qmail virtual domain 
   Postfix 

  virtual domain main.cf  virtual_maps 
  

	virtual_maps = regexp:/etc/postfix/virtualdomains

   /etc/postfix/virtualdomains 

	/^old\.foo\.ymzk\.org$/		hoge
	/^(.*)@old\.foo\.ymzk\.org$/	oldfoo+$1

  [] qmail 
  anyname@old.foo.ymzk.org  
   oldfoo+anyname 
  ~oldfoo/.forward+anyname 
  
--[]------------------------------------------------------------------
  
--------------------------------------------------------------------------

   ~oldfoo/maildir- 
   WU-IMAPD  virtual domain 
  POP



MTA
MUAPOP/IMAP
 /var/mail/USER 

Maildir




Part2MailMH
MUA Maildir 
 Mew  Wanderlust 
 up-to-date MUA
 /var/mail/USER 


 vacation vacation



Postfixsendmail
qmailMaildir "UNIX From" 
vacation
Maildir vacation ~/.qmail 


	./Maildir/
	| (echo $SENDER `date`; cat) | /usr/bin/vacation user





MaildirPOP

Maildirqmail, Postfix
virtual domain
WU-IMAPD(imap-2000)[]
200012qmail
 Postfix 
Postfix

--[]------------------------------------------------------------
 http://www.gentei.org/~yuuji/software/imapext/
--------------------------------------------------------------------

POP


  imap-2000 + 

  CDROM imap-2000a-qmav20010128.tar.gz WU-IMAPD 2000 
  

	* Maildir 
	* ~/.qmail-* 
	  (Postfix ~/.forward+*)
	* virtualdomain 
	* APOP
	* UNIX
	* POP3
	* POP before SMTP 

  POP/IMAP

	1. 
	2. inetd.conf 
	3. POP before SMTP 

  

  1. 

     WU-IMAPmake
     READMEMakefile
     

     # tar imap-2000a-qmav20010128.tar.gz
     # less README Makefile

     make[]
     

--[]-----------------------------------------
	FreeBSD		bsf
	BSD/i386	bsi
	OpenBSD		bso
	GCC Solaris	gso
	Linux		lnx, sl4, sl5, slx
	NetBSD		neb
-------------------------------------------------

     MTAqmail
     Postfix Makefile 
     EXTRACFLAGS  -DPOSTFIX 

	EXTRACFLAGS=-DQMAIL -DRESTRICT_POP
		
	EXTRACFLAGS=-DQMAIL -DRESTRICT_POP -DPOSTFIX

     (Maildir)
      ~/.qmail-*  ~/.forward+* 
     POP
     WU-IMAPD[]

--[]-----------------------------------------
    					
POP		ON
		~/.apop
		/usr/local/sbin/deapop
POP before SMTP			/usr/local/etc/pop3-record
-------------------------------------------------
      README.qmailapop 
      Makefile make FreeBSD 
     

     # make bsf

      ipopd/ipop3d POP
     

     # install -cs ipopd/ipop3d /usr/local/etc

      /usr/local/etc 
     POP before SMTP 
     

     # cd APOPtools
     # install -c -m 700 deapop /usr/local/sbin
     # install -c -m 755 apoppasswd /usr/local/bin
     # install -c -m 700 pop3-record /usr/local/etc	(qmail)
     # install -c -m 700 pop3-record.postfix /usr/local/etc/pop3-record
							(Postfix)
     # ln -s pop3-age /usr/local/etc/pop3-update
     # ln -s pop3-age /usr/local/etc/pop3-record

  2. inetd.conf 

     POP 
     /etc/inetd.conf inetd
     tcp_wrappers(libwrap)

pop3	stream	tcp  nowait root  /usr/local/etc/ipop3d  ipop3d

     tcp_wrappers
     tcpd

pop3	stream	tcp  nowait root  /usr/sbin/tcpd /usr/local/etc/ipop3d

     inetdHUP

----------------------------------------------------------------------------
 APOP

WU-IMAPD POP3
POP3



POPUNIX
POP3



APOP(MD5
)


()
POP3MUAAPOP
Windows Outlook Express(ver??
)(OE) Netscape Messanger(NM) APOP
APOP 
UNIXDelegate


DelegateWindows
ftp://ftp.etl.go.jp/pub/DeleGate/?????/
CD-ROM
 Windows??? 
"c:\Program Files\Delegate\dg7_0_1.exe" 

 .reg 

[:dgstart.reg]
REGEDIT4

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\run]
"Delegate"="\"C:\\Program Files\\Delegate\\dg7_0_1.exe\" -P110 SERVER=pop ADMIN=youremail@address.on.that.machine"


DelegatePOPAPOP

OENM

	[POP]
	:	user
	POP3:	pop.yourprovider.ne.jp



	[POP]
	:	user@pop.yourprovider.ne.jp
	POP3:	localhost

Delegate
APOP
MUAPOP3
----------------------------------------------------------------------------

  3. POP before SMTP 

     Part2, Part3SMTP
     LAN 
     
     
     
     

     POPSMTP
     POP
     IPSMTP POP
     before SMTP SMTP-AUTH 
     SMTP
     MUA
     MTAPOP before
     SMTP 
     

     POP before SMTP qmail, Postfix 
     
     WU-IMAPD ipop3d 
      /usr/local/etc/pop3-record 

[qmail]
     pop3-record /etc/host.allow.src POP
     IP /etc/hosts.allow 
     []

--[]-----------------------------------------------------------------
     [POP] x.y.z.w
	                         /etc/hosts.allow.src
     [POP]                              
       RELAYCLIENT=x.y.z.w   pop3-record
                                              
                                       /etc/hosts.allow
				(tcp-env : x.y.z.w : setenv = RELAYCLIENT
				  )
--------------------------------------------------------------------------

      hosts.allow.src  hosts.allow 
     

	# cd /etc
	# cp hosts.allow hosts.allow.src

      hosts.allow.src 
      hosts.allow  /usr/local/etc/pop3-update
     

     ipop3dIP
     RELAYCLIENThosts.allow.src 

	ipop3d: ALL : setenv RELAYCLIENT %h

      /etc/hosts.allow 

	# /usr/local/etc/pop3-update

     POP3/APOPSMTP
     
     RELAYCLIENT pop3-age 
     cron10

	# crontab -e
	()
	0,10,20,30,40,50  *  *  *  *   root /usr/local/etc/pop3-age
	()
	*/10    *  *  *  *   root /usr/local/etc/pop3-age

[Postfix]

     PostfixSMTP
     smtpd_client_restrictions 
     ()
      check_client_access main.cf 
     

	smtpd_recipient_restrictions = 
        	permit_mynetworks
        	check_relay_domains
        	check_client_access hash:/etc/postfix/client_access

     permit_mynetworks  check_relay_domains 
     smtpd_recipient_restrictions 
     
     check_client_access 
     
     /etc/postfix/client_access hash
     
     WU-IMAPD  pop3-record.postfix 
     Postfix  
     /usr/libexec/postfix 
     

	POSTFIXBIN=/usr/libexec/postfix

     

     ipop3dIP
     RELAYCLIENThosts.allow 

	ipop3d: ALL : setenv RELAYCLIENT %h

      ipop3d IP
     pop3-record pop3-record
     hash:/etc/postfix/clientaccess.db []

--[]-----------------------------------------------------------------
     [POP] x.y.z.w
	
     [POP]
       RELAYCLIENT=x.y.z.w
        
    +---- pop3-record(Postfix) ----------+
    | 1. /etc/postfix/client_access      |
    |		x.y.z.w	OK                 |
    |	                             |
    | 2. postmap                 |
    |    /etc/postfix/client_access.db     |
    |                                |
    +--------------------------------------+
--------------------------------------------------------------------------

     qmailcron
     

	# crontab -e
	()
	0,10,20,30,40,50  *  *  *  *   root /usr/local/etc/pop3-age

     pop3-age  Postfix  pop3-record 
    


  POP

    WU-IMAPDUNIX
    
     APOPtools/apoppasswd 
    
    

	user% apoppasswd
	      ~~~~~~~~~~
	Enter APOP passwd: **********
	Again APOP passwd: **********

    CUI
    CGI
     APOPtools/apopcall.c 
    
    

	1. SSLapache(apache+mod_sslssl-apache)
	2. apopcall.c 
	3. apopcall(make install-cgi)
	4. apopcallCGI(in httpd.conf)

    []
    

---[]--------------
  (apopcall.png)
-----------------------

    CGI virtualdomain 
    
     README.qmailapop WU-IMAPD
    Web


yuuji@gentei.org
Fingerprint16 = FF F9 FF CC E0 FE 5C F7 19 97 28 24 EC 5D 39 BA
HIROSE Yuuji - ASTROLOGY / BIKE / EPO / GUEST BOOK / YaTeX [Tweet]