ssk’s posterous

ssk’s posterous

Jul 24 / 2:20am

メルマガのエラーアドレスやバウンスメールを自動的に処理する方法(PostFix) - igreks開発日記

by ssk
エンベロープMailFromに
"バウンスを受けたい架空のアカウント"+"送信先のアカウント"="送信先ドメイン"@"自ドメイン"の形で指定できればOK。


次に、/etc/postfix/main.cf に以下を追記

recipient_delimiter = +
propagate_unmatched_extensions = canonical, virtual

※1行目は、送られてくるバウンスメールの宛先アドレスは、「+」で区切りますよ、とpostfixに教えている。
※2行目は、デリミタ以降(extensions)は、エイリアスに展開する際、無視しますよということをpostfixに教えている。
※これらの変数や定義値は、postfixのデフォルトなので、変更していればそれに合わせてください。


次に、バウンスメール処理用のプログラムをperlで作成。(ここでは/home/owner/に設置)

やっぱり外部プログラム作らないといかんのね。

Filed under  //  postfix  

Comments (0)

Jul 6 / 2:15am

Postfix ボトルネック分析

by ssk
deferred キューが 大きくなる原因は、SMTP 入力の場面で受信者の確認の失敗がよくあります。 スパマーは日常的に応答できないアドレスから辞書攻撃を仕掛けるため、 無効な受信者アドレスへのバウンスが deferred キューを 詰まらせてしまいます (そしてその容量が大きくなるにつれて active キューも詰まらせて しまいます)。 local_recipient_mapsrelay_recipient_maps パラメータを使って、受信者の有効性を確認することを強く推奨します。

これが原因な気がしてきた。

Filed under  //  postfix  

Comments (0)

Jul 6 / 12:39am

using regex in postfix's alias

by ssk
aliases に正規表現を使う場合。
 
> $ cat /etc/postfix/aliases.regex
> /^foo_[0-9a-z]{4}/ bar
 
foo_なんたら4桁にメールを出すと bar に転送される
 
main.cf は次のような感じ。
 
> $ sudo postconf |grep alias_maps
> alias_maps = hash:/etc/mail/aliases, hash:/var/lib/mailman/data/aliases, regexp:/etc/postfix/aliases.regex
Filed under  //  postfix  

Comments (0)

Jun 3 / 12:01am

Postfix VERP Howto

by ssk

例えば、VERP 形式の配送が要求されると、Postfix は "owner-listname@origin" から受信者 "user@domain" 宛のメールを、次のように受信者アドレスをエンコードした送信者アドレスをつけて配送します:

owner-listname+user=domain@origin

こうすることで、リストのオーナーがバウンスメッセージを分析しなくても、配送できないメールの受信者アドレスがわかります。

実際にやってみないとよくわからん。

Filed under  //  postfix  

Comments (0)

Apr 21 / 12:12am

Installation PostfixAdmin to Debian Lenny Part.3

by ssk

php5-mysql install.

ssk@debonvm01 src $ sudo aptitude install php5-mysql
ssk@debonvm01 src $ sudo /usr/sbin/apache2ctl configtest
Syntax OK
ssk@debonvm01 src $ sudo /usr/sbin/apache2ctl graceful

run
http://devonvm01/postfixadmin/setup.php
and create superadmin account.
 
and move setup.php

ssk@debonvm01 src $ sudo mv /usr/share/postfixadmin/setup.php ~/.setup.php
Filed under  //  debian   postfix  

Comments (0)

Apr 20 / 11:49pm

Installation PostfixAdmin to Debian Lenny Part.2

by ssk

ssk@debonvm01 src $ cat /etc/apache2/sites-available/default

    ServerAdmin webmaster@localhost
 
    DocumentRoot /var/www/
    
        Options FollowSymLinks
        AllowOverride None
    
    
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    
 
  ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
 
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    
 
  ErrorLog /var/log/apache2/error.log
 
  # Possible values include: debug, info, notice, warn, error, crit,
  # alert, emerg.
  LogLevel warn
 
  CustomLog /var/log/apache2/access.log combined
 
  Alias /doc/ "/usr/share/doc/"
 
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
  
 
  Alias /postfixadmin/ "/usr/share/postfixadmin/"
 

 
ssk@debonvm01 src $ sudo /usr/sbin/apache2ctl configtest
Syntax OK
ssk@debonvm01 src $ sudo /usr/sbin/apache2ctl graceful
 
 
ssk@debonvm01 src $ mysql -uroot -h localhost
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 44
Server version: 5.0.51a-24-log (Debian)
 
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
 
mysql> create database postfixadmin;
Query OK, 1 row affected (0.16 sec)
 
mysql> grant all on postfixadmin.* to postfixadmin@'localhost'
identified by 'foobar';
Query OK, 0 rows affected (1.51 sec)
 
mysql>
 
