新手指南新手指南   版內搜尋版內搜尋   會員註冊會員註冊 
好玩遊戲 加盟 小遊戲 遊戲區
遊戲天堂 民宿 遊戲王國 心理測驗

[教學][轉載] Mail Server 相關設定方法

 
   分享火力 首頁 » 科技 » C.電腦技術 » 作業系統 » [教學][轉載] Mail Server 相關設定方法
發表文章回覆文章友善列印轉寄給友人 上一篇主題下一篇主題
some
?Q???j???????D離線


火力站長 性別:男 血型:A 星座:牡羊
火力站長
等級: 39
技能點: 14
屬性: Archmage
327 / 4676
2232 / 2232
133 / 160

文章: 2434
人氣: 349.56
火力幣: 57767
註冊時間: 2003-10-18
來自: Star(*)
引言回覆
發表文章主題: [教學][轉載] Mail Server 相關設定方法
發表發表於: 2003-10-25 08:11

本文作者: 楊錦昌
轉載來源: http://163.19.59.1/


Sendmail

  1. 原始網址:http://www.sendmail.org/
  2. 下載: ftp://ftp.sendmail.org/pub/sendmail/
    http://www.sendmail.org/ftp/
    ftp://ftp.nctu.edu.tw/network/mail/sendmail/(Taiwan mirror)
    ftp://ftp.chu.edu.tw/mirror/ftp.sendmail.org/(Taiwan mirror)

  3. sendmail 設定(外寄郵件設定)
  4. POP、IMAP 設定(內送郵件設定)
  5. Open Webmail 安裝
  6. FAQ




sendmail 設定(外寄郵件設定)
要安裝的 rpm

sendmail //預設已經裝了
sendmail-cf //修改 sendmail.cf 時用的到
cyrus-sasl //Cyrus SASL 函式庫,外寄郵件伺服器驗證用的到
m4 //由 sendmail.mc 產生 sendmail.cf 時用的到 m4 這個巨集處理器
安裝:apt-get install sendmail sendmail-cf cyrus-sasl m4

設定:

代碼:
vi /etc/mail/sendmail.mc
dnl TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
...........................................
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')




找到上面三行,將前兩行前面的 dnl 去掉,第三行則將 127.0.0.1 改成 0.0.0.0 如下所示:

代碼:
TRUST_AUTH_MECH(`DIGEST-MD5 CRAM-MD5 LOGIN PLAIN') dnl
define(`confAUTH_MECHANISMS', `DIGEST-MD5 CRAM-MD5 LOGIN PLAIN') dnl

DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')




前面兩行,會啟動 smtp 的認證功能
第三行會開放 smtp 的服務範圍,因為預設只對本機(127.0.0.1)做服務
把這行 mark 起來也可以的,就是在前面加上 dnl

使用 m4 產生新的 sendmail 設定檔:
cp /etc/mail/sendmail.cf /etc/mail/sendmail.cf.bak
(先備份)

m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
(產生新的 sendmail.cf)


重新啟動 sendmail:
代碼:
/etc/rc.d/init.d/sendmail restart


(如此這台 郵件主機就具有 smtp 身份認證的功能了)


開機就啟動服務:【setup】-->【System services】-->點選【sendmail】,啟動服務


測試
代碼:
# telnet vcd.sqes.hcc.edu.tw 25
Trying 163.19.59.5...
Connected to vcd.sqes.hcc.edu.tw.
Escape character is '^]'.
220 vcd.sqes.hcc.edu.tw ESMTP Sendmail 8.12.5/8.12.5; Wed, 19 Feb 2003 02:01:37 +0800

(出現這行就成功了)



設定服務範圍(relay 設定,就是設定誰可以使用這項服務的意思)
vi /etc/mail/access,加上紅字部分
localhost.localdomain RELAY
localhost RELAY
127.0.0.1 RELAY
sqes.hcc.edu.tw RELAY
163.19.59 RELAY
#設定 163.19.59.0 這個 Class C 的 IP,可以使用這台機器來寄信

代碼:
makemap hash /etc/mail/access < /etc/mail/access

(修改完之後記得用這個指令將 access 轉成 access.db)


POP 、IMAP設定(內送郵件設定)
我們要透過 Outlook Express 或 網頁 方式收信(如:Open Webmail、NeoMail........)需要用到 POP 和 IMAP 這兩種網路電子郵件協定,而 imap 這軟體就有支援這兩種協定
POP = Post Office Protocol
IMAP = Internet Message Access Protocol


安裝:apt-get install imap
(若之前沒有安裝 xinetd 的話,這個動作會順便安裝 xinetd)

開機就啟動服務:【setup】-->【System services】-->點選【imap】、【ipop3】、【xinetd】

重新啟動服務:
代碼:
/etc/rc.d/init.d/xinetd restart


測試:

