ISPConfig 2.x:「スパムに移動」オプションを追加する方法ISPConfigInstallation
バージョン1.0b
作成者:Jens Groh
このドキュメントでは、ISPConfig2.xインストールに3番目のスパムフィルター戦略を追加するために必要な手順について説明します。これにより、あなたとあなたのユーザーは、スパムをドロップするか、スパムを許可するか、対応するIMAP迷惑メールフォルダに移動するかを選択できます。
このハウツーは、ドロップ戦略を移動と交換したことを説明した「grant」(https://www.howtoforge.com/forums/showthread.php?t=15704)のフォーラムスレッドに触発されました。以下の手順に従うことで、ドロップ方法を置き換えるのではなく、3番目の方法を取得します。
前提条件:
このハウツーでは、次の構成または同様の構成を使用していると想定します。
- ISPConfig(v2.2.23以降)
- メールボックスが設定され実行されている少なくとも1つのドメイン
- IMAPはMaildir形式を使用しています(これはmboxでは機能しません!)
最初のステップは、管理者を使用してISPConfigパネルにログインすることです。 アカウント。次に、管理を入力します タブをクリックしてFormDesignerを開きます フォームの編集 。 isp-ISPユーザーを検索します 編集をクリックします 。
これで、その特定のフォームの完全なフォームの説明が表示されます。 spam_strategyを探してください。 編集を押します もう一度。
ここで、値リストを変更します。 将来の移動オプションの行を挿入して、そのフォーム要素の次のように表示します。
accept,accept; move,move; discard,discard;そのフォームを保存します。ドメインのメールユーザーオプションは、まだ機能がない場合でも、スパム戦略ドロップダウンボックスにその新しいオプションを表示するはずです。次に、コンソール部分について説明します。いくつかのISPConfigファイルを編集して、新しいオプションに息を吹き込みましょう。
次に、一連のファイルを編集する必要があります。それらを書き留めて後で説明します:
vi / root / ispconfig / scripts / lib / classes / ispconfig_procmail.lib.php
(109行目あたり):if(!is_dir($web_path."/user/".$user_username."/Maildir")) $mod->log->caselog("maildirmake ".$web_path."/user/".$user_username."/Maildir &> /dev/null", "maildirmake ".$web_path."/user/".$user_username."/Maildir &> /dev/null", __LINE__); // ADD: create IMAP subfolders if(!is_dir($web_path."/user/".$user_username."/Maildir/.Drafts")) $mod->log->caselog("maildirmake ".$web_path."/user/".$user_username."/Maildir/.Drafts &> /dev/null", "maildirmake ".$web_path."/user/".$user_username."/Maildir/.Drafts &> /dev/null", __LINE__); if(!is_dir($web_path."/user/".$user_username."/Maildir/.Junk")) $mod->log->caselog("maildirmake ".$web_path."/user/".$user_username."/Maildir/.Junk &> /dev/null", "maildirmake ".$web_path."/user/".$user_username."/Maildir/.Junk &> /dev/null", __LINE__); if(!is_dir($web_path."/user/".$user_username."/Maildir/.Sent")) $mod->log->caselog("maildirmake ".$web_path."/user/".$user_username."/Maildir/.Sent &> /dev/null", "maildirmake ".$web_path."/user/".$user_username."/Maildir/.Sent &> /dev/null", __LINE__); if(!is_dir($web_path."/user/".$user_username."/Maildir/.Trash")) $mod->log->caselog("maildirmake ".$web_path."/user/".$user_username."/Maildir/.Trash &> /dev/null", "maildirmake ".$web_path."/user/".$user_username."/Maildir/.Trash &> /dev/null", __LINE__); if(!is_dir($web_path."/user/".$user_username."/Maildir")) $mod->log->phpcaselog(mkdir($web_path."/user/".$user_username."/Maildir", 0700), "create ".$web_path."/user/".$user_username."/Maildir", $this->FILE, __LINE__); // ADD: create IMAP subfolders if(!is_dir($web_path."/user/".$user_username."/Maildir/.Drafts")) $mod->log->phpcaselog(mkdir($web_path."/user/".$user_username."/Maildir/.Drafts", 0700), "create ".$web_path."/user/".$user_username."/Maildir/.Drafts", $this->FILE, __LINE__); if(!is_dir($web_path."/user/".$user_username."/Maildir/.Junk")) $mod->log->phpcaselog(mkdir($web_path."/user/".$user_username."/Maildir/.Junk", 0700), "create ".$web_path."/user/".$user_username."/Maildir/.Junk", $this->FILE, __LINE__); if(!is_dir($web_path."/user/".$user_username."/Maildir/.Sent")) $mod->log->phpcaselog(mkdir($web_path."/user/".$user_username."/Maildir/.Sent", 0700), "create ".$web_path."/user/".$user_username."/Maildir/.Sent", $this->FILE, __LINE__); if(!is_dir($web_path."/user/".$user_username."/Maildir/.Trash")) $mod->log->phpcaselog(mkdir($web_path."/user/".$user_username."/Maildir/.Trash", 0700), "create ".$web_path."/user/".$user_username."/Maildir/.Trash", $this->FILE, __LINE__); exec("chown -R ".$user_username.":web".$web_doc_id." ".$web_path."/user/".$user_username."/Maildir"); exec("chmod 700 ".$web_path."/user/".$user_username."/Maildir"); // ADD: create IMAP subfolders exec("chown -R ".$user_username.":web".$web_doc_id." ".$web_path."/user/".$user_username."/Maildir/.Drafts"); exec("chmod 700 ".$web_path."/user/".$user_username."/Maildir/.Drafts"); exec("chown -R ".$user_username.":web".$web_doc_id." ".$web_path."/user/".$user_username."/Maildir/.Junk"); exec("chmod 700 ".$web_path."/user/".$user_username."/Maildir/.Junk"); exec("chown -R ".$user_username.":web".$web_doc_id." ".$web_path."/user/".$user_username."/Maildir/.Sent"); exec("chmod 700 ".$web_path."/user/".$user_username."/Maildir/.Sent"); exec("chown -R ".$user_username.":web".$web_doc_id." ".$web_path."/user/".$user_username."/Maildir/.Trash"); exec("chmod 700 ".$web_path."/user/".$user_username."/Maildir/.Trash"); if($user["user_admin"]){ exec("rm -f $web_path/Maildir &> /dev/null"); $mod->log->phpcaselog(@symlink($web_path."/user/".$user_username."/Maildir", $web_path."/Maildir"), "symlink ".$web_path."/Maildir", $this->FILE, __LINE__);
(300行目あたり)
$mod->tpl->define( array(table => "spamassassin.rc.master")); if(!isset($user["spam_strategy"])) $user["spam_strategy"] = "accept"; if($user["spam_strategy"] == "accept"){ $spam_comment = "#"; $spam_command = ".Junk/"; } else { $spam_comment = ""; if($user["spam_strategy"] == "discard"){ $spam_command = "/dev/null"; } else { $spam_command = ".Junk/"; } }
(330行目あたり)
if(is_file('/home/admispconfig/ispconfig/tools/spamassassin/usr/local/bin/spamassassin')){ @@ -302,6 +333,7 @@ // Variablen zuweisen $mod->tpl->assign( array(PREFS_FILE => $web_path."/user/".$user_username."/.user_prefs", SPAM_COMMENT => $spam_comment, SPAM_COMMAND => $spam_command, SPAMASSASSIN_PATH => $spamassassin_path, USERNAME => $user_username));
これにより、コア機能が追加されます。この変更により、ユーザーにゴミ箱、送信済み、迷惑メール、下書きなどの標準のメールアドレスボックスが追加されます。 メールユーザーが作成されるたびに、対応するジャンクフォルダーにスパムを移動できます。
次のような移動文字列を見つけて、次のファイル全体に追加します。
vi / home / admispconfig / ispconfig / lib / classes / ispconfig_isp_user.lib.php
(102行目あたり)$doc->deck[1]->elements[11]->visible = 0; } $doc->deck[2]->elements[2]->values["accept"] = $go_api->lng("txt_accept"); $doc->deck[2]->elements[2]->values["move"] = $go_api->lng("txt_move"); $doc->deck[2]->elements[2]->values["discard"] = $go_api->lng("txt_discard"); }
vi / home / admispconfig / ispconfig / web / mailuser / mail / table / user.table.php
(135行目あたり)'regex' => "", 'errmsg' => "", 'value' => array( "accept" => $app->lng("txt_accept"), "move" => $app->lng("txt_move"), "discard" => $app->lng("txt_discard"))); $table['spam_hits'] = array('datatype' => "VARCHAR",
vi / home / admispconfig / ispconfig / web / mailuser / lib / lang /
$wb["txt_accept"] = "accept"; $wb["txt_move"] = "move"; $wb["txt_discard"] = "discard";
vi / home / admispconfig / ispconfig / web / isp_manager / lib / lang /
$wb["Spamfilter"] = 'Spamfilter'; $wb["Antivirus"] = 'Antivirus'; $wb["accept"] = 'accept'; $wb["move"] = 'move'; $wb["discard"] = 'discard'; $wb["Spam Strategie"] = 'Spam Strategy'; $wb["Spam Hits"] = 'Spam Hits'; (...) $wb["Keine Vorlage verwenden"] = "Individual Settings"; $wb["Keine Vorlage vorhanden"] = "No Hostingplan Available"; $wb["txt_accept"] = "accept"; $wb["txt_move"] = "move"; $wb["txt_discard"] = "discard"; $wb["Eigenschaften"] = "Properties"; $wb["ISP Datenbank"] = "ISP Database";
vi / home / admispconfig / ispconfig / web / isp_kunde / lib / lang /
$wb["Spamfilter"] = 'Spamfilter'; $wb["Antivirus"] = 'Antivirus'; $wb["accept"] = 'accept'; $wb["move"] = 'move'; $wb["discard"] = 'discard'; $wb["Spam Strategie"] = 'Spam Strategy'; $wb["Spam Hits"] = 'Spam Hits'; (...) $wb["Keine Vorlage verwenden"] = "Individual Settings"; $wb["Keine Vorlage vorhanden"] = "No Hostingplan Available"; $wb["txt_accept"] = "accept"; $wb["txt_move"] = "move"; $wb["txt_discard"] = "discard"; $wb["Eigenschaften"] = "Properties"; $wb["ISP Datenbank"] = "ISP Database";
言語ファイルまたはインターフェイスごとに行う必要のある最後の3つの変更は、 moveと表示されます。 あなたの言語の対応する用語の代わりに。 3つのサンプルスニペットは、これらのディレクトリのen.lngファイルからのものであり、他の言語も同じように編集します( move を挿入します) 他の間のエントリ)。
次に、 / root / ispconfig / isp / confに変更します。 ディレクトリを作成し、 spamassassin.rc.masterのカスタムコピーを作成します :
cd /root/ispconfig/isp/conf
cp -pr spamassassin.rc.master ./customized_templates/cdcustomized_templates
次に、カスタムテンプレートを編集して、必要な変更を反映します。
# All mail tagged as spam (eg. with a score higher than the set threshold) # is moved to "/dev/null". {SPAM_COMMENT}:0: {SPAM_COMMENT}* ^X-Spam-Status: Yes {SPAM_COMMENT}{SPAM_COMMAND}
ステップ4(オプション)-ゴミ箱とスパムフォルダーのクリーニングを実装します
これはすでにMuisjeNLによって対処されています 次のハウツー:ISPConfigを使用したゴミ箱やジャンクフォルダの自動クリーニング(Roundcube + Tmpreaper / Tmpwatchを使用)
ステップ5(オプション)-いくつかのユーザーフレンドリーを実装し、ステータスメールを作成します
現在、かなりハッキングされたperlcodeを使用しているため、これは大幅に開発中です。それをクリーンアップするか、かわいいスクリプトに転送してみます。
これで、メールユーザーを追加(または既存のものを変更)して、新しい moveを使用できるようになりました。 方法。私は、1日に約100〜200のスパムメールを受信するユーザーでテストし、戦略を移動に変更しました。 。 Webメーラーのようなラウンドキューブを使用するか、IMAP経由でメールボックスに接続すると、最初のメールが受信トレイではなくジャンクフォルダにドロップされるため、ほぼ即時の結果が得られました。
本番サーバーで実際に実行する前に、これを確認してください。
このチュートリアルには、保証人は一切含まれていません。賢明に、それをテストしてください!
これは私にとってHowtoForgeの最初のHowToであるため(そして私はネイティブスピーカーではありません)、ニーズに合わせて問題なく適応できることを願っています。優れたソフトウェアを楽しんでください: ISPConfig !
Jens Groh for SANlutions Ltd.