ssk@debonvm01 src $ diff -u /etc/postfixadmin/config.inc.php.org
/etc/postfixadmin/config.inc.php
--- /etc/postfixadmin/config.inc.php.org 2009-04-19
05:24:51.000000000 +0900
+++ /etc/postfixadmin/config.inc.php 2009-04-21 15:48:33.000000000 +0900
@@ -29,7 +29,7 @@
 * Doing this implies you have changed this file as required.
 * i.e. configuring database etc; specifying setup.php password etc.
 */
-$CONF['configured'] = false;
+$CONF['configured'] = true;
 
 // In order to setup Postfixadmin, you MUST specify a hashed password here.
 // To create the hash, visit setup.php in a browser and type a password
into the field,
@@ -39,14 +39,14 @@
 // Postfix Admin Path
 // Set the location of your Postfix Admin installation here.
 // YOU MUST ENTER THE COMPLETE URL e.g. http://domain.tld/postfixadmin
-$CONF['postfix_admin_url'] = '';
+$CONF['postfix_admin_url'] = 'http://devonvm01/postfixadmin';
 
 // shouldn't need changing.
 $CONF['postfix_admin_path'] = '/usr/share/postfixadmin';
 
 // Language config
 // Language files are located in './languages', change as required..
-$CONF['default_language'] = 'en';
+$CONF['default_language'] = 'ja';
 
 // Database Config
 // mysql = MySQL 3.23 and 4.0, 4.1 or 5
@@ -54,9 +54,9 @@
 // pgsql = PostgreSQL
 $CONF['database_type'] = 'mysql';
 $CONF['database_host'] = 'localhost';
-$CONF['database_user'] = 'postfix';
-$CONF['database_password'] = 'postfixadmin';
-$CONF['database_name'] = 'postfix';
+$CONF['database_user'] = 'postfixadmin';
+$CONF['database_password'] = 'foobar';
+$CONF['database_name'] = 'postfixadmin';
 $CONF['database_prefix'] = '';
 
 // Here, if you need, you can customize table names.
@@ -79,7 +79,7 @@
 // Site Admin
 // Define the Site Admins email address below.
 // This will be used to send emails from to create mailboxes.
-$CONF['admin_email'] = 'postmaster@change-this-to-your.domain.tld';
+$CONF['admin_email'] = 'admin@devonvm01';
 
 // Mail Server
 // Hostname (FQDN) of your mail server.
@@ -129,10 +129,10 @@
 // Default Aliases
 // The default aliases that need to be created for all domains.
 $CONF['default_aliases'] = array (
- 'abuse' => 'abuse@change-this-to-your.domain.tld',
- 'hostmaster' => 'hostmaster@change-this-to-your.domain.tld',
- 'postmaster' => 'postmaster@change-this-to-your.domain.tld',
- 'webmaster' => 'webmaster@change-this-to-your.domain.tld'
+ 'abuse' => 'abuse@devonvm01',
+ 'hostmaster' => 'hostmaster@devonvm01',
+ 'postmaster' => 'postmaster@devonvm01',
+ 'webmaster' => 'webmaster@devonvm01'
 );
 
 // Mailboxes
@@ -182,7 +182,7 @@
 // This is the autoreply domain that you will need to set in your Postfix
 // transport maps to handle virtual vacations. It does not need to be a
 // real domain (i.e. you don't need to setup DNS for it).
-$CONF['vacation_domain'] = 'autoreply.change-this-to-your.domain.tld';
+$CONF['vacation_domain'] = 'autoreply.devonvm01';
 
 // Vacation Control
 // If you want users to take control of vacation set this to 'YES'.
@@ -247,14 +247,14 @@
 $CONF['header_text'] = ':: Postfix Admin ::';
 
 // link to display under 'Main' menu when logged in as a user.
-$CONF['user_footer_link'] = "http://change-this-to-your.domain.tld/main";
+$CONF['user_footer_link'] = "http://devonvm01/postfixadmin/main";
 
 // Footer
 // Below information will be on all pages.
 // If you don't want the footer information to appear set this to 'NO'.
 $CONF['show_footer_text'] = 'YES';
-$CONF['footer_text'] = 'Return to change-this-to-your.domain.tld';
-$CONF['footer_link'] = 'http://change-this-to-your.domain.tld';
+$CONF['footer_text'] = 'Return to devonvm01';
+$CONF['footer_link'] = 'http://devonvm01/postfixadmin';
 
 // Welcome Message
 // This message is send to every newly created mailbox.

Filed under  //  debian   postfix  

Comments (0)

Apr 20 / 11:23pm

Installation PostfixAdmin to Debian Lenny

by ssk

from history.

 525 wget
http://jaist.dl.sourceforge.net/sourceforge/postfixadmin/postfixadmin_2.3rc4_all.deb
 526 sudo dpkg -i postfixadmin_2.3rc4_all.deb
 527 sudo aptitude install libapache2-mod-php5
Filed under  //  debian   postfix  

Comments (0)