代碼:
# telnet vcd.sqes.hcc.edu.tw 110
Trying 163.19.59.5...
Connected to vcd.sqes.hcc.edu.tw.
Escape character is '^]'.
+OK POP3 vcd.sqes.hcc.edu.tw v2001.78rh server ready


出現這行就成功了






Open Webmail 安裝(以 rpm 方式安裝)
Open Webmail 是由成大修改自 Neomail version 1.14 的一套網頁郵件系統(直接透過網頁就可以收發信) ,可是青出於藍,現在已經發展成一套活躍於國際的軟體,基於愛用愛用國貨的心態,我一直是它的愛用者:)
官方網站:http://openwebmail.org/
說明:http://turtle.ee.ncku.edu.tw/~tung/openwebmail/

下載:
到以下網址下載 per-suidper(Red Hat Linux 8.0 有這個 rpm)、per-Text-Iconv、openwebmail 三個 rpm 檔

http://openwebmail.com/openwebmail/download/redhat/rpm/release/
(最新版下載就對了)
http://openwebmail.org/openwebmail/download/redhat/rpm/packages/rh80/perl-suidperl-5.8.0-55.i386.rpm
http://openwebmail.org/openwebmail/download/redhat/rpm/packages/rh80/perl-Text-Iconv-1.2-RH80.i386.rpm

Arrow 安裝:

rpm -ivh perl-suidperl
rpm -ivh perl-Text-Iconv
rpm -ivh openwebmail-xxxxx.i386.rpm
apt-get install perl-CGI(Red Hat Linux 8.0 有這個 rpm,它會為 perl 裝上 CGI 模組)
修改:vi /var/www/cgi-bin/openwebmail/etc/openwebmail.conf

代碼:
dbmopen_ext none --> dbmopen_ext %dbm_ext%
default_language en --> default_language zh_TW.Big5
default_iconset Cool3D.English --> default_iconset Cool3D.Chinese.Traditional

在最後面加入這兩行,取消 網路硬碟、ssh 終端機、更改密碼 功能(視自己需求開放吧!)
代碼:
enable_webdisk no
enable_sshterm no
enable_changepwd no


第一次執行 Open Webmail 的時候,在網頁中出現下面這段訊息怎辦 -->
「Please execute '/var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init' on server first!」

解決方法:直接在 console 中執行「 /var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init 」即可,請注意執行之後所出現的訊息,若有什麼錯誤的話,需要針對它的錯誤下去修正,以下為正確的執行狀況

代碼:
# /var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init
creating /var/www/cgi-bin/openwebmail/etc/b2g.db ...done.
creating /var/www/cgi-bin/openwebmail/etc/g2b.db ...done.
creating /var/www/cgi-bin/openwebmail/etc/lunar.db ...done.

Welcome to the Open WebMail!

This program is going to send a short message back to the developer,
so we could have the idea that who is installing and how many sites are
using this software, the content to be sent is:

OS: Linux 2.4.18-26.7.xsmp i686
Perl: 5.006001
WebMail: Open WebMail 1.90 20030307

Send the site report?(Y/n)
sending report...

Thank you.




Exclamation 注意:要在網頁上執行 openwebmail 前,請先確認 httpd 已經有支援 CGI(方法)

使用:在瀏覽器輸入『http://163.19.59.1/cgi-bin/openwebmail/openwebmail.pl』即可

/var/www/cgi-bin/openwebmail/etc/openwebmail.conf.default 這個檔案是 Open Webmail 的參考用設定檔,若我們想要修改 Open Webmail 使它更符合我們的需求,可以參考這個檔案來設定 /var/www/cgi-bin/openwebmail/etc/openwebmail.conf



Rolling Eyes FAQ
8.0 的 sendmail 預設只對本機做服務

代碼:
# netstat -a | grep smtp
tcp  0  0   localhost.localdom:smtp   *:*   LISTEN


(未修改前的 smtp)


代碼:
# netstat -a | grep smtp
tcp  0  0  *:smtp    *:*     LISTEN


(修改過後的 smtp)





如何讓使用者的 mail 也受 quota 的管制?

我們通常會針對 /home 做 quota 設定,所以把 /var/spool/mail 移到 /home 底下才能針對 使用者的 mail 容量做控管
( 不然針對 /var 做 quota 設定也是可以的,不過要多花一次工就是了)

流程:

mkdir /home/mail
(在 /home 下建立一個 mail 資料夾)

chown root.mail /home/mail
(改變 mail 的擁有者和群組)

chmod 775 /home/mail
(改變權限)

