1,484 views


■概要

Gmail、Hotmail、Yahoo!メール、そしてレンタルサーバーに来るメールすべてを自宅のメールサーバーで一覧、確認できるようにしています。使っているのはWebブラウザ上でメールができるWebmailシステムSquirrelMailです。

Webサーバーリポジトリの追加(RPMforge、EPEL)Webサーバー間通信内容暗号化メールサーバー(要IMAP)が構築済であること

■SquirrelMailのインストール

[root@ufuso ~]# wget http://sourceforge.net/projects/squirrelmail/files/stable/1.4.22/squirrelmail-webmail-1.4.22.tar.bz2
 ← SquirrelMailダウンロード※最新版のURLはダウンロードページで確認すること

`squirrelmail-webmail-1.4.22.tar.bz2' に保存中

100%[======================================>] 531,360      581K/s 時間 0.9s    

2012-03-28 16:42:44 (581 KB/s) - `squirrelmail-webmail-1.4.22.tar.bz2' へ保存完了 [531360/531360]

[root@ufuso ~]# tar jxvf squirrelmail-webmail-1.4.22.tar.bz2 ← SquirrelMail展開
squirrelmail-webmail-1.4.22/
・・・
・・・
squirrelmail-webmail-1.4.22/help/.htaccess

[root@ufuso ~]# mv squirrelmail-webmail-1.4.22 /var/www/webmail ← SquirrelMail展開先ディレクトリをリネーム移動

[root@ufuso ~]# rm -f squirrelmail-webmail-1.4.22.tar.bz2 ← ダウンロードしたSquirrelMailを削除

[root@ufuso ~]# mkdir -p work ; cd work ← ワークディレクトリ作成&カレントディレクトリ移動

[root@ufuso work]# wget http://jaist.dl.sourceforge.net/sourceforge/squirrelmail/ja_JP-1.4.18-20090526.tar.bz2 ← localeダウンロード

`ja_JP-1.4.18-20090526.tar.bz2' に保存中

100%[======================================>] 89,953       195K/s 時間 0.5s    

2012-03-28 16:45:18 (195 KB/s) - `ja_JP-1.4.18-20090526.tar.bz2' へ保存完了 [89953/89953]

[root@ufuso work]# tar jxvf ja_JP-1.4.18-20090526.tar.bz2 ← locale展開
locale/ja_JP/LC_MESSAGES/archive_mail.po
・・・
・・・
help/ja_JP/search.hlp

[root@ufuso work]# ./install ← localeインストール
Please enter path to your squirrelmail installation:/var/www/webmail ← SquirrelMailインストール先を入力

[root@ufuso work]# cd ← ホームディレクトリへ戻る

[root@ufuso ~]# rm -fr work ← locale展開先ディレクトリを削除

[root@ufuso ~]# cd /var/www/webmail/po/ ← ディレクトリ移動

[root@ufuso po]# ./compilepo ja_JP ← squirrelmail.poファイル作成
Compiling ../locale/ja_JP/LC_MESSAGES/squirrelmail.po

[root@ufuso work]# cd ← ホームディレクトリへ戻る

[root@ufuso ~]# chmod 730 /var/www/webmail/data/ ← dataディレクトリのパーミッション変更

[root@ufuso ~]# chown -R apache:apache /var/www/webmail/data/ ← dataディレクトリの所有者変更

[root@ufuso ~]# vi /var/www/webmail/functions/i18n.php ← i18n.phpファイルの編集
        case 'decodeheader':
            $ret = str_replace("t", "", $ret);
            if (preg_match('/=?([^?]+)?(q|b)?([^?]+)?=/i', $ret))
                $ret = @mb_decode_mimeheader($ret);
            //$ret = @mb_convert_encoding($ret, 'EUC-JP', 'AUTO'); ← 行頭に//を入れて無効化
            $ret = @mb_convert_encoding($ret, 'EUC-JP', 'ASCII,JIS,EUC-JP,UTF-8,SJIS'); ← 追加(差出人文字化け対処)
            break;
        case 'downloadfilename':
            $useragent = func_get_arg(2);
            if (strstr($useragent, 'Windows') !== false ||
                strstr($useragent, 'Mac_') !== false) {
                //$ret = mb_convert_encoding($ret, 'SJIS', 'AUTO'); ← 行頭に//を入れて無効化
                $ret = mb_convert_encoding($ret, 'UTF-8', 'AUTO'); ← 追加(添付ファイル名文字化け対処)
            } else {
                $ret = mb_convert_encoding($ret, 'EUC-JP', 'AUTO');
}
            break;

