PROCMAIL(1) PROCMAIL(1)
名前
procmail - 自律型メールプロセッサ
書式
procmail [-ptoY] [-f fromwhom]
[parameter=value | rcfile] ...
procmail [-toY] [-f fromwhom] [-a 引数] ...
-d 受取人 ...
procmail [-ptY] -m [パラメータ=値] ... rcfile
[引数] ...
procmail -v
説明
取り敢えずすぐ始めたい場合は、後の その他を参照されたい。
procmail は、メールの到着後 .forward ファイルの仕組みを通じてただちに自
動起動されるだろう。あるいは、システム管理者がインストールした場合は 、
メ ーラ内部から直接起動されることもある。【訳注: 原文は mailer と書かれ
ているが、ここでは MUA ではなく MTA を指しているものと推測する。】
procmail は起動すると、まずいくつかの環境変数をデフォルト値に設定する。
それから EOF【訳注: End Of File: ファイルの終端】に行き当たるまで、標準
入力からメールメッセージを読み込み、ヘッダーと本文を分離する。その後 、
コマンドラインに引数が指定されていなければ、 $HOME/.procmailrc という名
前のファイルを探し始める。
このファイル内の処理レシピに従って、到着したメールメッセージは適切な フ
ォルダ (及びその他) に配送される。もし rcfile が見つからないか、 rcfile
の処理が終わったら、 procmail はメールをシステムのデフォルトのメール ボ
ックスに保存する。
rcfile が存在せず、さらにコマンドラインに -p も指定されていない場合、
/etc/procmailrc ファイルが存在すれば、procmail は $HOME/.procmailrc を
読み込む前に、このファイルに書かれているコマンドを解釈する。 /etc/proc-
mailrc を作成するときは十分に注意を払わなければならない。なぜなら、状況
に よっては、このファイルの解釈は root 権限で実行される場合がありえるか
らである (もちろん $HOME/.procmailrc の場合はそのようなことはない)
procmail は、 suid root されているか、或は root 権限で動作している場 合
、 機能拡張され、下位互換性のあるメール配送エージェントとして動作できる
ようになる。
また、procmail は汎用のメールフィルタとしても使える。つまり、【訳注: 元
々 は一般的な目的のメールフィルタだったが、】特別な sendmail のルールを
使用して procmail を実行できるようにする仕組みが設けられたのである。
rcfile のフォーマットは procmailrc(5) マニュアルページで詳細に解説さ れ
ている。
「 重 み 付 けを伴う得点加算方法 (weighted scoring technique)」は proc-
mailsc(5) マニュアルページで詳細に解説されている。
rcfile のレシピの例は procmailex(5) マニュアルページを参照されたい。
シグナル
TERMINATE 直ちに終了し、メールをキューに戻す。
HANGUP 直ちに終了し、メールを送信元へ送り返す。
INTERRUPT 直ちに終了し、メールを送信元へ送り返す。
QUIT 直ちに終了し、ユーザには何も通知せずにメールを消去する。
ALARM 強制的に時間切れで終了させる ( TIMEOUT を参照されたい)。
USR1 VERBOSE=off と同じ意味。
USR2 VERBOSE=on と同じ意味。
オプション
-v バージョン番号とコンパイル時の環境設定を表示して終了する。
-p 古い環境をすべて保存する。 procmail は通常、起動時に TZ を除くすべ
て の環境変数の値を消去する。但し、どのような場合においても: proc-
mail が内包するあらゆるデフォルト値は同一名の既存の環境変数より 優
先される。すなわち、 procmail は既に定義されている同名の環境変数に
は全くお構いなく、 procmail のデフォルト値にてそれらを適切に上書き
す る 。 procmail で予め設定されている環境変数の一覧については、
procmailrc(5) を参照のこと。 -p と -m が両方指定されている場合は、
予 め 設 定 す る 環 境変数は LOGNAME、HOME、SHELL、ORGMAIL および
MAILDIR だけに限定される。【訳注: procmail の通常動作は、 TZ 以 外
の親プロセスの環境変数を全削除すると共に、自身の動作にかかわる環境
変数を多数「上書き」設定する。 -p オプションが指定されると、 proc-
mail は自身の動作にかかわる5つの環境変数のみを設定し、それ以外の親
プロセスにて設定されている環境変数を削除しない。結果として親プロセ
スの環境が保持される。】
-t procmail をフェールソフトにする。つまり、ユーザが指定したどの配送
先にも procmail がメールを配送できない場合、メールはバウンス 【 訳
注: 配送エラーメールとしてローカルメールスプールへ送られる。】せず
、メールキューに戻る。その後しばらくしてから再度配送を試みる。
-f fromwhom
fromwhom を送信者(sender)にして、先頭の ‘From ’ 行を再作成する (-f
の 代 わ り に 、 今 では使われなくなっているが -r が使用できる)。
fromwhom が ‘-’ 1個だけの場合、procmail は ‘From ’ 行のタイムス タ
ンプの更新のみ行う (これはタイムスタンプが存在する場合である。なけ
れば新たに作成する)。
-o 誰にも ‘From ’ 行の生成を許可させないで、単に偽物を上書きする。
-Y 従来の Berkeley mailbox フォーマットを想定し、 Content-Length: フ
ィールドはすべて無視する。
-a 引数
こ のオプションは、 $1 にコマンドライン引数を設定する。後続する -a
引数はそれぞれ次の番号の変数 ($2、$3、他) に設定される。このオプシ
ョ ンで procmail にメタ情報を渡すことができる。通常、sendmail メー
ラルールから $@x 情報を渡すことに用いられる。
-d recipient ...
これは明示的な配送モードを有効にする。配送はローカルユーザ recipi-
ent へ行われる。もちろん、これは procmail が root 権限を備える場合
(或は procmail が受取人の euid 及び egid で動作している場合) に の
み可能である。 procmail は指定された受取人に setuid され、受取人に
より引数のない状態で起動されたかのようにメールを配送する。 (すなわ
ち 、 rcfile が見つからない場合、配送は通常のメールのように行われ
る)。このオプションは -p とは互換性がない。
-m procmail を汎用のメールフィルタにする。このモードでは rcfile を コ
マンドラインで一つ指定しなければならない。 rcfile に後続する引数に
制限はない。 rcfile が後方参照のない /etc/procmailrcs/ で始まる 絶
対パスである (すなわち、親ディレクトリが指定できない) 場合、セキュ
リティの侵害がない場合のみ procmailは rcfile (またはシンボリックリ
ンク) の所有者のユーザ属性になる。
このオプションのより詳細な使用法は下記の 例を参照されたい。
引 数に ‘=’ が入っている場合は、すべて環境変数への値の割り当てと見
なす。この割り当ては、全てデフォルト値が割り当てられてから評価され
、その後に最初の rcfile がオープンされる。
そ の他の引数はすべて rcfile のパスと見なされる。 (このパスは絶対パスか
、または ‘./’ で始まっていれば現在のディレクトリからの相対パスのいず れ
か で ある。 その他のすべての相対パスは、 -m オプションを使用しない限り
$HOME からの相対パスである。 -m オプションを使用した場合、すべての相 対
パ スは現在のディレクトリからの相対パスとなる。) そして procmail は、コ
マンドラインで最初に見つかった rcfile を使用して起動する。先行する引 数
に 指 定 さ れ ている rcfile に合致する HOST 指示【訳注: matching HOST-
directive entry】 を有しない場合、または引数が存在しない場合にのみ、 コ
マンドライン上にて次に指定されている rcfile が一つだけ解析される。
rcfile を何も指定しない場合は $HOME/.procmailrc を検索する。 rcfile が
見つからなくても、環境変数のデフォルト設定とコマンドラインで指定され た
値に従って処理を続行する。
例
rcfile のレシピの例は procmailex(5) のマニュアルページを参照されたい。
rcfile のちょっとしたサンプルは、後述する その他にを参照のこと。
sendmail.cf の文法を多少なりとも知っているシステム管理者以外は、これ 以
降の「例」は読み飛ばして頂きたい。
-m オプションは、sendmail.cf ファイルのルールから procmail を呼び出す際
に使われるのが一般的である。このようにするには、自分の sendmail.cf ファ
イ ルに、 (procmail を立ち上げる ‘local’ メーラはおそらく既に存在するだ
ろうが、それに加えて) ‘procmail’ メーラを別途追加すると都合が良い。 こ
のような ‘procmail’ メーラを作成するには、次のようにすればいいだろう:
Mprocmail, P=/usr/bin/procmail, F=mSDFMhun, S=11, R=21,
A=procmail -m $h $g $u
こうすれば、 (大抵の場合 ruleset 0 にある) 以下のようなルールを使用して
、メールを procmail メーラを通じてフィルタできる。 (ただし、ルールを 継
続 して記述するために行頭にタブがあることと、コメントを分離するためにタ
ブがあることに注意。)
R$*<@some.where>$*
$#procmail $@/etc/procmailrcs/some.rc $:$1@some.where.procmail$2
R$*<@$*.procmail>$*
$1<@$2>$3 Already filtered, map back
そして /etc/procmailrcs/some.rc は次のように簡単になる:
SENDER = "<$1>" # 空の送信者アドレスを修正
SHIFT = 1 # $@ から除去
:0 # 全てのゴミメールを放り込む
* ^Subject:.*junk
/dev/null
:0 w # それ以外の全てのメールを通過させる
! -oi -f "$SENDER" "$@"
/etc/procmailrcs/some.rc ファイルの中からメールを送信するときには特に注
意 されたい。最初のルールに合致するアドレスにメールを再度送信すると、メ
ールの無限ループを引き起こすことになる。
ファイル
/etc/passwd 受取人の LOGNAME, HOME, SHELL の各変数のデフォル
トを設定する。
/var/mail/$LOGNAME システムメールボックス; システムメールボックスと
それを格納するすぐ上のディレクトリが存在しなけれ
ば、両方とも procmail が起動する度毎に作成される
。
/etc/procmailrc 初期のグローバル rcfile
/etc/procmailrcs/ rcfile に特権を与えるパス
$HOME/.procmailrc デフォルトの rcfile
/var/mail/$LOGNAME.lock
システムメールボックスのlockfile (procmail が 自
動的に使用することはない。但し、変数 $DEFAULT が
/var/mail/$LOGNAME と等しく、且つ procmail が
$DEFAULT へ配送する場合を除く。)
/usr/sbin/sendmail デフォルトのメール転送ソフト
_????‘hostname‘ procmail が一時的に作成する、大きさが 0 バイトで
‘ファイル名が重複しない’ ファイル
関連項目
procmailrc(5), procmailsc(5), procmailex(5), sh(1), csh(1), mail(1),
mailx(1), binmail(1), uucp(1), aliases(5), sendmail(8), egrep(1),
grep(1), biff(1), comsat(8), lockfile(1), formail(1), cron(1)
診断【訳注:
Autoforwarding mailbox found (自動転送メールボックスが見つかった)
システムメールボックスに suid または sgid ビット
がセットされている場合、 procmail は当該メールボ
ックスへ配送してはいけないこと を 示 す べ く 、
EX_NOUSER で終了する。
Bad substitution of "x" ("x" の不正な置換)
有効な環境変数名が指定されていない。
Closing brace unexpected (閉じ括弧が検出されない)
開 き括弧に対応する閉じ括弧がない(ブロックがネス
トしている)。
Conflicting options (オプションが矛盾する)
有効な組み合わせになっていないオプションがある。
Conflicting x suppressed (矛盾する x は削除された)
フ ラグ x は当該レシピの他のフラグと併存できない
。
Couldn’t create "x" ("x" を作成できない)
システムメールボックスが見つからず、作成できない
。または作成されない。
Couldn’t create maildir part "x" (maildir "x" を作成できない)
maildir フォルダ "x" の作成に必要な1つまたは複数
のサブディレクトリがなく、また procmail はそのサ
ブディレクトリを作成できない。
Couldn’t create or rename temp file "x" (一時ファイル "x" の作成または
名前変更ができない)
デ ィレクトリフォルダ "x" への配送の仕組みにエラ
ーが発生した。
Couldn’t determine implicit lockfile from "x" ("x" から暗黙の lockfile
が決定できない)
リダイレクタ ‘>>’ がないので、単純に ‘$LOCKEXT’
をローカルロックファイルのファイル名として使用す
る。
Couldn’t read "x" ("x" が読めない)
procmail が rcfile を開くことができなかったか 、
rcfile が通常のファイルでなかったか、或は proc-
mail が最大番号のファイル名のファイルを探そう と
しても MH ディレクトリを開くことができなかった。
Couldn’t unlock "x" ("x" のロックが解除できない)
ロックファイルが既に消滅しているか、またはロック
ファイルがあるディレクトリの書き込み権限がない。
Deadlock attempted on "x" ("x" のデッドロック未遂)
当該レシピで指定されているローカルロックファイル
は 、まだ有効に機能し続けている $LOCKFILE と同じ
である。
Denying special privileges for "x" ("x" への特別な権限を拒否)
セキュリティ侵害が見つかった (例: -p オプショ ン
またはコマンドラインの変数割り当て)か、 procmail
が不十分な権限しか持っていないので、 procmail は
rcfile に付随する識別情報【訳注: ユーザ ID 及び
グループ ID】にならない。【訳注: rcfile のユーザ
ID とグループ ID に setuid / setgid しない。 se-
tuid / setgid に関するセキュリティ上の問題に対応
するエラーメッセージ。】
Descriptor "x" was not open (ファイル記述子 "x" を開けられなかった)
procmail は 起 動したが、 stdin, stdout または
stderr と接続されなかった。 (おそらくセキュリ テ
ィが破壊されそうになったためであろう。)
Enforcing stricter permissions on "x" ("x" のパーミッションをより厳しく
する)
受取人のシステムメールボックスが安全でないことが
わかったので、安全性を向上させた。
Error while writing to "x" ("x" へ書き込みをする際にエラーが発生した)
サブディレクトリが存在しないか、書き込み許可がな
いか、パイプが壊れてしまったか、またはディスクが
一杯である。
Exceeded LINEBUF (LINEBUF 超過)
バッファオーバーフローが検出された。LINEBUF が小
さすぎる。 PROCMAIL_OVERFLOW が設定された。
MAILDIR is not an absolute path (MAILDIR が絶対パスでない。)
MAILDIR path too long (MAILDIR パスが長すぎる。)
ORGMAIL is not an absolute path (ORGMAIL が絶対パスでない。)
ORGMAIL path too long (ORGMAIL パスが長すぎる。)
default rcfile is not an absolute path (デフォルトの rcfile が絶対パス
でない。)
default rcfile path too long (デフォルトの rcfile へのパスが長すぎる。)
指 定 された項目のフルパスは、展開すると LINEBUF
よりも長かったか、或はそのフルパスの先頭がファイ
ルセパレータではなかった。
Excessive output quenched from "x" ("x" からの過剰な出力が抑止された)
プ ロ グラムまたはフィルタ "x" の出力が procmail
の LINEBUF のサイズを越えたので、溢れた残りの 分
は破棄され、 PROCMAIL_OVERFLOW がセットされた。
Extraneous x ignored (無関係な x は無視された)
このレシピで使用しているアクション行、または他の
フラグがあるので、フラグ x は無意味になる。
Failed forking "x" ( "x" の fork に失敗した)
プロセステーブルが一杯である (と共に NORESRETRY
が使い尽くされた)。
Failed to execute "x" ("x" の実行に失敗した)
プログラムがパスにないか、実行可能ではない。
Forced unlock denied on "x" ("x" へのアンロックの強行に失敗した)
ロ ックファイル "x" が存在するディレクトリに書き
込み許可がないか、または複数の procmail が全く同
時にロックを強行しようとしている。
Forcing lock on "x" ("x" のロックを強行する)
タイムアウトしたため、 ロックファイル "x" は強制
的に削除される。( LOCKTIMEOUT も合わせて参照され
たい)
Incomplete recipe (不完全なレシピ)
レシピの開始は見つかったが、レシピの終了が見つか
らないまま EOF で行き詰まってしまった。
Insufficient privileges (不十分な権限)
procmail が配送モードで動作するには、procmail に
root 権限が必要であるか、 procmail の (e)uid お
よび (e)gid が正しいものでなければならない。メー
ルはバウンスする。
Invalid regexp "x" (無効な正規表現 "x")
正 規表現 "x" にはエラーがある (多くの場合、括弧
が不足していたり余計だったりする)。
Kernel-lock failed (カーネルロックが失敗した)
カーネルがサポートするロック機能を試みている間に
、 それら機能呼び出しのうちの1つが失敗した (通常
OS エラーを示す)。 procmail はこのエラーを無視し
、処理を続行する。
Kernel-unlock failed (カーネルアンロックが失敗した)
上記説明を参照。
Lock failure on "x" ("x" のロック失敗)
このエラーは、適切でない (そして不正な) ロックフ
ァイル名を指定しているか、または権限が不足してい
た り存在しないサブディレクトリを指定したために
ロックファイルが作成できなかった場合にのみ生じる
。
Lost "x" ("x" が消失した)
procmail は自身のクローンを作ろうとしたが、 rc-
file "x" が見つからなかった (その rcfile が削 除
されたか、或は rcfile が相対パスで指定されていて
、前回 procmail がその rcfile を開いてからディレ
クトリを変更したかのいずれかである)。
Missing action (動作の不足)
現在のレシピが不完全であることがわかった。
Missing closing brace (閉じ括弧不足)
ネストしているブロックの開始はあるが終了が無い。
Missing name (名前の不足)
-f オプションには特別な引数が必要である。
Missing argument (引数の不足)
-a オプションが指定されたが、引数が忘れられて い
る。
Missing rcfile (rcfile がない)
-m オプションが指定されているが、 -m オプション
は引数として rcfile 名が必要である。
Missing recipient (受取人がない)
-d オプションを指定したか、または 別 の 名 前 で
procmail が呼び出された。その際、引数として 1つ
以上の受取人が必要である。
No space left to finish writing "x" ("x" の書き込みを終了させるだけの容
量がない)
"x" を含むファイルシステムに、配送メッセージをフ
ァイルに書き込むだけの十分な空き容量がない。
Out of memory (メモリ不足)
システムにスワップスペースが不足している (そして
NORESRETRY が使い尽くされた)。
Processing continued (処理が続行されている)
コマンドラインで認識されないオプションは無視され
、そのまま処理を続行する。
Program failure (nnn) of "x" (プログラム "x" が失敗した (nnn))
procmail から起動されたプログラムが、EXIT_SUC-
CESS (=0) ではなく nnn を返した; nnn が負なら 、
そのプログラムが死んだことを示すシグナルである。
Quota exceeded while writing "x" ("x" の書き込み中にディスクの割当量を
超過した)
"x" を含むそのファイルシステムにおける、受取人に
対するファイルサイズの制限の為に、メッセージをフ
ァイルへ配送することが許されない。
Renaming bogus "x" into "x" (間違っている名前 "x" を "x" に変更する)
受取人のシステムメールボックスが誤りだったので、
procmail は回避動作を行った。
Rescue of unfiltered data succeeded/failed (フィルタされていないデータ
の救出に
成功した / 失敗した) 【訳注: procmail から起動し
た】フィルタの実行に失敗したので、procmail は メ
ールをフィルタに渡す以前のテキストに戻そうとした
。
Skipped: "x" ("x" はスキップされた)
rcfile の "x" については (文法エラーに因り) 何も
行われず無視された。
Suspicious rcfile "x" (rcfile "x" は疑わしい)
rcfile の所有者が受取人もしくは root のいずれで
もないか、 rcfile 自体またはこれが存在するディレ
ク ト リが誰でも書き込み可能になっているか、この
rcfile がデフォルトの rcfile ($HOME/.procmailrc)
である場合はそのファイル自体またはファイルを含む
ディレクトリがグループ書き込み可能である【訳 注:
group writable】かのいずれかであった。 (したがっ
て rcfile は使われなかった)
Terminating prematurely whilst waiting for ... (... を待っている間の中
途終了)
procmail は .. を待っている間にシグナルを受信 し
た。
Timeout, terminating "x" (時間切れ: "x" の終了)
プ ログラムまたはフィルタ "x" は実行中に時間切れ
となった。
Timeout, was waiting for "x" ("x" を待っていたが時間切れになった)
プログラム或はフィルタの実行中、またはファ イ ル
"x" の処理中に時間切れとなった。 "x" がプログラ
ムまたはフィルタの場合、もはや動作していないよう
に見えた。
Truncated file to former size (ファイルを元のサイズに切り詰めた)
ファイルの配送が成功しなかったので、そのファイル
は元のサイズに切り詰められた。
Truncating "x" and retrying lock ("x" の切り詰めとロックの再試行)
"x" は有効なファイル名ではないか。またはファイル
が空ではない。
Unable to treat as directory "x" ("x" をディレクトリとして扱えない)
"x" の末尾が MH または maildir フォルダであるこ
とを示しているか、或はそれらのいずれかへリンクさ
れている二番目のフォルダとして記述されていたが、
"x" は既に存在していて、且つディレクトリではない
。 【訳注: メールボックス名の末尾が "/" で終る場
合は maildir として、 "/." で終る場合は MH と し
て扱われる。詳細は procmailrc (5) を参照。】
Unexpected EOL (予期しない EOL)
引 用符を閉じ忘れているか、 EOF の回避をし忘れて
いる。【訳注: 原文及びソース中のエラーメッセージ
に は EOL (End Of Line: 行末) と書かれているが、
ソースを参酌すると EOF (End Of File: ファイル 終
端) の間違いと推測する。】
Unknown user "x" (未知のユーザ "x")
指定された受取人に対応する uid がない。
拡張診断
VERBOSE 変数に値を設定すると、拡張診断機能を有効/無効にできる。
[pid] time & date procmail の pid とタイムスタンプである。 proc-
mail が診断をログ記録する時にはいつでも生成さ れ
、 少なくとも最後のタイムスタンプから1秒は経過し
ている。
Acquiring kernel-lock (カーネルロックの獲得)
procmail は、直前に開いたファイル (記述子) を カ
ーネルロックしようとしている。
Assigning "x" ("x" の割り当て)
環境変数割り当て。
Assuming identity of the recipient, VERBOSE=off (受取人のユーザ属性を想
定する。VERBOSE=off)
特権があればそれらをすべて破棄し、拡張診断機能を
自動的に無効にする。
Bypassed locking "x" ("x" のロック回避)
procmail はメールスプールディレクトリへアクセ ス
できなかったので、カーネルのロック機能しかあてに
ならなかった。
Executing "x" ("x" の実行)
プログラム "x" を起動する。シェルを介在させず に
procmail から直接 "x" を起動する場合、 procmail
は引数と引数の間にカンマを挿入して引数の区切りを
示す。
HOST mismatched "x" (このホストのホスト名は "x" と一致しない)
こ のホストのホスト名を "x" と認識した。 HOST に
は何か余計なものが含まれていた。【訳注: ホスト名
の検証結果に関するメッセージ。】
Locking "x" ("x" をロックする)
ロックファイル "x" を作成する。
Linking to "x" ("x" にリンクする)
ディレクトリフォルダ間にハードリンクを作成する。
Match on "x" ("x" で一致する)
条件が一致した。
Matched "x" (一致した "x")
"x" が MATCH に 割り当てられた。
No match on "x" ("x" には何も一致しない)
条件が一致せず、レシピは読み飛ばされた。
Non-zero exitcode (nnn) by "x" ("x" は 0 以外の終了コード (nnn) で終了
した)
レシピの条件文として、或は ‘W’ フラグのを用い る
アクション行として procmail から起動されたプログ
ラムは、 EXIT_SUCCESS (=0) ではない終了 コ ー ド
nnn を返して終了した。この使い方は全く予期しない
状態ではないことを示す。【訳注: すなわち、プログ
ラムの終了コードを条件分岐に用いるレシピにおいて
は、このメッセージが出ても必ずしも何らかの異常を
示すものではない。】
Notified comsat: "$LOGNAME@offset:file" (comsat の通知: "$LOGNAME@off-
set:file")
‘file’ の ‘offset’ の位置に、ユーザ $LOGNAME 宛
てのメールが到着したと、comsat/biff へ通知した。
【 訳注: biff はメールの到着を通知するユーティリ
ティ。 comsat は biff サーバ。各々 biff.1 及 び
comsat.1 を参照。】
Opening "x" ("x" を開いている)
Opening "x" ("x" のオープン) 追加のためにファイ
ル "x" を開く。【訳注: append mode: 追加モード】
Rcfile: "x" rcfile は "x" に変更された。
Reiterating kernel-lock (カーネルロックの繰り返し)
いくつかのロック方式を試行している最中に、そのう
ちの一つが失敗した。その試行のすべてが間をおかず
連続して成功するまで、 procmail はカーネルロック
を繰り返す。
Score: added newtotal "x" ( スコア: 追加の結果、新しい合計値は "x" とな
った)
この条件によってスコアに点が追加された。スコアは
‘新しい合計値’ になった。
Unlocking "x" ("x" のロック解除)
ロックファイル "x" を再び削除する。
警告
シ ステムメールボックス以外の任意のメールボックスに対して自分のメールシ
ェルを起動する場合は、その前に lockfile(1) を使用するシェルスクリプトを
作 成すること。 (もちろん、自分のメールシェルが (ローカルであるかグロー
バルであるかにかかわらず) rcfile で指定したロックファイルと同じものを使
用している場合は別である。)
万 が一 procmail を自身の正常終了前に絶対 kill しなければならない場合は
、まず最初に通常の kill コマンドを試してみること。 (つまり kill -9 では
な い。終了コードについては シグナルを参照のこと) さもないと、 ロックフ
ァイルがいくつか削除されない場合がある。
-t オプションは注意して使用すること。 (例えば rcfile に誤りがある た め
に) procmail が何度もメールの配送失敗を繰り返すと、システムのメールキュ
ーが溢れる可能性がある。こうなると、ローカルの postmaster と他のユー ザ
の両方に迷惑をかけるだろう。
/etc/procmailrc ファイルは root 権限で実行される場合があるので、このフ
ァイルに書き込む内容には十分に注意すること。 SHELL は現在の受取人のシェ
ル と同じになるため、 procmail でシェルを起動する必要がある場合は、最初
にこの変数を何らかの無難な値に設定しておくとよい。 DROPPRIVS も参照のこ
と。
/etc/procmailrcs/ にあるファイルに対して chown(1) が許可されていれば、
そのファイルの現在の所有者は、そのファイルを rootにでも (他の誰にで も)
chown できることを心に留めておくこと。そこで、セキュリティを最大限強化
するため、このディレクトリは必ず root だけが 実行可能であることを確認す
ること。
自 分のドメイン宛ての全てのメールに対して POP アカウントが1つしかないよ
うな、 1つのメールボックスを複数のユーザが共有する場合、 procmail は 適
切なツールではない。使用している MTA をどうにかして設定して、そのメッセ
ージの宛先を procmail に伝えるいくつかのヘッダを受取人データのエンベ ロ
ー プに追加すればそのような共有も可能になるだろう。しかしこれは通常正し
い行為ではない。おそらく、その MTA に「仮想ユーザテーブル」機能が備わっ
て いるかどうかを調べるか、 Fetchmail の ‘multidrop’ 機能を調べる方がい
い。
バグ
procmail は強制的にロックファイルを削除した後、新しいロックファイルを作
成 する前に $SUSPEND 秒待つ。これは、古くなったロックファイルを削除しよ
うとする他のプロセスが、新たに作成されたロックファイルを誤って削除し な
いようにする為である。
procmail は、暴走したフィルタを終了する為に通常の TERMINATE シグナルを
使用する。しかし、そのシグナルにフィルタが応答するかどうかは確認しな い
。 それに procmail がシグナルを送るのはそのフィルタ自体であり、そのフィ
ルタのどの子プロセスにもシグナルは送らない。
複数行に渡る、長過ぎる Content-Length: フィールドは正しく処理されない。
複 数行に渡る一つのヘッダに含まれる改行は、マッチングの際にはそれをその
まま1個の空白として扱うのではなく、無視されるだろう。
その他
メールヘッダに Content-Length: フィールドがあり、 -Y オプションが指定さ
れ ていなければ、 procmail はそのフィールドに指定されているサイズを正し
いサイズになるように調整する。その際、 procmail は Content-Length: フィ
ールドのフィールド幅を変更しない。
Content-Length: フィールドがない場合、または -Y オプションが指定されて
いる状態で procmail が通常のメールフォルダにメールを追加する場合、メ ッ
セージ本文中で消印と間違えそうな全ての行の行頭には ‘>’ が追加される (こ
れによって偽造メールヘッダを無害化する)。この消印は、以下の正規表現を用
いて検索する:
‘\nFrom ’
【 訳注: 消印: postmark: エンベロープ From を示す行のこと。 mbox 形式メ
ールボックスにメッセージを配送する際には、識別文字列 "From " と混同しな
い ように、本文中で行頭に "From" がある場合は、該当する全ての行の行頭に
引用符 ’>’ を付加する。なお、引用符の追加は MH フォルダ形式 と maildir
フォルダ形式では行われない。】
明示的配送モードで使用される配送先のユーザ名が /etc/passwd になければ、
procmail は明示的配送モードになっていなかったものとして処理を継続する。
明示的配送モードになっておらず、且つ実行中の procmail の uid に対応する
/etc/passwd エントリがない場合、HOME , LOGNAME , SHELL 及び ORGMAIL の
各 変数のデフォルト値は、それぞれ / , #uid , /bin/sh , /tmp/dead.letter
になる。
明示的配送モードの時、メッセージヘッダの先頭に ‘From ’ 行が な い 場 合
、procmail はこれを生成する。 ‘From ’行が既にある場合は、 procmail はそ
れには手を付けずにそのまま残す。 procmail を起動したユーザのユーザ或 は
グ ル ー プ ID が root, daemon, uucp, mail, x400, network, list, slist,
lists or news のいずれでもなく、それでも新しい ‘From ’ 行を生成ないし受
け 入 れる必要がある場合は、偽造メールと区別しやすくするために procmail
は ‘>From ’ 行を追加する。
セキュリティ上の理由から、 procmail が使用する rcfile は 絶 対 パ ス か
$HOME からの相対パス指定であり、且つその所有者が受取人または root であ
り、且つ rcfile 自体とこれを含むディレクトリの両方共誰でも書き込みで き
る状態であってはならない。【訳注: world writable: other (その他) の書き
込みビット (w) が立っている状態を指す。 man chmod 参 照 。 】 更 に
、$HOME/.procmailrc ファイルの場合は、同一グループユーザが書き込み可能
であってはならないし、また $HOME ディレクトリが同一グループから書き込み
可能であってはならない。
/var/mail/$LOGNAME が偽のメールボックスである (すなわち、メールボックス
の所有者が受取人でないか、メールボックスが書き込みできないか、メール ボ
ッ クスがシンボリックリンク或はハードリンクである) 場合、 procmail は起
動時にそのメールボックスを ‘BOGUS.$LOGNAME.’ で始まり、 inode-sequence-
code で終わるファイル名に変更しようとする。もしこれができないとわかると
、 ORGMAIL には初期値が 設定されない。結果として、適切な rcfile のな い
状態でメールの配送が行われなくなる。
/var/mail/$LOGNAME は正規のメールボックスだが、パーミッションが甘すぎる
場合は、 procmail はこれを修正する。 procmail にこのようなパーミッシ ョ
ン操作をさせないようにするには、メールボックスに必ず u+x ビットを立てる
こと。
メールをディレクトリ、MH フォルダ、または maildir フォルダに配送する 際
に は、 procmail の複数起動による混乱を防ぐ為にロックファイルを使う必要
は ない。
MH フォルダへの配送は、通常のディレクトリや mailbox への配送よりも若 干
の 時間を要する。これは procmail が (すぐに使えるファイル名を採用しない
で) MH フォルダ内でファイル名として使える次の番号を検索しなければならな
いからである。
-t オ プションが指定されていない限り、procmail は一般的な失敗に関して
EX_CANTCREAT を返す。 -t オプションが指定されている場合には EX_TEMPFAIL
を返す。
egrep 風のヘッダ検索をより良く行う為に、 procmail は複数行にわたる全て
のヘッダフィールドを連結して一行にする。但し、これは内部的な処理であ り
、メールを配送する際には、改行は元の状態に戻る。
(たとえば procmail が違う名前でリンクされていて、その違う名前で起動され
る場合のように) 起動する procmail の名前が ‘procmail’ で始まっていな い
場合、その procmail は明示的配送モードで起動され、 (-d オプションが指定
された時と同様に) コマンドラインの引数に受取人名が必要になる。
Comsat/biff 通知は udp を使用して行われる。この通知は、procmail が通 常
の ログファイルのエントリを生成した時に一回送出される。通知メッセージは
下記の拡張フォーマット (または最後の配送先がファイル以外の時のフォー マ
ットと酷似したもの) である:
$LOGNAME@offset_of_message_in_mailbox:absolute_path_to_mailbox
procmail がメールの配送の際にファイルを開く時は、 procmail は常に fc-
ntl(2) によるカーネルロックの方法を使用する。
procmail は NFS 環境でも使用可能で、 8 ビット問題はない。【訳 注: 8bit
clean: データの8ビット目を遮ることなく透過的にデータ転送を行えることを
指す。】
その他
procmail をコマンドラインオプション -h または -? にて起動すると、コマン
ド ラインヘルプとレシピフラグのクイックリファレンスのページが表示される
。
メールフィルタ(特に procmail)に関して、初心者向けに優れた FAQ が あ る:
こ れ は Nancy McGough
PROCMAIL(1) PROCMAIL(1)
NAME
procmail - autonomous mail processor
SYNOPSIS
procmail [-ptoY] [-f fromwhom]
[parameter=value | rcfile] ...
procmail [-toY] [-f fromwhom] [-a argument] ...
-d recipient ...
procmail [-ptY] -m [parameter=value] ... rcfile
[argument] ...
procmail [-toY] [-a argument] -z
procmail -v
DESCRIPTION
For a quick start, see NOTES at the end.
Procmail should be invoked automatically over the .forward file mecha-
nism as soon as mail arrives. Alternatively, when installed by a sys-
tem administrator (and in the standard Red Hat Linux configuration), it
can be invoked from within the mailer immediately. When invoked, it
first sets some environment variables to default values, reads the mail
message from stdin until an EOF, separates the body from the header,
and then, if no command line arguments are present, it starts to look
for a file named $HOME/.procmailrc. According to the processing
recipes in this file, the mail message that just arrived gets dis-
tributed into the right folder (and more). If no rcfile is found, or
processing of the rcfile falls off the end, procmail will store the
mail in the default system mailbox.
If no rcfiles and no -p have been specified on the command line, proc-
mail will, prior to reading $HOME/.procmailrc, interpret commands from
/etc/procmailrc (if present). Care must be taken when creating
/etc/procmailrc, because, if circumstances permit, it will be executed
with root privileges (contrary to the $HOME/.procmailrc file of
course).
If running suid root or with root privileges, procmail will be able to
perform as a functionally enhanced, backwards compatible mail delivery
agent.
Procmail can also be used as a general purpose mail filter, i.e., pro-
visions have been made to enable procmail to be invoked in a special
sendmail rule.
The rcfile format is described in detail in the procmailrc(5) man page.
The weighted scoring technique is described in detail in the proc-
mailsc(5) man page.
Examples for rcfile recipes can be looked up in the procmailex(5) man
page.
Signals
TERMINATE Terminate prematurely and requeue the mail.
HANGUP Terminate prematurely and bounce the mail.
INTERRUPT Terminate prematurely and bounce the mail.
QUIT Terminate prematurely and silently lose the mail.
ALARM Force a timeout (see TIMEOUT).
USR1 Equivalent to a VERBOSE=off.
USR2 Equivalent to a VERBOSE=on.
OPTIONS
-v Procmail will print its version number, display its compile time
configuration and exit.
-p Preserve any old environment. Normally procmail clears the envi-
ronment upon startup, except for the value of TZ. However, in any
case: any default values will override any preexisting environment
variables, i.e., procmail will not pay any attention to any prede-
fined environment variables, it will happily overwrite them with
its own defaults. For the list of environment variables that
procmail will preset see the procmailrc(5) man page. If both -p
and -m are specified, the list of preset environment variables
shrinks to just: LOGNAME, HOME, SHELL, ORGMAIL and MAILDIR.
-t Make procmail fail softly, i.e., if procmail cannot deliver the
mail to any of the destinations you gave, the mail will not
bounce, but will return to the mailqueue. Another delivery-
attempt will be made at some time in the future.
-f fromwhom
Causes procmail to regenerate the leading ‘From ’ line with
fromwhom as the sender (instead of -f one could use the alternate
and obsolete -r). If fromwhom consists merely of a single ‘-’,
then procmail will only update the timestamp on the ‘From ’ line
(if present, if not, it will generate a new one).
-o Instead of allowing anyone to generate ‘From ’ lines, simply over-
ride the fakes.
-Y Assume traditional Berkeley mailbox format, ignore any Content-
Length: fields.
-a argument
This will set $1 to be equal to argument. Each succeeding -a
argument will set the next number variable ($2, $3, etc). It can
be used to pass meta information along to procmail. This is typi-
cally done by passing along the $@x information from the sendmail
mailer rule.
-d recipient ...
This turns on explicit delivery mode, delivery will be to the
local user recipient. This, of course, only is possible if proc-
mail has root privileges (or if procmail is already running with
the recipient’s euid and egid). Procmail will setuid to the
intended recipients and delivers the mail as if it were invoked by
the recipient with no arguments (i.e., if no rcfile is found,
delivery is like ordinary mail). This option is incompatible with
-p.
-m Turns procmail into a general purpose mail filter. In this mode
one rcfile must be specified on the command line. After the
rcfile, procmail will accept an unlimited number of arguments. If
the rcfile is an absolute path starting with /etc/procmailrcs/
without backward references (i.e. the parent directory cannot be
mentioned) procmail will, only if no security violations are
found, take on the identity of the owner of the rcfile (or sym-
bolic link). For some advanced usage of this option you should
look in the EXAMPLES section below.
-z This turns on LMTP mode, wherein procmail acts as an RFC2033 LMTP
server. Delivery takes place in the same manner and under the
same restrictions as the delivery mode enabled with -d. This
option is incompatible with -p and -f.
ARGUMENTS
Any arguments containing an ’=’ are considered to be environment vari-
able assignments, they will all be evaluated after the default values
have been assigned and before the first rcfile is opened.
Any other arguments are presumed to be rcfile paths (either absolute,
or if they start with ‘./’ relative to the current directory; any other
relative path is relative to $HOME, unless the -m option has been
given, in which case all relative paths are relative to the current
directory); procmail will start with the first one it finds on the com-
mand line. The following ones will only be parsed if the preceding
ones have a not matching HOST-directive entry, or in case they should
not exist.
If no rcfiles are specified, it looks for $HOME/.procmailrc. If not
even that can be found, processing will continue according to the
default settings of the environment variables and the ones specified on
the command line.
EXAMPLES
Examples for rcfile recipes can be looked up in the procmailex(5) man
page. A small sample rcfile can be found in the NOTES section below.
Skip the rest of this EXAMPLES section unless you are a system adminis-
trator who is vaguely familiar with sendmail.cf syntax.
The -m option is typically used when procmail is called from within a
rule in the sendmail.cf file. In order to be able to do this it is
convenient to create an extra ‘procmail’ mailer in your sendmail.cf
file (in addition to the perhaps already present ‘local’ mailer that
starts up procmail). To create such a ‘procmail’ mailer I’d suggest
something like:
Mprocmail, P=/usr/bin/procmail, F=mSDFMhun, S=11, R=21,
A=procmail -m $h $g $u
This enables you to use rules like the following (most likely in rule-
set 0) to filter mail through the procmail mailer (please note the
leading tab to continue the rule, and the tab to separate the com-
ments):
R$*<@some.where>$*
$#procmail $@/etc/procmailrcs/some.rc $:$1@some.where.procmail$2
R$*<@$*.procmail>$*
$1<@$2>$3 Already filtered, map back
And /etc/procmailrcs/some.rc could be as simple as:
SENDER = "<$1>" # fix for empty sender addresses
SHIFT = 1 # remove it from $@
:0 # sink all junk mail
* ^Subject:.*junk
/dev/null
:0 w # pass along all other mail
! -oi -f "$SENDER" "$@"
Do watch out when sending mail from within the /etc/procmailrcs/some.rc
file, if you send mail to addresses which match the first rule again,
you could be creating an endless mail loop.
FILES
/etc/passwd to set the recipient’s LOGNAME, HOME and SHELL
variable defaults
/var/spool/mail/$LOGNAME
system mailbox; both the system mailbox and the
immediate directory it is in will be created
every time procmail starts and either one is not
present
/etc/procmailrc initial global rcfile
/etc/procmailrcs/ special privileges path for rcfiles
$HOME/.procmailrc default rcfile
/var/spool/mail/$LOGNAME.lock
lockfile for the system mailbox (not automati-
cally used by procmail, unless $DEFAULT equals
/var/spool/mail/$LOGNAME and procmail is deliv-
ering to $DEFAULT)
/usr/sbin/sendmail default mail forwarder
_????‘hostname‘ temporary ‘unique’ zero-length files created by
procmail
SEE ALSO
procmailrc(5), procmailsc(5), procmailex(5), sh(1), csh(1), mail(1),
mailx(1), binmail(1), uucp(1), aliases(5), sendmail(8), egrep(1),
grep(1), biff(1), comsat(8), lockfile(1), formail(1), cron(1)
DIAGNOSTICS
Autoforwarding mailbox found
The system mailbox had its suid or sgid bit set,
procmail terminates with EX_NOUSER assuming that
this mailbox must not be delivered to.
Bad substitution of "x"
Not a valid environment variable name specified.
Closing brace unexpected
There was no corresponding opening brace (nest-
ing block).
Conflicting options Not all option combinations are useful
Conflicting x suppressed
Flag x is not compatible with some other flag on
this recipe.
Couldn’t create "x" The system mailbox was missing and could
not/will not be created.
Couldn’t create maildir part "x"
The maildir folder "x" is missing one or more
required subdirectories and procmail could not
create them.
Couldn’t create or rename temp file "x"
An error occurred in the mechanics of deliver-
ing to the directory folder "x".
Couldn’t determine implicit lockfile from "x"
There were no ‘>>’ redirectors to be found, us-
ing simply ‘$LOCKEXT’ as locallockfile.
Couldn’t read "x" Procmail was unable to open an rcfile or it was
not a regular file, or procmail couldn’t open an
MH directory to find the highest numbered file.
Couldn’t unlock "x" Lockfile was already gone, or write permission
to the directory where the lockfile is has been
denied.
Deadlock attempted on "x"
The locallockfile specified on this recipe is
equal to a still active $LOCKFILE.
Denying special privileges for "x"
Procmail will not take on the identity that
comes with the rcfile because a security viola-
tion was found (e.g. -p or variable assignments
on the command line) or procmail had insuffi-
cient privileges to do so.
Descriptor "x" was not open
As procmail was started, stdin, stdout or stderr
was not connected (possibly an attempt to sub-
vert security)
Enforcing stricter permissions on "x"
The system mailbox of the recipient was found to
be unsecured, procmail secured it.
Error while writing to "x"
Nonexistent subdirectory, no write permission,
pipe died or disk full.
Exceeded LINEBUF Buffer overflow detected, LINEBUF was too small,
PROCMAIL_OVERFLOW has been set.
MAILDIR is not an absolute path
MAILDIR path too long
ORGMAIL is not an absolute path
ORGMAIL path too long
default rcfile is not an absolute path
default rcfile path too long
The specified item’s full path, when expanded,
was longer than LINEBUF or didn’t start with a
file separator.
Excessive output quenched from "x"
The program or filter "x" tried to produce too
much output for the current LINEBUF, the rest
was discarded and PROCMAIL_OVERFLOW has been
set.
Extraneous x ignored The action line or other flags on this recipe
makes flag x meaningless.
Failed forking "x" Process table is full (and NORESRETRY has been
exhausted).
Failed to execute "x" Program not in path, or not executable.
Forced unlock denied on "x"
No write permission in the directory where lock-
file "x" resides, or more than one procmail try-
ing to force a lock at exactly the same time.
Forcing lock on "x" Lockfile "x" is going to be removed by force be-
cause of a timeout (see also: LOCKTIMEOUT).
Incomplete recipe The start of a recipe was found, but it stranded
in an EOF.
Insufficient privileges
Procmail either needs root privileges, or must
have the right (e)uid and (e)gid to run in de-
livery mode. The mail will bounce.
Invalid regexp "x" The regular expression "x" contains errors (most
likely some missing or extraneous parens).
Kernel-lock failed While trying to use the kernel-supported locking
calls, one of them failed (usually indicates an
OS error), procmail ignores this error and pro-
ceeds.
Kernel-unlock failed See above.
Lock failure on "x" Can only occur if you specify some real weird
(and illegal) lockfilenames or if the lockfile
could not be created because of insufficient
permissions or nonexistent subdirectories.
Lost "x" Procmail tried to clone itself but could not
find back rcfile "x" (it either got removed or
it was a relative path and you changed directory
since procmail opened it last time).
Missing action The current recipe was found to be incomplete.
Missing closing brace A nesting block was started, but never finished.
Missing name The -f option needs an extra argument.
Missing argument You specified the -a option but forgot the argu-
ment.
Missing rcfile You specified the -m option, procmail expects
the name of an rcfile as argument.
Missing recipient You specified the -d option or called procmail
under a different name, it expects one or more
recipients as arguments.
No space left to finish writing "x"
The filesystem containing "x" does not have
enough free space to permit delivery of the mes-
sage to the file.
Out of memory The system is out of swap space (and NORESRETRY
has been exhausted).
Processing continued The unrecognised options on the command line are
ignored, proceeding as usual.
Program failure (nnn) of "x"
Program that was started by procmail returned
nnn instead of EXIT_SUCCESS (=0); if nnn is neg-
ative, then this is the signal the program died
on.
Quota exceeded while writing "x"
The filesize quota for the recipient on the
filesystem containing "x" does not permit deliv-
ering the message to the file.
Renaming bogus "x" into "x"
The system mailbox of the recipient was found to
be bogus, procmail performed evasive actions.
Rescue of unfiltered data succeeded/failed
A filter returned unsuccessfully, procmail tried
to get back the original text.
Skipped: "x" Couldn’t do anything with "x" in the rcfile
(syntax error), ignoring it.
Suspicious rcfile "x" The owner of the rcfile was not the recipient or
root, the file was world writable, or the direc-
tory that contained it was world writable, or
this was the default rcfile ($HOME/.procmailrc)
and either it was group writable or the directo-
ry that contained it was group writable (the rc-
file was not used).
Terminating prematurely whilst waiting for ...
Procmail received a signal while it was waiting
for ...
Timeout, terminating "x"
Timeout has occurred on program or filter "x".
Timeout, was waiting for "x"
Timeout has occurred on program, filter or file
"x". If it was a program or filter, then it
didn’t seem to be running anymore.
Truncated file to former size
The file could not be delivered to successfully,
so the file was truncated to its former size.
Truncating "x" and retrying lock
"x" does not seem to be a valid filename or the
file is not empty.
Unable to treat as directory "x"
Either the suffix on "x" would indicate that it
should be an MH or maildir folder, or it was
listed as an second folder into which to link,
but it already exists and is not a directory.
Unexpected EOL Missing closing quote, or trying to escape EOF.
Unknown user "x" The specified recipient does not have a corre-
sponding uid.
EXTENDED DIAGNOSTICS
Extended diagnostics can be turned on and off through setting the VER-
BOSE variable.
[pid] time & date Procmail’s pid and a timestamp. Generated when-
ever procmail logs a diagnostic and at least a
second has elapsed since the last timestamp.
Acquiring kernel-lock Procmail now tries to kernel-lock the most re-
cently opened file (descriptor).
Assigning "x" Environment variable assignment.
Assuming identity of the recipient, VERBOSE=off
Dropping all privileges (if any), implicitly
turns off extended diagnostics.
Bypassed locking "x" The mail spool directory was not accessible to
procmail, it relied solely on kernel locks.
Executing "x" Starting program "x". If it is started by proc-
mail directly (without an intermediate shell),
procmail will show where it separated the argu-
ments by inserting commas.
HOST mismatched "x" This host was called "x", HOST contained some-
thing else.
Locking "x" Creating lockfile "x".
Linking to "x" Creating a hardlink between directory folders.
Match on "x" Condition matched.
Matched "x" Assigned "x" to MATCH.
No match on "x" Condition didn’t match, recipe skipped.
Non-zero exitcode (nnn) by "x"
Program that was started by procmail as a condi-
tion or as the action of a recipe with the ‘W’
flag returned nnn instead of EXIT_SUCCESS (=0);
the usage indicates that this is not an entirely
unexpected condition.
Notified comsat: "$LOGNAME@offset:file"
Sent comsat/biff a notice that mail arrived for
user $LOGNAME at ‘offset’ in ‘file’.
Opening "x" Opening file "x" for appending.
Rcfile: "x" Rcfile changed to "x".
Reiterating kernel-lock
While attempting several locking methods, one of
these failed. Procmail will reiterate until
they all succeed in rapid succession.
Score: added newtotal "x"
This condition scored ‘added’ points, which re-
sulted in a ‘newtotal’ score.
Unlocking "x" Removing lockfile "x" again.
WARNINGS
You should create a shell script that uses lockfile(1) before invoking
your mail shell on any mailbox file other than the system mailbox (un-
less of course, your mail shell uses the same lockfiles (local or glob-
al) you specified in your rcfile).
In the unlikely event that you absolutely need to kill procmail before
it has finished, first try and use the regular kill command (i.e., not
kill -9, see the subsection Signals for suggestions), otherwise some
lockfiles might not get removed.
Beware when using the -t option, if procmail repeatedly is unable to
deliver the mail (e.g., due to an incorrect rcfile), the system
mailqueue could fill up. This could aggravate both the local postmas-
ter and other users.
The /etc/procmailrc file might be executed with root privileges, so be
very careful of what you put in it. SHELL will be equal to that of the
current recipient, so if procmail has to invoke the shell, you’d better
set it to some safe value first. See also: DROPPRIVS.
Keep in mind that if chown(1) is permitted on files in /etc/procmail-
rcs/, that they can be chowned to root (or anyone else) by their cur-
rent owners. For maximum security, make sure this directory is exe-
cutable to root only.
Procmail is not the proper tool for sharing one mailbox among many
users, such as when you have one POP account for all mail to your do-
main. It can be done if you manage to configure your MTA to add some
headers with the envelope recipient data in order to tell Procmail who
a message is for, but this is usually not the right thing to do. Per-
haps you want to investigate if your MTA offers ‘virtual user tables’,
or check out the ‘multidrop’ facility of Fetchmail.
BUGS
After removing a lockfile by force, procmail waits $SUSPEND seconds be-
fore creating a new lockfile so that another process that decides to
remove the stale lockfile will not remove the newly created lock by
mistake.
Procmail uses the regular TERMINATE signal to terminate any runaway
filter, but it does not check if the filter responds to that signal and
it only sends it to the filter itself, not to any of the filter’s chil-
dren.
A continued Content-Length: field is not handled correctly.
The embedded newlines in a continued header should be skipped when
matching instead of being treated as a single space as they are now.
MISCELLANEOUS
If there is an existing Content-Length: field in the header of the mail
and the -Y option is not specified, procmail will trim the field to re-
port the correct size. Procmail does not change the fieldwidth.
If there is no Content-Length: field or the -Y option has been speci-
fied and procmail appends to regular mailfolders, any lines in the body
of the message that look like postmarks are prepended with ‘>’ (disarms
bogus mailheaders). The regular expression that is used to search for
these postmarks is:
‘\nFrom ’
If the destination name used in explicit delivery mode is not in
/etc/passwd, procmail will proceed as if explicit delivery mode was not
in effect. If not in explicit delivery mode and should the uid proc-
mail is running under, have no corresponding /etc/passwd entry, then
HOME will default to /, LOGNAME will default to #uid, SHELL will de-
fault to /bin/sh, and ORGMAIL will default to /tmp/dead.letter.
When in explicit delivery mode, procmail will generate a leading ‘From
’ line if none is present. If one is already present procmail will
leave it intact. If procmail is not invoked with one of the following
user or group ids : root, daemon, uucp, mail, x400, network, list,
slist, lists or news, but still has to generate or accept a new ‘From ’
line, it will generate an additional ‘>From ’ line to help distinguish
fake mails.
For security reasons procmail will only use an absolute or $HOME-rela-
tive rcfile if it is owned by the recipient or root, not world
writable, and the directory it is contained in is not world writable.
The $HOME/.procmailrc file has the additional constraint of not being
group-writable or in a group-writable directory.
If /var/spool/mail/$LOGNAME is a bogus mailbox (i.e., does not belong
to the recipient, is unwritable, is a symbolic link or is a hard link),
procmail will upon startup try to rename it into a file starting with
‘BOGUS.$LOGNAME.’ and ending in an inode-sequence-code. If this turns
out to be impossible, ORGMAIL will have no initial value, and hence
will inhibit delivery without a proper rcfile.
If /var/spool/mail/$LOGNAME already is a valid mailbox, but has got too
loose permissions on it, procmail will correct this. To prevent proc-
mail from doing this make sure the u+x bit is set.
When delivering to directories, MH folders, or maildir folders, you
don’t need to use lockfiles to prevent several concurrently running
procmail programs from messing up.
Delivering to MH folders is slightly more time consuming than deliver-
ing to normal directories or mailboxes, because procmail has to search
for the next available number (instead of having the filename immedi-
ately available).
On general failure procmail will return EX_CANTCREAT, unless option -t
is specified, in which case it will return EX_TEMPFAIL.
To make ‘egrepping’ of headers more consistent, procmail concatenates
all continued header fields; but only internally. When delivering the
mail, line breaks will appear as before.
If procmail is called under a name not starting with ‘procmail’ (e.g.,
if it is linked to another name and invoked as such), it comes up in
explicit delivery mode, and expects the recipients’ names as command
line arguments (as if -d had been specified).
Comsat/biff notifications are done using udp. They are sent off once
when procmail generates the regular logfile entry. The notification
messages have the following extended format (or as close as you can get
when final delivery was not to a file):
$LOGNAME@offset_of_message_in_mailbox:absolute_path_to_mailbox
Whenever procmail itself opens a file to deliver to, it consistently
uses the following kernel locking strategies: fcntl(2).
Procmail is NFS-resistant and eight-bit clean.
NOTES
Calling up procmail with the -h or -? options will cause it to display
a command-line help and recipe flag quick-reference page.
There exists an excellent newbie FAQ about mailfilters (and procmail in
particular); it is maintained by Nancy McGough
Copyright(C) linux-cmd.com All Rights Reserved. Author Takayuki Yukawa