Scanmail から Postfix への変更手順
はじめに
概要
本ページでは、2023年3月31日までSuitePRO V3が提供していた迷惑メールフィルタの機能を利用するためのメールソフトウェア「scanmail」を、標準の「postfix」に切り替える手順について案内しています。なお、本手順につきましては、すでに案内しているオンラインマニュアルの内容に沿って設定されていることを前提条件とします。
万一のためのバックアップについて
迷惑メールフィルタ機能はすでにサービス終了しているため、迷惑メールフィルタ付きOSのインストール含め、元の状態へ切り戻すことができません。
バックアップオプションをご契約のお客さまにつきましては、ディスクイメージごとの切り戻しが可能です。バックアップオプションのご利用方法、お申し込みにつきましてはこちらをご参照ください。
scanmailのインストール状況の確認
現在の環境で、scanmail がインストールされているかを確認します。
(1) 管理者(root)権限で仮想専用サーバーへSSH接続します。
(2) 現在インストールされているソフトウェアを確認します。
# rpm -q scanmail sbassdk
scanmail-4.10-8_sasl_auth_postfix
sbassdk-10.5-0
※この確認の結果、scanmailがインストールされていない旨が出力される場合、以降の作業を行う必要はありません。
事前作業
切り替える前のバックアップおよびリポジトリの設定
関連ファイルのバックアップを取得します。
(1) 関連ファイルのバックアップ
# mkdir -p /root/backup/ # cp -a /etc/postfix/ /root/backup/ # ls -l /root/backup/ ---------------------------------------------------------------------------------------------------------- drwxr-xr-x 3 root root 4096 Apr 7 10:40 postfix ----------------------------------------------------------------------------------------------------------
(2) リポジトリ設定の変更(※postfixをyumでインストールするための作業)
# cp -a /etc/yum.repos.d/CentOS-Base.repo /root/backup/ # vi /etc/yum.repos.d/CentOS-Base.repo
編集モードで開き、次のとおりコメントアウト、および参照先のURLを変更します。
<変更前>
---------------------------------------------------------------------------------------------------------- [base] name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
-------------------------------------------------------------------------------------------
<変更後>※赤字部分が変更点です
---------------------------------------------------------------------------------------------------------- [base] name=CentOS-$releasever - Base #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os baseurl=http://archive.kernel.org/centos-vault/5.11/os/$basearch/ gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 ----------------------------------------------------------------------------------------------------------
※「baseurl=」の値につきましては、すでに上述のURLになっていたり、別の有効なURLが設定されている場合、変更の必要はありません。
Scanmailのアンインストール
Scanmail および関連ソフトウェアのアンインストール
Scanmail および関連ソフトウェアをアンインストールします。
(1)管理者(root)権限で仮想専用サーバーへSSH接続します。
(2)postfix、scandb プログラムを停止します。
# /etc/init.d/postfix stop
# /etc/init.d/scandb stop
(3)Scanmail および関連ソフトウェアをアンインストールします。
下記のコマンドでScanmailソフトウェアをアンインストールしてください。
# rpm -e scanmail
fatal: the Postfix mail system is not running というエラーが出ますが、問題ありません。
※依存関係で scanmail をアンインストールできない場合は、強制的にアンインストールを実施してください。
# rpm -e --nodeps scanmail
次に、下記のコマンドでsbassdkソフトウェアをアンインストールしてください。
# rpm -e sbassdk
※依存関係で sbassdk をアンインストールできない場合は、強制的にアンインストールを実施してください。
# rpm -e --nodeps sbassdk
最後に、各ソフトウェアがアンインストールされている事を確認してください。
# rpm -q scanmail sbassdk
(インストールされていないと出力されれば、アンインストール成功です)
Postfixのインストール/設定/起動
-
Postfixのインストール
CentOS 5用のリポジトリからインストールします。
※最新版のpostfix をインストールする場合は、公式サイトからダウンロードしてインストールしてください。# yum clean all
インストールされていることを確認します。
# yum -y install postfix --disablerepo=* --enablerepo="base"
---------------------------------------------------------------------------------------------------------------------------------------------------- Loaded plugins: downloadonly, fastestmirror Loading mirror speeds from cached hostfile base | 1.1 kB 00:00 Excluding Packages in global exclude list Finished Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package postfix.x86_64 2:2.3.3-7.el5 set to be updated --> Finished Dependency Resolution Dependencies Resolved ========================================================================== Package Arch Version Repository Size ========================================================================== Installing: postfix x86_64 2:2.3.3-7.el5 base 3.8 M Transaction Summary ========================================================================== Install 1 Package(s) Upgrade 0 Package(s) Total download size: 3.8 M Downloading Packages: postfix-2.3.3-7.el5.x86_64.rpm | 3.8 MB 00:01 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing :postfix 1/1 warning: /etc/postfix/access created as /etc/postfix/access.rpmnew warning: /etc/postfix/canonical created as /etc/postfix/canonical.rpmnew warning: /etc/postfix/generic created as /etc/postfix/generic.rpmnew warning: /etc/postfix/header_checks created as /etc/postfix/header_checks.rpmnew warning: /etc/postfix/main.cf created as /etc/postfix/main.cf.rpmnew warning: /etc/postfix/makedefs.out created as /etc/postfix/makedefs.out.rpmnew warning: /etc/postfix/master.cf created as /etc/postfix/master.cf.rpmnew warning: /etc/postfix/relocated created as /etc/postfix/relocated.rpmnew warning: /etc/postfix/transport created as /etc/postfix/transport.rpmnew warning: /etc/postfix/virtual created as /etc/postfix/virtual.rpmnew Installed: postfix.x86_64 2:2.3.3-7.el5 Complete! ----------------------------------------------------------------------------------------------------------------------------------------------------
# rpm -q postfix
postfix-2.3.3-7.el5 -
Postfix の設定/起動
設定ファイルを編集します。ここでは特に編集をしなくてもメールサーバーとしての利用はできますが、お客さまの運用状況に合わせて適宜編集してください。詳しい内容につきましてはPostfixの構築Webページなどを参考に編集してください。
# cp -a /etc/postfix/main.cf /etc/postfix/main.cf.org
SMTP認証を実施している場合の設定ファイルの編集をします。
# vi /etc/postfix/main.cf
----------------------------------------------------------
….
---------------
ここでは、Cyrus SASL パスワードファイルを利用している場合の設定例を記載しています。
# cat /usr/lib64/sasl2/smtpd.conf
Postfixを起動します。
----------------------------------------------------------------
pwcheck_method: saslauthd
--------------
# cp -a /usr/lib64/sasl2/smtpd.conf /usr/lib64/sasl2/smtpd.conf.org
# vi /usr/lib64/sasl2/smtpd.conf
---------------------------------------------------------------
pwcheck_method: auxprop
----------------
# /etc/init.d/postfix start
必要に応じて、自動起動の設定をします。
Starting postfix: [ OK ]
# /etc/init.d/postfix status
master (pid 22442) is running...
# chkconfig --add postfix
※起動レベルを変更する場合は、 chkconfig --level コマンドで変更してください。
# chkconfig --list postfix
postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off
-
優先MTAの設定
(1)現在の優先MTAが postfix になっていることを確認します。
# alternatives --display mta
---------------------------------------------------------------
mta - status is manual.
link currently points to /usr/sbin/sendmail.postfix
----------------※コマンド名の末尾がpostfixになっていたら、「事後作業」の手順へお進みください。
(2)もしpostfix が選択されていない場合、設定を変更します。
# alternatives --config mta
※ここで、冒頭に「+」が付与されているものが現在優先MTAとして設定されている状態となります。
---------------------------------------------------------------
There are 2 programs which provide 'mta'.
Selection Command
-----------------------------------------------
*+ 1 /usr/sbin/sendmail.sendmail <<< + が付与されているものが現在選択されている
2 /usr/sbin/sendmail.postfix
(3)sendmail.postfix に割り当てらている番号を入力し、Enterキーを押下します。ここでは例として2 にsendmail.postfix が付与されているため、2を選択しています。
Enter to keep the current selection[+], or type selection number: 2
(4)再度確認コマンドを実行し、設定値を確認してください。
# alternatives --display mta
※コマンド名の末尾がpostfixになっていることを確認します。
---------------------------------------------------------------
mta - status is manual.
link currently points to /usr/sbin/sendmail.postfix
----------------(5)キュー一覧を表示するコマンドが正常に実行されることを確認します。
# mailq
---------------------------------------------------------------
<キュー一覧が表示されます>
----------------
事後作業
- 必要に応じて、リポジトリの設定ファイルを戻します。
- リポジトリ設定の切り戻し
# cp -a /root/backup/CentOS-Base.repo /etc/yum.repos.d/ # diff /root/backup/CentOS-Base.repo /etc/yum.repos.d/ ---------------------------------------------- (一致していれば問題ありません) ----------------------------------------------
以上にて作業は完了です。
本ディレクトリ配下に保存したファイルは、Postfixで問題なく運用できていることを確認でき次第、適宜削除しても問題ありません。
# rm -fr /root/backup/