メールシステムのバーチャルドメイン対応に合わせて、Webメール(SquirrelMail)もバーチャルドメイン対応にしました。SquirrelMailは、CentOSにRPMが用意されており、日本語パッチもあたっているのでそれを使用することにしました。
なお、バーチャルドメイン対応だけならプラグインの導入だけですが、squirrelmail 1.4.3a-9.EL4.centos4では、デフォルトのconfigがWU(University
of Washington's IMAP server)にあわせた設定になっており、Courier-IMAPではログイン後の左欄でエラーが発生して表示できないのでベース部分の設定変更が必要なので、メモとして残しておくことにします。
SquirrelMailには設定ツールが用意されているので、それを使用して順次設定していきます。ここでは、IMAPサーバとしてCourier-IMAPを使うことで記述してます。
- 以下によりツールを起動する。
# /usr/share/squirrelmail/config/conf.pl
- ツールが起動すると以下のような画面が表示されるので、まずはOrganization
Preferencesで基本的な設定を行うため、1を選択する。
SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Main Menu --
1. Organization Preferences
2. Server Settings
3. Folder Defaults
4. General Options
5. Themes
6. Address Books (LDAP)
7. Message of the Day (MOTD)
8. Plugins
9. Database
D. Set pre-defined settings for specific IMAP servers
C. Turn color on
S Save data
Q Quit
Command >> 1[Enter]
- CentOSの場合、起動しても下記のようにパラメータが見えないので、カラー切り替えのため「C」を入力してEnterする。(入力してもエコーは見えないのでそのままEnterすること。)
: Read: config_default.php (1.4.0)
---------------------------------------------------------
Organization Preferences
1. Organization Name :
2. Organization Logo :
3. Org. Logo Width/Height :
4. Organization Title :
5. Signout Page :
6. Default Language :
7. Top Frame :
8. Provider link :
9. Provider name
:
R Return to Main Menu
C. Turn color off
S Save data
Q Quit
Command >> C[Enter] ← 実際には見えない。
- 1を選択すると、下記のような画面が表示されるので、以下の設定をして最後に r でメインメニューに戻る。
- Signout Pageを選択(5を選択)して、ログアウト時にログイン画面に戻るように設定。
- Default Languageを選択(6を選択)し、ja_JPに変更。
SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Organization Preferences
1. Organization Name : SquirrelMail
2. Organization Logo : ../images/sm_logo.png
3. Org. Logo Width/Height : (308/111)
4. Organization Title : SquirrelMail $version
5. Signout Page :
6. Default Language : en_US
7. Top Frame : _top
8. Provider link : http://www.squirrelmail.org/
9. Provider name
: SquirrelMail
R Return to Main Menu
C. Turn color on
S Save data
Q Quit
Command >> 5[Enter]
When users click the Sign Out button they will be logged out and
then sent to signout_page. If signout_page is left empty,
(hit space and then return) they will be taken, as normal,
to the default and rather sparse SquirrelMail signout page.
[]: ./[Enter]
SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Organization Preferences
1. Organization Name : SquirrelMail
2. Organization Logo : ../images/sm_logo.png
3. Org. Logo Width/Height : (308/111)
4. Organization Title : SquirrelMail $version
5. Signout Page
: ./
6. Default Language : en_US
7. Top Frame : _top
8. Provider link : http://www.squirrelmail.org/
9. Provider name
: SquirrelMail
R Return to Main Menu
C. Turn color on
S Save data
Q Quit
Command >> 6[Enter]
SquirrelMail attempts to set the language in many ways. If it
can not figure it out in another way, it will default to this
language. Please use the code for the desired language.
[en_US]: ja_JP[Enter]
SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Organization Preferences
1. Organization Name : SquirrelMail
2. Organization Logo : ../images/sm_logo.png
3. Org. Logo Width/Height : (308/111)
4. Organization Title : SquirrelMail $version
5. Signout Page
: ./
6. Default Language : ja_JP
7. Top Frame : _top
8. Provider link : http://www.squirrelmail.org/
9. Provider name
: SquirrelMail
R Return to Main Menu
C. Turn color on
S Save data
Q Quit
Command >> r[Enter]
- 同様に以降も設定していく。メインメニューのServer Settings(2を選択)で、ドメイン名とSMTPの変更およびIMAPサーバ(デフォルトはwu)の設定を行う。
SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Server Settings
General
-------
1. Domain : mydomain.com
2. Invert Time : false
3. Sendmail or SMTP : Sendmail
A. Update IMAP Settings : localhost:143 (uw)
B. Change Sendmail Config : /usr/sbin/sendmail
R Return to Main Menu
C. Turn color on
S Save data
Q Quit
Command >> 1[Enter]
The domain name is the suffix at the end of all email addresses. If
for example, your email address is jdoe@myorg.com, then your domain
would be myorg.com.
[mydomain.com]: mail.aconus.com[Enter]
SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Server Settings
General
-------
1. Domain
: mail.aconus.com
2. Invert Time : false
3. Sendmail or SMTP : Sendmail
A. Update IMAP Settings : localhost:143 (wu)
B. Change Sendmail Config : /usr/sbin/sendmail
R Return to Main Menu
C. Turn color on
S Save data
Q Quit
Command >> 3[Enter]
You now need to choose the method that you will use for sending
messages in SquirrelMail. You can either connect to an SMTP server
or use sendmail directly.
1. Sendmail
2. SMTP
Your choice [1/2] [1]: 2[Enter]
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings
General
-------
1. Domain : mail.aconus.com
2. Invert Time : false
3. Sendmail or SMTP : SMTP
A. Update IMAP Settings : localhost:143 (wu)
B. Update SMTP Settings : localhost:25
R Return to Main Menu
C. Turn color on
S Save data
Q Quit
Command >> a[Enter]
SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Server Settings
General
-------
1. Domain
: mail.aconus.com
2. Invert Time : false
3. Sendmail or SMTP : SMTP
IMAP Settings
--------------
4. IMAP Server : localhost
5. IMAP Port : 143
6. Authentication type : login
7. Secure IMAP (TLS) : false
8. Server software : wu
9. Delimiter : detect
B. Update SMTP Settings : localhost:25
H. Hide IMAP Server Settings
R Return to Main Menu
C. Turn color on
S Save data
Q Quit
Command >> 8[Enter]
Each IMAP server has its own quirks. As much as we tried to stick
to standards, it doesn't help much if the IMAP server doesn't follow
the same principles. We have made some work-arounds for some of
these servers. If you would like to use them, please select your
IMAP server. If you do not wish to use these work-arounds, you can
set this to "other", and none will be used.
cyrus = Cyrus IMAP server
uw = University of Washington's IMAP server
exchange = Microsoft Exchange IMAP server
courier = Courier IMAP server
macosx = Mac OS X Mailserver
other = Not one of the above servers
[wu]: courier[Enter]
SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Server Settings
General
-------
1. Domain : www.aconus.com
2. Invert Time : false
3. Sendmail or SMTP : SMTP
IMAP Settings
--------------
4. IMAP Server : localhost
5. IMAP Port : 143
6. Authentication type : login
7. Secure IMAP (TLS) : false
8. Server software : courier
9. Delimiter : detect
B. Update SMTP Settings : localhost:25
H. Hide IMAP Server Settings
R Return to Main Menu
C. Turn color on
S Save data
Q Quit
Command >> r[Enter]
- メインメニューのFolder Defaults(3を選択)で、UW用のフォルダ設定をCourier-IMAP用に変更する。
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Folder Defaults
1. Default Folder Prefix : mail/
2. Show Folder Prefix Option : true
3. Trash Folder
: Trash
4. Sent Folder
: Sent
5. Drafts Folder
: Drafts
6. By default, move to trash : true
7. By default, move to sent : true
8. By default, save as draft : true
9. List Special Folders First : true
10. Show Special Folders Color : true
11. Auto Expunge
: true
12. Default Sub. of INBOX : false
13. Show 'Contain Sub.' Option : true
14. Default Unseen Notify : 2
15. Default Unseen Type : 1
16. Auto Create Special Folders : true
17. Folder Delete Bypasses Trash : false
18. Enable /NoSelect folder fix : false
R Return to Main Menu
C. Turn color on
S Save data
Q Quit
Command >> 1[Enter]
Some IMAP servers (UW, for example) store mail and folders in
your user space in a separate subdirectory. This is where you
specify what that directory is.
EXAMPLE: mail/
NOTE: If you use Cyrus, or some server that would not use this
option, you must set this to 'none'.
[mail/]: none[Enter]
*************** ( snip ) ***************
Command >> 2[Enter]
It is possible to set up the default folder prefix as a user
specific option, where each user can specify what their mail
folder is. If you set this to false, they will never see the
option, but if it is true, this option will appear in the
'options' section.
NOTE: You set the default folder prefix in option '1' of this
section. That will be the default if the user
doesn't
specify anything different.
Show option (y/n) [y]: n[Enter]
*************** ( snip ) ***************
Command >> 3[Enter]
You can now specify where the default trash folder is located.
On servers where you do not want this, you can set it to anything
and set option 6 to false.
This is relative to where the rest of your email is kept. You do
not need to worry about their mail directory. If this folder
would be ~/mail/trash on the filesystem, you only need to specify
that this is 'trash', and be sure to put 'mail/' in option 1.
[Trash]: INBOX.Trash[Enter]
*************** ( snip ) ***************
Command >> 4[Enter]
This is where messages that are sent will be stored. SquirrelMail
by default puts a copy of all outgoing messages in this folder.
This is relative to where the rest of your email is kept. You do
not need to worry about their mail directory. If this folder
would be ~/mail/sent on the filesystem, you only need to specify
that this is 'sent', and be sure to put 'mail/' in option 1.
[Sent]: INBOX.Sent[Enter]
*************** ( snip ) ***************
Command >> 5[Enter]
You can now specify where the default draft folder is located.
On servers where you do not want this, you can set it to anything
and set option 9 to false.
This is relative to where the rest of your email is kept. You do
not need to worry about their mail directory. If this folder
would be ~/mail/drafts on the filesystem, you only need to specify
that this is 'drafts', and be sure to put 'mail/' in option 1.
[Drafts]: INBOX.Drafts[Enter]
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Folder Defaults
1. Default Folder Prefix :
2. Show Folder Prefix Option : false
3. Trash Folder
: INBOX.Trash
4. Sent Folder
: INBOX.Sent
5. Drafts Folder
: INBOX.Drafts
6. By default, move to trash : true
7. By default, move to sent : true
8. By default, save as draft : true
9. List Special Folders First : true
10. Show Special Folders Color : true
11. Auto Expunge
: true
12. Default Sub. of INBOX : false
13. Show 'Contain Sub.' Option : true
14. Default Unseen Notify : 2
15. Default Unseen Type : 1
16. Auto Create Special Folders : true
17. Folder Delete Bypasses Trash : false
18. Enable /NoSelect folder fix : false
R Return to Main Menu
C. Turn color on
S Save data
Q Quit
Command >> r[Enter]
- メインメニューのGeneral Options(4を選択)で、Default Charsetの変更(iso-8859-1 -> iso-2022-jp)を行う。
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
General Options
1. Default Charset :
iso-8859-1
2. Data Directory :
/var/lib/squirrelmail/prefs/
3. Attachment Directory : /var/spool/squirrelmail/attach/
4. Directory Hash Level : 0
5. Default Left Size : 150
6. Usernames in Lowercase : false
7. Allow use of priority : true
8. Hide SM attributions : false
9. Allow use of receipts : true
10. Allow editing of identity : true/true
11. Allow server thread sort : true
12. Allow server-side sorting : true
13. Allow server charset search : true
14. Enable UID support : true
15. PHP session name : SQMSESSID
R Return to Main Menu
C. Turn color on
S Save data
Q Quit
Command >> 1[Enter]
This option controls what character set is used when sending
mail and when sending HTML to the browser. Do not set this
to US-ASCII, use ISO-8859-1 instead. For cyrillic, it is best
to use KOI8-R, since this implementation is faster than most
of the alternatives
[iso-8859-1]: iso-2022-jp[Enter]
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
General Options
1. Default Charset :
iso-8859-1
2. Data Directory :
/var/lib/squirrelmail/prefs/
3. Attachment Directory : /var/spool/squirrelmail/attach/
4. Directory Hash Level : 0
5. Default Left Size : 150
6. Usernames in Lowercase : false
7. Allow use of priority : true
8. Hide SM attributions : false
9. Allow use of receipts : true
10. Allow editing of identity : true/true
11. Allow server thread sort : true
12. Allow server-side sorting : true
13. Allow server charset search : true
14. Enable UID support : true
15. PHP session name : SQMSESSID
R Return to Main Menu
C. Turn color on
S Save data
Q Quit
Command >> r[Enter]
- メインメニューのPulugins(8を選択)で、Virtual Hostsプラグインを組み込む。
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Plugins
Installed Plugins
1. delete_move_next
2. squirrelspell
3. newmail
Available Plugins:
4. filters
5. message_details
6. abook_take
7. calendar
8. administrator
9. translate
10. virtual_hosts
11. sent_subfolders
12. bug_report
13. mail_fetch
14. listcommands
15. info
16. spamcop
17. fortune
R Return to Main Menu
C. Turn color on
S Save data
Q Quit
Command >> 10[Enter]
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Plugins
Installed Plugins
1. delete_move_next
2. squirrelspell
3. newmail
4. virtual_hosts
Available Plugins:
5. filters
6. message_details
7. abook_take
8. calendar
9. administrator
10. translate
11. sent_subfolders
12. bug_report
13. mail_fetch
14. listcommands
15. info
16. spamcop
17. fortune
R Return to Main Menu
C. Turn color on
S Save data
Q Quit
Command >> r[Enter]
- 最後にデータをセーブ(sを入力)し、qを入力してconfigureは終了。
後はブラウザから、
http://www.aconus.com/webmail/
と起動し、imapサーバのユーザとパスワードでログインできればおしまいです。特に難しいことも無く動作し、文字化け等もないようです。
なお、アクセスを「webmail」から変更したい場合は、Apacheの/etc/httpd/conf.d/squirrelmail.conf
を下記のように編集することで変更(ex. webmail → squirrelmail)できます。
#Alias /webmail /usr/share/squirrelmail
Alias /squirrelmail /usr/share/squirrelmail
外部からアクセスするのに生では危険なので、httpでアクセスしてきたらhttpsにredirectするようにしました。当然のこととしてhttpsに対応していなければなりませんが、対処方法としては以下の3点ぐらいがあると思います。