■SquirrelMailの設定

[root@ufuso ~]# /var/www/webmail/config/conf.pl ← 設定
SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
・・・
10. Languages
・・・
Q   Quit

Command >> 10 ← Languagesを選択

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Language preferences
1.  Default Language       : en_US
2.  Default Charset        : iso-8859-1
3.  Enable lossy encoding  : false

R   Return to Main Menu
C   Turn color on
S   Save data
Q   Quit

Command >> 1 ← Default Languageを選択

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

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Language preferences
1.  Default Language       : ja_JP
2.  Default Charset        : iso-8859-1
3.  Enable lossy encoding  : false

R   Return to Main Menu
C   Turn color on
S   Save data
Q   Quit

Command >>2 ← Default Charsetを選択

This option controls what character set is used when sending
mail and when sending HTML to the browser.

This option is used only when default language is 'en_US'.

[iso-8859-1]: iso-2022-jp

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Language preferences
1.  Default Language       : ja_JP
2.  Default Charset        : iso-2022-jp
3.  Enable lossy encoding  : false

R   Return to Main Menu
C   Turn color on
S   Save data
Q   Quit

Command >> r ← メニューに戻る

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
・・・
・・・
Q   Quit

Command >>1 ← Organization Preferencesを選択

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Organization Preferences
1.  Organization Name      : SquirrelMail
・・・
5.  Signout Page           :
・・・
Q   Quit

Command >>5 ← Signout Pageを選択

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.

[]: /webmail

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           : /webmail
6.  Top Frame              : _top
7.  Provider link          : http://squirrelmail.org/
8.  Provider name          : SquirrelMail

R   Return to Main Menu
C   Turn color on
S   Save data
Q   Quit

Command >> r ← メニューに戻る

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
2.  Server Settings
・・・
・・・
Q   Quit

Command >>2 ← Server Settingsを選択

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Server Settings

General
-------
1.  Domain                 : example.com
2.  Invert Time            : false
3.  Sendmail or SMTP       : SMTP

A.  Update IMAP Settings   : localhost:143 (other)
B.  Update SMTP Settings   : localhost:25

R   Return to Main Menu
C   Turn color on
S   Save data
Q   Quit

Command >>1 ←  Domainを選択

The domain name is the suffix at the end of all email addresses.  If
for example, your email address is jdoe@example.com, then your domain
would be example.com.

[example.com]: ufuso.dip.jp ←  メールサーバーのDomainを入力

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Server Settings

General
-------
1.  Domain                 : ufuso.dip.jp
・・・
・・・
Q   Quit

Command >> r ← メニューに戻る

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
・・・
4.  General Options
・・・
Q   Quit

Command >>4 ←  General Optionsを選択

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
General Options
1.  Data Directory               : /var/local/squirrelmail/data/
・・・
7.  Hide SM attributions         : false
・・・
Q   Quit

Command >>7 ←  Hide SM attributionsを選択

Hide SM attributions (y/n) [n]: y

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
General Options
1.  Data Directory               : /var/local/squirrelmail/data/
・・・
7.  Hide SM attributions         : true
・・・
Q   Quit

Command >>1 ← Data Directoryを選択

Specify the location for your data directory.
The path name can be absolute or relative (to the config directory).
You probably need to create this directory yourself. Here are two examples:
  Absolute:    /var/local/squirrelmail/data/
  Relative:    ../data/
Relative paths to directories outside of the SquirrelMail distribution
will be converted to their absolute path equivalents in config.php.

Note: There are potential security risks with having a writable directory
under the web server's root directory (ex: /home/httpd/html).
For this reason, it is recommended to put the data directory
in an alternate location of your choice. 

[/var/local/squirrelmail/data/]: ../data/

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
General Options
1.  Data Directory               : ../data/
2.  Attachment Directory         : /var/local/squirrelmail/attach/
・・・
7.  Hide SM attributions         : true
・・・
Q   Quit

Command >>2 ← Attachment Directoryを選択

Path to directory used for storing attachments while a mail is
being sent. The path name can be absolute or relative (to the config directory).
It doesn't matter.  Here are two examples:
  Absolute:    /var/spool/squirrelmail/attach/
  Relative:    ../attach/
Relative paths to directories outside of the SquirrelMail distribution
will be converted to their absolute path equivalents in config.php.