mv /var/spool/mail/* /home/mail
(移動使用者的信件)

mv /var/spool/mail /var/spool/mail.bak
(將 /var/spool/mail 資料夾更名)

ln -s /home/mail /var/spool/mail
(做連結)

然後針對 /home 設定quota,這樣使用者的 mail 就可以受 quota 的管制了(quota 的設定方法)



如何讓寄給 root 的信都轉給某一個帳號

vi /etc/aliases 加入下面這一行
代碼:
root:     sysadm


Arrow 這樣就會將所有寄給 root 的信轉給 sysadm 這個帳號了(sysadm 這個帳號需要事先建立)


newaliases

Arrow 修改完 aliases 之後,下 newaliases 指令,將 aliases 轉成 /etc/aliases.db,完成


Arrow 也可以這樣改,root: sysadm,p79sys@nc.hcc.edu.tw ,同時寄給兩個人



Red Hat Linux8.0中的 sendmail 重新啟動,會出現下列訊息,要改哪裡?

引言回覆:
關閉 sendmail: [確定]
關閉 sm-client: [確定]
啟動 sendmail:make: *** Warning: File `virtusertable.db' has modification time in the future (2003-02-19 06:24:49 > 2003-02-19 01:41:36)
make: warning: Clock skew detected. Your build may be incomplete.
554 5.0.0 No local mailer defined
554 5.0.0 QueueDirectory (Q) option must be set [失敗]
啟動 sm-client: [ 確定]





會出現錯誤訊息,是因為時間的不同步,virtusertable.db 的檔案時間較快, 而系統時間較慢,舊檔案要去 make 成 新的 virtusertable.db 檔,所以會出現錯誤
解決方法:在 /etc/mail 資料夾中下 touch * 指令即可 讓它們都變成現在的時間,再重新啟動,這樣就可以了



如何設定寄件郵件的最大容量

代碼:
vi /etc/sendmail.cf

#maximum message size
O MaxMessageSize=1000000



--------------------------------------------------------------------------------

如何測試 mail server 是否會接受其他單位 relay 而被利用來寄 spam?

教育部的這個網址有提供測試:http://www.edu.tw/tanet/spam.html


一些名詞

MTA = Mail Transfer Agent,Sendmail、Postfix
MDA = Mail Delivery Agent, mail、Procmail(有些人也稱 MDA 叫 LDA = Local Delivery Agent)
MUA = Mail User Agent,M$ 的 Outlook Express、Outlook,或 Linux 下的 Mozilla Mail、mutt、pine





檢視會員個人資料發送私人訊息發送電子郵件參觀發表人的個人網站MSN MessengerICQ 號碼
tarohuang
離線


火力VIP版主 性別:男 血型:A 星座:處女
火力VIP版主
等級: 23
技能點: 4
屬性: Archmage
24 / 1225
585 / 585
23 / 65

文章: 656
人氣: 155.33
火力幣: 5217
註冊時間: 2003-11-11
來自: Fairyland
引言回覆
發表文章主題: Re: [教學][轉載] Mail Server 相關設定方法
發表發表於: 2003-12-01 01:06

some 寫到:

第一次執行 Open Webmail 的時候,在網頁中出現下面這段訊息怎辦 -->
「Please execute '/var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init' on server first!」

解決方法:直接在 console 中執行「 /var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init 」即可,請注意執行之後所出現的訊息,若有什麼錯誤的話,需要針對它的錯誤下去修正,以下為正確的執行狀況

代碼:
# /var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init
creating /var/www/cgi-bin/openwebmail/etc/b2g.db ...done.
creating /var/www/cgi-bin/openwebmail/etc/g2b.db ...done.
creating /var/www/cgi-bin/openwebmail/etc/lunar.db ...done.

Welcome to the Open WebMail!

This program is going to send a short message back to the developer,
so we could have the idea that who is installing and how many sites are
using this software, the content to be sent is:

OS: Linux 2.4.18-26.7.xsmp i686
Perl: 5.006001
WebMail: Open WebMail 1.90 20030307

Send the site report?(Y/n)
sending report...

Thank you.



補充一下
如果打[/var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init ]出現下面這個畫面(出現這個畫面之前會出現警告訊息..直接按enter就好)按enter後會出現

Please change the following 3 options in openwebmail.conf

from

dbm_ext .db
dbmopen_ext none
dbmopen_haslock no


to

dbm_ext .db
dbmopen_ext %dbm_ext%
dbmopen_haslock yes



請到openwebmail.conf修改紅色的部分到藍色的部分
紅色的部分跟藍色的部分好像會隨者系統或是版本的不同請以電腦出現的訊息為準
修改完後記的再從新輸入一次[/var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init ]就會出現some大大po的畫面
我的版本是這樣不知道有沒有不一樣的^^"
還有粉多的東西都還在摸索所以只po這些我遇到的問題





檢視會員個人資料發送私人訊息發送電子郵件MSN Messenger
1頁(共1頁)
發表文章回覆文章友善列印轉寄給友人 上一篇主題下一篇主題


前往:  
無法 在這個版面發表文章
無法 在這個版面回覆文章
無法 在這個版面編輯文章
無法 在這個版面刪除文章
無法 在這個版面進行投票
可以 在這個版面附加檔案
可以 在這個版面下載檔案
科技 | 生活 | 分享 | 遊戲 | 流行 | 自然

分享火力 Holy.be © 2003-2007