臨界に突入するメールを止める. 1999/10/29 Kyoma TAKAHASHI 具体的には,blue に来たメールの内, To: postmaster あるいは To: blue が合計2行以上ある メールを撃墜する. 止めるべきメールを受け取った場合, /home/blue/bin/stopwblue.pl は, /var/log/syslog に一行書き込み, /home/blue/stopped-mail に止めたメールを残して 終了コード 99 で終了する. ローカル配送を行う qmail-local は,終了コード 99 を, 「配送は成功したが、 qmail-localは以降の配送命令を無視せよ」 という意味に取るので,/home/blue/.qmail の2行目以降の 配送指示は実行されなくなる. 参考:http://www.jp.qmail.org/q103/jman8/qmail-command.html /home/blue/.qmail: | /home/blue/bin/stopwblue.pl &blue-member /home/blue/bin/stopwblue.pl: #!/usr/bin/perl # stopwblue.pl # Kyoma TAKAHASHI 1999/10/29 # Thanks for Okuyama's help $cnt = 0; $mailhb = ''; while () { if (/^To:\s+blue.+/) { $cnt += 1 } if (/^To:\s+postmaster.+/) { $cnt += 1 } $mailhb .= $_; } if ( $cnt < 2 ) { print $mailhb; exit 0; } else { $from = $ENV{'SENDER'}; $to = $ENV{'RECIPIENT'}; $ermsg = 'Message from '.$from.' to '.$to.' is going to start chain reaction!! Stopped it.'; system "/usr/bin/logger -t stopwblue.pl '$ermsg'"; open (STOPMAIL,">> /home/blue/stopped-mail"); print STOPMAIL $mailhb; close (STOPMAIL); exit 99; }