Note:  There are a few security considerations regarding this
directory:
  1.  It should have the permission 733 (rwx-wx-wx) to make it
      impossible for a random person with access to the webserver
      to list files in this directory.  Confidential data might
      be laying around in there.
      Depending on your user:group assignments, 730 (rwx-wx---)
      may be possible, and more secure (e.g. root:apache)
  2.  Since the webserver is not able to list the files in the
      content is also impossible for the webserver to delete files
      lying around there for too long.
  3.  It should probably be another directory than the data
      directory specified in option 3.

[/var/local/squirrelmail/attach/]: $data_dir

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
General Options
1.  Data Directory               : ../data/
2.  Attachment Directory         : $data_dir/
・・・
7.  Hide SM attributions         : true
・・・
16. Only secure cookies if poss. : true
・・・
Q   Quit

Command >>16 ← Attachment Directoryを選択

This option allows you to specify that if a user session is initiated
under a secure (HTTPS, SSL-encrypted) connection, the cookies given to
the browser will ONLY be transmitted via a secure connection henceforth.

Generally this is a Good Thing, and should NOT be disabled.  However,
if you intend to use the Secure Login or Show SSL Link plugins to
encrypt the user login, but not the rest of the SquirrelMail session,
this can be turned off.  Think twice before doing so.

Transmit cookies only on secure connection when available? (y/n) [y]: n

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
General Options
1.  Data Directory               : ../data/
2.  Attachment Directory         : $data_dir/
・・・
Q   Quit

Command >> r ← メニューに戻る

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
・・・
Q   Quit

Command >>3 ← Folder Defaultsを選択

SquirrelMail Configuration : Read: config_default.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
・・・
Q   Quit

Command >>3 ← Trash Folderを選択

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.

[INBOX.Trash]: Trash

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Folder Defaults
1.  Default Folder Prefix          :
2.  Show Folder Prefix Option      : false
3.  Trash Folder                   : Trash
4.  Sent Folder                    : INBOX.Sent
5.  Drafts Folder                  : INBOX.Drafts
・・・
Q   Quit

Command >>4 ← Sent Folderを選択

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.

[INBOX.Sent]: Sent

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Folder Defaults
1.  Default Folder Prefix          :
2.  Show Folder Prefix Option      : false
3.  Trash Folder                   : Trash
4.  Sent Folder                    : Sent
5.  Drafts Folder                  : INBOX.Drafts
・・・
Q   Quit

Command >>5 ← Drafts Folderを選択

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.

[INBOX.Drafts]: Drafts

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Folder Defaults
1.  Default Folder Prefix          :
2.  Show Folder Prefix Option      : false
3.  Trash Folder                   : Trash
4.  Sent Folder                    : Sent
5.  Drafts Folder                  : Drafts
・・・
Q   Quit

Command >> q ← 設定スクリプト終了

You have not saved your data.
Save?  [Y/n]: y ← 設定保存
Data saved in config.php

Exiting conf.pl.
You might want to test your configuration by browsing to

http://your-squirrelmail-location/src/configtest.php

Happy SquirrelMailing!

■SquirrelMail必須プラグインのインストール

[root@ufuso ~]#  wget http://www.squirrelmail.org/countdl.php?fileurl=http%3A%2F%2Fwww.squirrelmail.org%2Fplugins%2Fcompatibility-2.0.16-1.0.tar.gz
 ← compatibilityプラグインダウンロード※最新版のURLはダウンロードページで確認すること
`compatibility-2.0.16-1.0.tar.gz' に保存中

100%[======================================>] 41,497      47.6K/s 時間 0.9s    

2012-03-28 16:56:40 (47.6 KB/s) - `compatibility-2.0.16-1.0.tar.gz' へ保存完了 [41497/41497]

[root@ufuso ~]# tar zxvf compatibility-2.0.16-1.0.tar.gz
 ← compatibilityプラグイン展開
compatibility/
・・・
・・・
compatibility/includes/1.4.10/index.php

[root@ufuso ~]# mv compatibility /var/www/webmail/plugins/
 ← compatibilityプラグイン移動

[root@ufuso ~]# rm -f compatibility-2.0.16-1.0.tar.gz
 ← ダウンロードしたファイルを削除

[root@ufuso ~]# wget http://www.squirrelmail.org/countdl.php?fileurl=http%3A%2F%2Fwww.squirrelmail.org%2Fplugins%2Fsecure_login-1.4-1.2.8.tar.gz
 ← secure_loginプラグインダウンロード※最新版のURLはダウンロードページで確認すること
