*** main.cf.original Sun Mar 4 14:12:53 2007 [#s90cd2c8] --- main.cf Sun Mar 4 23:12:23 2007 *************** [#wa6a4b2f] *** 35,41 **** [#g0a72112] # See the files in examples/chroot-setup for setting up Postfix chroot # environments on different UNIX systems. # - queue_directory = /var/spool/postfix # The command_directory parameter specifies the location of all # postXXX commands. --- 35,40 ---- *************** [#y6beb3be] *** 57,63 **** [#s6e6f00d] # particular, don't specify nobody or daemon. PLEASE USE A DEDICATED # USER. # - mail_owner = postfix # The default_privs parameter specifies the default rights used by # the local delivery agent for delivery to external file or command. --- 56,61 ---- *************** [#oe5c2bd1] *** 81,87 **** [#s3c536fe] # $mydomain is used as a default value for many other configuration # parameters. # ! #mydomain = domain.tld # SENDING MAIL # --- 79,85 ---- # $mydomain is used as a default value for many other configuration # parameters. # ! mydomain = hondou.homedns.org # SENDING MAIL # *************** [#od5cf211] *** 97,103 **** [#vd3622eb] # to recipient addresses that have no @domain part. # #myorigin = $myhostname ! #myorigin = $mydomain # RECEIVING MAIL --- 95,101 ---- # to recipient addresses that have no @domain part. # #myorigin = $myhostname ! myorigin = $mydomain # RECEIVING MAIL *************** [#h5f317c6] *** 258,264 **** [#dfc71b7b] # of listing the patterns here. Specify type:table for table-based lookups # (the value on the table right-hand side is not used). # ! #mynetworks = 168.100.189.0/28, 127.0.0.0/8 #mynetworks = $config_directory/mynetworks #mynetworks = hash:/etc/postfix/network_table --- 256,262 ---- # of listing the patterns here. Specify type:table for table-based lookups # (the value on the table right-hand side is not used). # ! mynetworks = 192.168.1.0/24, 127.0.0.0/8 #mynetworks = $config_directory/mynetworks #mynetworks = hash:/etc/postfix/network_table *************** [#ibc1d51a] *** 290,296 **** [#j90e0ee0] # list this system as their primary or backup MX host. See the # permit_mx_backup restriction description in postconf(5). # ! #relay_domains = $mydestination # INTERNET OR INTRANET --- 288,294 ---- # list this system as their primary or backup MX host. See the # permit_mx_backup restriction description in postconf(5). # ! relay_domains = $mydestination # INTERNET OR INTRANET *************** [#a2557033] *** 413,419 **** [#t541c95c] # "Maildir/" for qmail-style delivery (the / is required). # #home_mailbox = Mailbox ! #home_mailbox = Maildir/ # The mail_spool_directory parameter specifies the directory where # UNIX-style mailboxes are kept. The default setting depends on the --- 411,417 ---- # "Maildir/" for qmail-style delivery (the / is required). # #home_mailbox = Mailbox ! home_mailbox = Maildir/ # The mail_spool_directory parameter specifies the directory where # UNIX-style mailboxes are kept. The default setting depends on the *************** [#t763a45c] *** 662,673 **** [#d2a0d354] masquerade_classes = envelope_sender, header_sender, header_recipient myhostname = grape.hondou.homedns.org program_directory = /usr/lib/postfix - inet_interfaces = 127.0.0.1 ::1 masquerade_domains = ! mydestination = $myhostname, localhost.$mydomain defer_transports = disable_dns_lookups = no ! relayhost = mailbox_command = mailbox_transport = strict_8bitmime = no --- 660,670 ---- masquerade_classes = envelope_sender, header_sender, header_recipient myhostname = grape.hondou.homedns.org program_directory = /usr/lib/postfix masquerade_domains = ! mydestination = $myhostname, localhost.$mydomain, $mydomain defer_transports = disable_dns_lookups = no ! relayhost = [vwxyz.biglobe.ne.jp] mailbox_command = mailbox_transport = strict_8bitmime = no *************** [#ca676f5d] *** 684,687 **** [#id6f4b2e] smtp_use_tls = no alias_maps = hash:/etc/aliases mailbox_size_limit = 0 ! message_size_limit = 10240000 --- 681,689 ---- smtp_use_tls = no alias_maps = hash:/etc/aliases mailbox_size_limit = 0 ! message_size_limit = 102400000 ! # add by hondou ! disable_vrfy_command = yes ! allow_percent_hack = yes ! allow_at_myorigin = yes
> sudo /etc/init.d/postfix restart
> sudo vi /etc/dovecot/dovecot.conf 196 # default_mail_env = maildir:/var/mail/%1u/%u/Maildir 197 # default_mail_env = mbox:~/mail/:INBOX=/var/mail/%u 198 # default_mail_env = mbox:/var/mail/%d/%n/:INDEX=/var/indexes/%d/%n 199 # 200 default_mail_env = maildir:~/Maildir :wq > sudo /etc/init.d/dovecot restart Stopping dovecot done Starting dovecot done
> mkdir Maildir > chmod 700 Maildir
> sudo mkdir /etc/skel/Maildir
#!/bin/sh for user in `ls /home/` do if [ -d /home/${user}/Maildir ] then echo /home/${user}/Mailder is already exist else mkdir /home/${user}/Maildir chmod 700 /home/${user}/Maildir chown ${user}:users /home/${user}/Maildir echo make /home/${user}/Mailder fi done
> tar -xvzf bsfilter-1.0.13.tgz > sudo cp bsfilter-1.0.13/bsfilter/bsfilter /usr/local/bin/
> vi ~/.bsfilter/bsfilter.conf 1 imap-server 127.0.0.1 2 imap-auth auto 3 imap-user kagyuu 4 imap-password ****************
> sudo vi /etc/cron.hourly/spamfilter #!/bin/sh export PATH="/bin:/usr/bin:/usr/local/bin" for user in `ls /home/` do home=/home/${user} conf=${home}/.bsfilter/bsfilter.conf clean=${home}/Maildir/.INBOX.Trash/cur spam=${home}/Maildir/.INBOX.SPAM/cur inbox=${home}/Maildir/cur if [ -e ${conf} ]; then export BSFILTERHOME="${home}/.bsfilter" bsfilter --add-clean ${clean}/*S rm ${clean}/*S bsfilter --add-spam ${spam}/*S rm ${spam}/*S bsfilter --update bsfilter --imap --insert-flag INBOX.SPAM INBOX for oldMail in `ls ${inbox}` do newMail=`echo $oldMail | awk '{ sub(/S/,""); print }'` mv ${inbox}/${oldMail} ${inbox}/${newMail} done fi done > sudo chmod +x /etc/cron.hourly/spamfilter
(Biglobe WAN) (the Internet) [HOME]¡½¡½¡½¡½¡½¡½¡½¢ª[Router]¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦[MailServer] ¡MailServer ¢¬ ¤Î25È֥ݡ¼¥È ¢25È֥ݡ¼¥È¥Ö¥í¥Ã¥¯ ¤ËÁ÷¿®
(Biglobe WAN) (the Internet) [HOME]¡½¡½¡½¡½¡½¡½¡½¢ª[Ãæ·ÑSV]¡½¡½¡½¡½¡½¡½¡½¢ª[MailServer] ¡Ãæ·ÑSV ¢HOME¤ÎÂå¤ï¤ê¤Ë £Ãæ·ÑSV¤«¤é¥á¡¼¥ë ¤Î25È֥ݡ¼¥È MailServer¤Ë ¤¬ÆϤ¯ ¤ËÃæ·Ñ¤ò°ÍÍê Á÷¿®
670 #relayhost = 671 mailbox_command = 672 mailbox_transport = 673 strict_8bitmime = no 674 disable_mime_output_conversion = no 675 smtpd_sender_restrictions = hash:/etc/postfix/access 676 smtpd_client_restrictions = 677 smtpd_helo_required = no 678 smtpd_helo_restrictions = 679 strict_rfc821_envelopes = no 680 smtpd_recipient_restrictions = permit_mynetworks,reject_unauth_destination 681 smtp_sasl_auth_enable = no 682 smtpd_sasl_auth_enable = no 683 smtpd_use_tls = no 684 smtp_use_tls = no 685 alias_maps = hash:/etc/aliases 686 mailbox_size_limit = 0 687 message_size_limit = 102400000 688 # add by hondou 689 disable_vrfy_command = yes 690 allow_percent_hack = yes 691 allow_at_myorigin = yes ¡ú 692 relayhost = [??????.biglobe.ne.jp]
310 #relayhost = $mydomain 311 #relayhost = [gateway.my.domain] 312 #relayhost = [mailserver.isp.tld] 313 #relayhost = uucphost 314 #relayhost = [an.ip.add.ress] 315 relayhost = [??????.biglobe.ne.jp]
> telnet msagw.biglobe.ne.jp 25 Trying 133.205.103.17... Connected to msagw.biglobe.ne.jp. Escape character is '^]'. 220 msagw.biglobe.ne.jp SMTP-Gateway Version 2.05 at Sat, 26 May 2007 22:19:20 +0900 (JST) EHLO localhost 250-msagw.biglobe.ne.jp Hello msagw.biglobe.ne.jp [220.144.158.45], pleased to meet you 250-AUTH CRAM-MD5 LOGIN PLAIN 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-8BITMIME 250-SIZE 104857600 250-DSN 250-DELIVERBY 250 HELP quit 221 2.0.0 msagw.biglobe.ne.jp closing connection Connection closed by foreign host. >ǧ¾Ú¤Î¤ä¤êÊý¤Ï¡¢CRAM-MD5 LOGIN PLAIN ¤Î¤è¤¦¤À
# diff /etc/postfix/main.cf.old /etc/postfix/main.cf --- /etc/postfix/main.cf.old 2007-05-26 14:12:53.000000000 +0900 +++ /etc/postfix/main.cf 2007-05-26 17:45:53.000000000 +0900 -relayhost = [vwxyz.biglobe.ne.jp] +#relayhost = [vwxyz.biglobe.ne.jp] +relayhost = [msagw.biglobe.ne.jp] +smtp_sasl_type = cyrus +smtp_sasl_auth_enable = yes +smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd +smtp_sasl_security_options = noanonymous +smtp_sasl_mechanism_filter = cram_md5,plain,loginmain.cf¤ÎËöÈø¤Ë¡¢smtp_sasl ¤ÎÀßÄê¤ò½ñ¤¹þ¤ß¤Þ¤¹¡£
# vi /etc/postfix/sasl_passwd # sasl_passwd # Syntax: # domain username:password # Example: # foo.com username:password # See /usr/share/doc/packages/postfix/README_FILES/SASL_README # for more details msagw.biglobe.ne.jp ${biglobe¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹}:${¥Ñ¥¹¥ï¡¼¥É} :wq # postmap /etc/postfix/sasl_passwd¥á¡¼¥ë¥¢¥É¥ì¥¹¤È¥Ñ¥¹¥ï¡¼¥É¤Ï¡¢Âçʸ»ú¡¦¾®Ê¸»ú¤Î¶èÊ̤¬¤¢¤ë
# /etc/init.d/postfix reload
smtpd_client_restrictions = permit_mynetworks,reject_unknown_client,permit
#amazon(4881663070,left,simage)
#amazon(,clear)