サーバー設定 · 1 min read · Sep 29, 2025

完璧なSpamSnake - Ubuntu Jaunty Jackalope - ページ 2

10. Apache2

apt-get install apache2 apache2-suexec apache2-doc apache2-mpm-prefork apache2-utils libexpat1

次に、ApacheモジュールとしてPHP5をインストールします:

aptitude install libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-mysql php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

次に、/etc/apache2/mods-available/dir.confを編集し、DirectoryIndex行を変更します:



          #DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
          DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl index.xhtml

次に、いくつかのApacheモジュール(rewrite、suexec、include)を有効にする必要があります

a2enmod rewrite   
a2enmod suexec   
a2enmod include

Apacheを再起動します:

/etc/init.d/apache2 restart

11. PostfixとMySQL

パッケージをインストールします:

apt-get install postfix postfix-mysql postfix-doc mysql-server mysql-client procmail

MySQL:

MySQLのrootユーザーのパスワードを提供するように求められます - このパスワードはユーザーroot@localhostおよび [email protected] に対して有効ですので、後でMySQLのrootパスワードを手動で指定する必要はありません:

MySQL “root”ユーザーの新しいパスワード: <– yourrootsqlpassword
MySQL “root”ユーザーのパスワードを繰り返します: <– yourrootsqlpassword

Postfix:

2つの質問をされます。次のように答えてください:

メール構成の一般的なタイプ: <– インターネットサイト
システムメール名: <– server1.example.com

MySQLがlocalhostだけでなくすべてのインターフェースでリッスンするようにしたいので、/etc/mysql/my.cnfを編集し、bind-address = 127.0.0.1の行をコメントアウトします:

[...]
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address           = 127.0.0.1
[...]

次に、MySQLを再起動します:

/etc/init.d/mysql restart

ネットワーキングが有効になっているか確認します。実行します:

netstat -tap | grep mysql

出力は次のようになります:

tcp        0      0 *:mysql                 *:*                     LISTEN      4318/mysqld

Postfixを停止します:

postfix stop

以下のようにPostfixを編集したいと思います:

master.cfを編集:

pickupサービスタイプの下に2つの項目を追加する必要があります。pickupサービスはローカルメール(ローカルは「このマシン上」を意味します)を「ピックアップ」して配信します。これは、このマシンによって生成されたメールのコンテンツフィルタリングをバイパスする方法です。

完了すると次のようになります:

pickup    fifo  n       -       -       60      1       pickup
         -o content_filter=
         -o receive_override_options=no_header_body_checks

main.cfを編集:

postconf -e "alias_maps = hash:/etc/aliases"  
newaliases  
postconf -e "myorigin = example.com"  
postconf -e "myhostname = server1.example.com"  
postconf -e "mynetworks = 127.0.0.0/8, 192.168.0.0/24"  
postconf -e "message_size_limit = 10485760"  
postconf -e "local_transport = error:No local mail delivery"  
postconf -e "mydestination = "  
postconf -e "local_recipient_maps = "  
postconf -e "virtual_alias_maps = hash:/etc/postfix/virtual"

/etc/postfix/virtualを作成し、次の内容を追加します:

postmaster [email protected]
abuse [email protected]
root [email protected]

続けます:

postmap /etc/postfix/virtual  
postconf -e "relay_recipient_maps = hash:/etc/postfix/relay_recipients"

/etc/postfix/relay_recipientsを作成し、次の内容を追加します:

@example.com OK
@example2.com OK

続けます:

postmap /etc/postfix/relay_recipients  
postconf -e "transport_maps = hash:/etc/postfix/transport"

/etc/postfix/transportを作成し、次の内容を追加します:

example.com smtp:[192.168.0.x]
example2.com smtp:[192.168.0.x]

続けます:

postmap /etc/postfix/transport  
postconf -e "relay_domains = hash:/etc/postfix/relay_domains"

/etc/postfix/relay_domainsを作成し、次の内容を追加します:

example.com OK
example2.com OK

続けます:

postmap /etc/postfix/relay_domains  
postconf -e "smtpd_helo_required = yes"  
postconf -e "smtpd_sender_restrictions = reject_non_fqdn_sender, reject_unknown_sender_domain, permit"  
postconf -e "smtpd_recipient_restrictions = reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_recipient_domain, permit_mynetworks, reject_unauth_destination, reject_unauth_pipelining, reject_rbl_client zen.spamhaus.org, reject_rbl_client bl.spamcop.net, permit"  
postconf -e "smtpd_data_restrictions = reject_unauth_pipelining"

Postfix構成を最終確認しましょう:

less /etc/postfix/main.cf

エラーがないかファイルの内容を確認し、必要に応じて修正します。Postfixを起動します:

postfix start

Postfixが応答するか確認します:

telnet 127.0.0.1 25

次のように表示されるはずです:

220 [yourFQDNhere] ESMTP Postfix (Ubuntu)

12. MailScanner Razor Pyzor DCC Clamavのインストール

apt-get install mailscanner razor pyzor clamav-daemon

MailScannerから始めましょう。リポジトリからインストールされたMailScannerは非常に古いバージョンなので、これを削除し、ソースからMailScannerパッケージをインストールします。上記は依存関係のみをインストールするために行われます。

apt-get remove mailscanner

http://www.mailscanner.info/files/4/tar/MailScanner-install-4.75.11-1.tar.gzを/usr/src/mailscanner/にダウンロードし、次を実行します:

tar xvfz MailScanner-install-4.75.11-1.tar.gz  
cd MailScanner-install-4.75.11  
./install.sh

デフォルトのMailScannerを無効にします:

mv /etc/MailScanner /etc/MailScanner.dist
Share: X/Twitter LinkedIn

新しい投稿を受信箱で受け取る

スパムはありません。いつでも購読を解除できます。