`secure_login-1.4-1.2.8.tar.gz' に保存中

100%[======================================>] 16,993      28.8K/s 時間 0.6s    

2012-03-28 16:57:24 (28.8 KB/s) - `secure_login-1.4-1.2.8.tar.gz' へ保存完了 [16993/16993]

[root@ufuso ~]# tar zxvf secure_login-1.4-1.2.8.tar.gz
 ← secure_loginプラグイン展開
secure_login/
・・・
・・・
secure_login/make_release.sh

[root@ufuso ~]# mv secure_login /var/www/webmail/plugins/
 ← secure_loginプラグイン移動

[root@ufuso ~]#  rm -f secure_login-1.4-1.2.8.tar.gz
 ← ダウンロードしたファイルを削除

[root@ufuso ~]# cd /var/www/webmail/plugins/secure_login/
 ← secure_loginプラグインディレクトリへ移動

[root@ufuso secure_login]#  cp config.sample.php config.php
 ← 設定ファイル作成

[root@ufuso secure_login]# vi config.php
 ← 設定ファイル編集
   $change_back_to_http_after_login = 0; ← 0へ変更(ログイン後もSSL通信を継続)

[root@ufuso secure_login]# /var/www/webmail/config/conf.pl
 ← SquirrelMail設定スクリプト実行

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages

D.  Set pre-defined settings for specific IMAP servers

C   Turn color on
S   Save data
Q   Quit

Command >>8 ← Pluginsを選択

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Plugins
  Installed Plugins

  Available Plugins:
    1. administrator
    2. bug_report
    3. calendar
    4. compatibility
    5. delete_move_next
    6. demo
    7. filters
    8. fortune
    9. info
    10. listcommands
    11. mail_fetch
    12. message_details
    13. newmail
    14. secure_login
    15. sent_subfolders
    16. spamcop
    17. squirrelspell
    18. test
    19. translate

R   Return to Main Menu
C   Turn color on
S   Save data
Q   Quit

Command >>4 ← compatibilityを選択

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Plugins
  Installed Plugins
    1. compatibility

  Available Plugins:
    2. administrator
    3. bug_report
    4. calendar
    5. delete_move_next
    6. demo
    7. filters
    8. fortune
    9. info
    10. listcommands
    11. mail_fetch
    12. message_details
    13. newmail
    14. secure_login
    15. sent_subfolders
    16. spamcop
    17. squirrelspell
    18. test
    19. translate

R   Return to Main Menu
C   Turn color on
S   Save data
Q   Quit

Command >>14 ← secure_loginを選択

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Plugins
  Installed Plugins
    1. compatibility
    2. secure_login

  Available Plugins:
    3. administrator
    4. bug_report
    5. calendar
    6. delete_move_next
    7. demo
    8. filters
    9. fortune
    10. info
    11. listcommands
    12. mail_fetch
    13. message_details
    14. newmail
    15. sent_subfolders
    16. spamcop
    17. squirrelspell
    18. test
    19. translate

R   Return to Main Menu
C   Turn color on
S   Save data
Q   Quit

Command >> q ← 設定スクリプト終了

You have not saved your data.
Save?  [Y/n]: y ← 設定保存
Data saved in config.php

Exiting conf.pl.
You might want to test your configuration by browsing to

http://your-squirrelmail-location/src/configtest.php

Happy SquirrelMailing!

[root@ufuso secure_login]# /etc/rc.d/init.d/postfix reload
 ← postfix の再起動
postfix を再読み込み中:                                    [  OK  ]

[root@ufuso secure_login]# vi /etc/httpd/conf.d/webmail.conf ← quirrelMail用Apache設定ファイル作成
Alias /webmail /var/www/webmail
<Directory /var/www/webmail>
    AllowOverride Limit
    Allow from all ← 外部からのアクセスも許可
</Directory>

[root@ufuso secure_login]#  /etc/rc.d/init.d/httpd reload ← httpd の再起動
httpd を再読み込み中:

■SquirrelMail確認

http://サーバー名/webmail/にアクセスしてSquirrelMailログインページが表示されることを確認。

また、URLがhttps://サーバー名/webmail/src/login.php?secure_login=yesとなっていることを確認。

※ログイン名にはScientific Linux6.1のユーザー名、(例:ufuso)、パスワードにはユーザーパスワードを入力する。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA


このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください