PIXNET Logo登入

No Money No Honey

跳到主文

Just Another Beginning

部落格全站分類:

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 3月 01 週二 201114:39
  • Mailscanner取回隔離區的信-Releasing mail from the quarantine

Releasing mail from the quarantine - queue files For the purposes of this, I’m assuming you have set up a single (safe!) postfix instance, with messages going to the HOLD queue, before being processed by MailScanner and sent to the INCOMING queue. You also need to be saving whole messages as queue files. In MailScanner.conf ensure that you have # When you quarantine an entire message, do you want to store it as
# raw mail queue files (so you can easily send them onto users) or
# as human-readable files (header then body in 1 file)?
Quarantine Whole Messages As Queue Files = yes
Quarantined emails are by default kept in /var/spool/MailScanner/quarantine and sorted into subdirectories by date. With any luck it will be dead easy to find, as MailScanner will have sent a message including text along the lines of either:
A: If it’s a quarantined virus, or other dangerous content. “Note to Help Desk: Look on the <Your text> in /var/spool/MailScanner/quarantine/20050309 (message
6BC5E368497.3C3A6).”
MailScanner keeps such quarantined emails in their own directories, thus the directory containing the quarantined message will be (in this example): /var/spool/MailScanner/quarantine/20050309/6BC5E368497.3C3A6. In this directory, you should see the original queue file, named as a 10 digit hex number matching the name of the directory. There should also be copies of any attachments that may have been picked up by the virus scanning engine or file filtering.
B: If it’s a quarantined spam "Your system administrators will need the following information:
Server name: <Your Server>
Message id: 46EE0E18151.CE630
Date code: 20080509"
MailScanner keeps all spam on a given day in the same directory, thus the directory containing the quarantined message will be (in this example): /var/spool/MailScanner/quarantine/20080509/spam.
If you want to check the original message use: # postcat <filename>
Releasing an email from quarantine is a simple matter of replacing the queue file back into the Postfix queue, so that it gets sent. The permissions on the file are wrong, however and must be changed. # chmod 700 <filename>
The file must now be moved into /var/spool/postfix/incoming. There may be 16 directories in there (Collectively referred to as ‘hashed queue files’) each corresponding to a hexadecimal digit, depending which version of Postfix you are running. First check if you have hashed queue files by: # ls /var/spool/postfix/incoming
If no directories are listed then follow the instructions below but do not add the trailing letter/ number.
The file must be placed in the directory which corresponds to the first digit of the filename. So in the example above, it must go into /var/spool/postfix/incoming/6. We must also be sure to preserve the ownership and permissions of the file when moving it, so we use “cp -p”. If the message is a spam, we must also remove the trailing 6 characters.
Thus for the example above: # cp –p 6BC5E368497 /var/spool/postfix/incoming/6
or for the example quarantined spam # cp –p 46EE0E18151.CE630 /var/spool/postfix/incoming/4/46EE0E18151
The email will disappear from the queue and be delivered.
Thanks to Joshua Hirsh for the details and Stef Morrell for writing the document
Releasing mail from the quarantine - with a bash script
Maybe it’s too circuitous for you to do all the steps in the section above to release a mail. For this I wrote a tiny script to release very easily. To use this script you should set the MailScanner environment identically to the article above.
To use this script copy it to a file and make it executable.
The Syntax: release.sh <Message-ID> (e.g. release.sh 5B604228086.932F0) #!/bin/sh
if [ -z "$1" ]; then
echo "Syntax: release.sh <Message-ID> i.e. 5B604228086.932F0 (case sensitive)"
exit
fi
#change in the quarantine folder
folder=`find /var/spool/MailScanner/quarantine/ -name $1`
cd $folder
#set the mailfile executable
mailname=`echo $1 | cut -d . -f 1`
chmod u+x $mailname
#lets get the first character
char=`echo $1 | cut -b 1-1`
#copy the mail
cp -a $mailname /var/spool/postfix/incoming/$char/
echo Mail $mailname released
Releasing mail from the quarantine - message files
If you don’t quarantine the complete queue file, but instead have the rfc822 message file, releasing messages are actually a bit simpler (for postfix) than the above, since you can use the postfix sendmail convenience program.
In MailScanner.conf you have Quarantine Whole Messages As Queue Files = no
and in the quarantine directory you have a file called message (this is the complete human-readible message, but without the envelope info). Just do cd /path/to/quarantine/dir
sendmail -t -i < message
to send the message to the recipient(s) as found in the message file, or cd /path/to/quarantine/dir
sendmail -i alternate_recipient@example.net < message
to send the message to an alternate recipient (of course you can combine them). The -i option is to avoid terminating the message prematurely on a spurious single “.” on a line in the message file.
If you use MailWatch, this can also release the message iff you don’t quarantine the whole message file as the queue file, although this uses a different method to release messages from the GUI.
Releasing mail from the quarantine - queue files postfix (again)
In a larger environment with many hosts and thousands of quarantined emails per day, we’ve found it impractical to reply to each email released or deleted from a queue, and simply process it without fanfare. The code below is modified from the release.sh above to accomodate moving the released mail back into postfix using the original mail ID. In addition, our postfix install required us to rename the queue file to its shortname, that is, the 10 or 11 character filename before postfix would accept the email into the queue.
The Syntax: release.sh <Message-ID> (e.g. release.sh 5B604228086.932F0) #!/bin/sh
if [ -z "$1" ]; then
echo "Syntax: release.sh <Message-ID> i.e. 5B604228086.932F0 (case sensitive)"
exit
fi
#change in the quarantine folder
folder=`find /var/spool/MailScanner/quarantine/ -name $1 | sed -e "s/$1//g"`
cd $folder
#set the mailfile executable
mailname=`echo $1 | cut -d . -f1`
chmod u+x $1
#lets get the first character
char=`echo $1 | cut -b 1-1`
#copy the mail
cp -a $1 /var/spool/postfix/incoming/$char/$mailname
The following is for recent postfixes (2.3, 2.4) which seem to have a flat incoming directory: #!/bin/sh
# this is the final destination for the mail to be released:
# postfix's incoming queue
POSTFIX_DEST=/var/spool/postfix/incoming
# check for valid parameters
if [ -z "$1" ]; then
echo "Syntax: release.sh <Message-ID>"
echo "Example: release.sh 678362AC.9CFE7"
exit
fi
# find the specific mail in the quarantine folders
folder=`find /var/spool/MailScanner/quarantine/ -name $1`
mailname=`echo $1 | cut -d . -f1`
# copy the mail
if [ -e $POSTFIX_DEST/$mailname ] ; then
echo "ERROR: $mailname already in $POSTFIX_DEST! EXITING"
echo "This should not happen"
exit 255
fi
cp -avi "$folder/$mailname" "$POSTFIX_DEST/$mailname"
# make it 0700 so that the mail is deemed ready
chmod 0700 $POSTFIX_DEST/$mailname
Releasing mail from the quarantine - the one liner
sudo install -m 0700 -o postfix <source message> /var/spool/postfix/incoming
Releasing mail from the quarantine - alias with intelligenceintegrate() {
# integration: antonym of quarantine
# Pass the message ID as obtained from user's email as $1
DEST=$(postconf queue_directory | cut -d= -f2)/incoming
SOURCE=$(find /var/spool/MailScanner/quarantine -name "$1")
install --verbose --mode=0700 --owner=postfix $SOURCE $DEST
}
Updated bash script
Line 9 on initial bash script returned filename with full path and not folder, as expected. Instructions at the top also used the cp -p option, and not -a. Instead of cd’ing to quarantine folder, this will do the copy and preserve permissions. #!/bin/sh
if [ -z "$1" ]; then
echo "Syntax: release.sh <Message-ID> i.e. 5B604228086.932F0 (case sensitive)"
exit
fi
#find the quarantined file and set permissions
quarantined_file=`find /var/spool/MailScanner/quarantine/ -name $1`
chmod u+x $quarantined_file
#truncate the filename
mailname=`echo $1 | cut -d . -f 1`
#lets get the first character
char=`echo $1 | cut -b 1-1`
#copy the mail, destination is the truncated filename
cp -p $quarantined_file /var/spool/postfix/incoming/$char/$mailname
echo Mail $mailname released
(繼續閱讀...)
文章標籤

NoMoney NoHoney 發表在 痞客邦 留言(1) 人氣(661)

  • 個人分類:Linux
▲top
  • 11月 04 週四 201009:45
  • 使用Mailscanner 的 Archive Mail 備份郵件

最近MAIL常出現主旨為 : Problem Messages 內容為: Archive:
Number of messages: 5
Tries Message Last Tried
===== ======= ==========
6 3553C24D80D2.A0925 Sat Oct 30 04:57:38 2010
6 10ED024D80EC.AC79E Sat Oct 30 04:56:25 2010
6 2FF5D24D80D7.AD62C Sat Oct 30 04:53:05 2010
6 DC7FD24D80BD.AC95D Sat Oct 30 04:43:07 2010
6 73A4D24D80C2.A16DF Sat Oct 30 04:42:41 2010 找著找著找到了Mailscanner 的 Archive 用法 文章出處:http://i-yow.blogspot.com/2009/07/archive-mailby-mailscanner.html ===================================================== 邪惡的Archive Mail備份郵件(By MailScanner)
MailScanner有一個邪惡又好用的功能:『Archive Mail』
這個比Forward還要厲害的功能,當你想要存留(備份)用戶收、發的信件時,用這就就對了~ 1.啟動Archive功能
vim /etc/MailScanner/MailScanner.conf
Archive Mail = /etc/MailScanner/archive.rule 2.編輯Archive規則
vim /etc/MailScanner/archive.rule
基本規則如下:
FromOrTo: User@mail.com* yes forward Admin@mail.com.tw
(收件者或寄件者) (關鍵字,可配合萬用字元) (yes,啟用規則) (forward,動作) (Forward的目標) ※Archive Mail不但可以過濾到本機網域的帳號,也可以以外部帳號作為關鍵字,只要有經過MailScanner掃描的都可以做處理。
※以上只是簡單的例子,Archive Mail還有許多變化跟應用 ======================================================
(繼續閱讀...)
文章標籤

NoMoney NoHoney 發表在 痞客邦 留言(0) 人氣(249)

  • 個人分類:Linux
▲top
  • 10月 28 週四 201010:29
  • Large Mailbox threshold 40MB之Syslog警訊

發現Syslog只要信箱超過40MB都會出現警訊: Large Mailbox threshold: 40MB (41943040 bytes)
  Warning: Large mailbox: teresa.wu (1151343331)
  Warning: Large mailbox: karen.wang (489717393) GOOGLE了一下知道怎麼改這個設定: 在 [root@mail ~]# vi /usr/share/logwatch/default.conf/services/sendmail-largeboxes.conf中 <==CentOS 5.5內位置有變動 # Mailbox size threshold
# can add units KB, MB, GB, TB
# can set to 0 to report spool files being created where they shouldn't
sendmail_largeboxes_size = 40MB
# 改為希望的大小就可以了。
 
文章出處:http://linuxdiary.blogspot.com/2008/10/logwatch.html
(繼續閱讀...)
文章標籤

NoMoney NoHoney 發表在 痞客邦 留言(0) 人氣(132)

  • 個人分類:Linux
▲top
  • 10月 27 週三 201012:27
  • Postfix 郵件格式由 mbox 轉 maildir - 解決mbox LOCK與alias群組重複收信問題

2010-10-27 mbox 與 maildir 優缺點比較: =========================================================== mbox 與 maildir 之優缺點比較 這裡給出一個基本的特性對比,很容易就能清楚自己的程式應該選什麼存儲格式: 可靠性 優選是 maildir,因為 mbox 只有一個檔案,一旦出問題,所有郵件可能一併損毀。 更新效能 這裡主要指的是刪除/ 增加郵件的能力,無疑 maildir 完勝 mbox 搜尋速度 這點 mbox 因為是單檔案,搜尋能力要強於 maildir 並行存取能力 對於繁忙的郵件系統,多個 Process 同時存取同一封郵件是可能的事情,mbox 需要 flock() 的支援,而且如果某一個 Process 操作時間長,則其他所有 Process 都堵塞了。maildir 沒有這個問題。在 NFS 等網路檔案系統上,maildir 相對安全,mbox 則不能用於此類型環境 擴充能力 現下的郵箱容量已經不是十年前的 MB, 而是 GB,mbox 應付大容量已力不從心,無疑 maildir 是比較適合的。 檔案系統倚賴 maildir 較倚賴檔案系統的索引能力,用 ReiserFS 會比較快,對於超大型的 maildir,讀寫性能將受到考驗。相對而言 mbox 則不存在這個問題。 總合結論 使用 maildir 格式,安全可靠,大部分操作都快於 mbox。而且現今支援 maildir 的軟體越來越多。 ===========================================================   2010-10-26 1.轉換信件後變成一封信一個檔案,因權限沒正確修改好,故手動修正了好一陣子 >_< 2.
/var/spool/maildir/帳號/cur <=看過的信如果還保留在SERVER上的信就存這
/var/spool/maildir/帳號/new <=新進的信還沒看過就存這
/var/spool/maildir/帳號/tmp <=收信件暫存區,收完信後才移到new 3.換了這個maildir格式後,感覺MAIL SERVER很順,以前收發都會卡,可能就是因為mbox的LOCK機制造成。 4.用maildir格式要是使用者人很多,且都有留幾天信在SERVER上的習慣,那要特別留意檔案數量與 Inode 數量,超過就無法在寫入磁碟。 [root@mail ~]# df -i
檔案系統              Inode    I已用  I可用 I已用% 掛載點
/dev/sda1            3840192   24549 3815643    1% /
/dev/sda6            98074624   10654 98063970    1% /var
/dev/sda3            2560864  117080 2443784    5% /usr
/dev/sda2            25624576   10116 25614460    1% /home
tmpfs                 221892       1  221891    1% /dev/shm   2010-10-25 Postfix 郵件格式由 mbox 轉 maildir ,maildir格式可避免mbox格式 LOCK鎖檔案造成 aliases 的群組人員重複收到信。 格式說明出處:http://www.creativecrap.com/story/software/mbox-to-maildir ======================================== mbox mail storage format 這是傳統的郵件格式,將所有的信件都存在一個檔案中,所以相對的會有很多的缺點,包含當檔案太大時存取的效率即變差,若郵件檔損毀則所有的信件都沒了,同時只能有一個 process 存取,第二個 process 須等第一個 unlock 之後,才能存取。優點應該是簡單,單一檔案搜尋時較快,大部份預設值都還是 mbox,備份時也方便,因為只有一個檔案。 maildir mail storage format 這就是比較新的格式,沒記錯的話早先是由 Qmail 開始使用。將每一封信件就單獨存成一個檔案。相對於 mbox 的缺點即 maildir 的優點,反過來搜尋速度就是 maildir 的缺點了。 ======================================== 以下是看旗標 Linux Mail Server 技術實務來測試轉換(因自架MAIL SERVER於VM中,故先行快照,避免有問題時可回復原狀) 停止 MTA 服務(Mailscanner)
[root@mail ~]# /etc/init.d/MailScanner stop
Shutting down MailScanner daemons:
         MailScanner:                                      [  確定  ]
         incoming postfix:                                 [  確定  ]
         outgoing postfix:                                 [  確定  ]
[root@mail ~]# /etc/init.d/dovecot stop
正在停止 Dovecot Imap:                                     [  確定  ] 建立 maildir 格式存放目錄:
[root@mail ~]# mkdir /var/spool/maildir 查看原先mbox存放目錄的擁有者
[root@mail ~]# ls -ld /var/spool/mail
drwxrwxr-x 2 root mail 4096  1月 27  2010 /var/spool/mail 建立 maildir 與 mbox 目錄一樣的擁有者權限
[root@mail ~]# chown root.mail /var/spool/maildir/ 建立 maildir 目錄存取權限
[root@mail ~]# chmod 1777 /var/spool/maildir/ 修改 vi /etc/postfix/main.cf
[root@mail ~]# vi /etc/postfix/main.cf
………
home_mailbox = Maildir/
mail_spool_directory = /var/spool/maildir/
mailbox_command = /usr/bin/procmail -a "$EXTENSION" DEFAULT=/var/spool/maildir/$USER/ MAILDIR=/var/spool/maildir/$USER/ <==指定收件路徑,不指定會送到mbox信箱
……… 修改 vi /etc/dovecot.conf
[root@mail ~]# vi /etc/dovecot.conf
……
mail_location = maildir:/var/spool/maildir/%u (書上寫的是 default_mail_env = maildir:/var/spool/maildir/%u,不過裡面是寫我前面的樣式。)
…… 將mbox轉maildir格式:
安裝perl-5* perl-TimeDate*
yum install perl-5* perl-TimeDate* 下載安裝 mb2md
[root@mail ~]# wget http://batleth.sapienti-sat.org/projects/mb2md/mb2md-3.20.pl.gz
[root@mail
~]# gzip -d mb2md-3.20.pl.gz
[root@mail ~]# chmod +x mb2md-3.20.pl
[root@mail ~]# mv mb2md-3.20.pl /usr/local/bin/mb2md 建立 mbox 轉 maildir 批次執行檔:
vim /usr/local/bin/allmb2md
==================================
#!/bin/sh #設定原本mbox格式郵件目錄
MBOXDIR="/var/spool/mail" #設定maildir格式目錄
MAILDIR="/var/spool/maildir" cd $MBOXDIR for user in *; do
  mkdir -p $MAILDIR/$user
  mb2md -s $MBOXDIR/$user -d $MAILDIR/$user/
  chmod -R 700 $MAILDIR/$user/
  chown $user.mailuser $MAILDIR/$user/   <==這邊若使用者名稱為 名.姓 Roger.Lin 則要使用 :號區隔群組  Roger.Lin:mailuser
done
=================================== 給權限
[root@mail ~]# chmod +x /usr/local/bin/allmb2md 執行轉換
[root@mail ~]# allmb2md
(繼續閱讀...)
文章標籤

NoMoney NoHoney 發表在 痞客邦 留言(0) 人氣(717)

  • 個人分類:Linux
▲top
  • 8月 23 週一 201009:27
  • Linux下將一個記錄檔清空

參考:http://blog.udn.com/luckyhoo/678797 很簡單,echo語法的應用而已。
echo > test.log =================================== 若使用上面指令於 /var/spool/mail 清空使用者的信箱會出現問題, pop3在接收信時: Aug 23 10:26:23 hiwinmail dovecot: POP3(mailbak): Couldn't init INBOX: Can't sync mailbox: Messages keep getting expunged
Aug 23 10:26:23 hiwinmail dovecot: POP3(mailbak): Mailbox init failed top=0/0, retr=0/0, del=0/0, size=0 要使用 true > mailbak 即可正常使用pop3收信。
(繼續閱讀...)
文章標籤

NoMoney NoHoney 發表在 痞客邦 留言(0) 人氣(115)

  • 個人分類:Linux
▲top
  • 8月 12 週四 201011:28
  • CentOS 使用簡易版 SquirrelMail 當 WEBMAIL

CentOS 使用簡易版 SquirrelMail 當 WEBMAIL   安裝套件 yum -y install gmp gmp-devel curl curl-devel libidn libidn-devel php php-pear libc-client* php-imap yum -y install squirrelmail 設定參數 [root@mail1 ~]# vi /etc/squirrelmail/config.php $org_name = "Winpex Web Mail"; $squirrelmail_default_language = 'zh_TW'; $domain = 'mail1.winpex-gl.com'; $default_charset = 'Big5';   以下修改根目錄: /usr/share/squirrelmail/ SquirrelMail:郵件列表中文出現亂碼時,編輯 config/config.php: $squirrelmail_default_language = ‘zh_TW’;
$default_charset = ‘big5′;
$lossy_encoding = false; SquirrelMail:操作介面中文出現亂碼時,編輯 functions/i18n.php: $languages['zh_TW']['NAME'] = ‘Chinese Trad’;
$languages['zh_TW']['CHARSET'] = ‘big5′;
$languages['zh_TW']['LOCALE'] = array(‘zh_TW.UTF-8′, ‘zh_TW.big5′);
$languages['tw']['ALIAS'] = ‘zh_TW’; SquirrelMail:下載附件中文檔名亂碼,編輯 src/download.php: $filename = charset_encode($filename,$default_charset,false); $filename = iconv(‘big5’,’utf-8’,$filename); ç新增這一行 約103行 下載另存郵件檔名亂碼處理: // If name is not set, use subject of email if (strlen($filename) < 1) { $filename = decodeHeader($subject, true, true); $filename = iconv('big5','utf-8',$filename); ç加入這行 約108行 直接使用IE預覽附件為txt純文字檔時亂碼問題(Big5編碼用): 修改 [root@mail1 /]# vi /usr/share/squirrelmail/src/view_text.php 在 $charset = $header->getParameter('charset'); 下面加入判斷 if($squirrelmail_language == 'zh_TW') $charset = 'big5';
(繼續閱讀...)
文章標籤

NoMoney NoHoney 發表在 痞客邦 留言(0) 人氣(789)

  • 個人分類:Linux
▲top
  • 8月 11 週三 201011:12
  • CentOS Yum 更新之豬頭事件

新安裝的CentOS,怎麼yum install都不行,都會出現下面錯誤,一直以為修改[root@localhost ~]# vim /etc/yum.repos.d/CentOS-Base.repo的問題,結果發現是DNS沒設定上去,因為安裝使用DHCP,後來才手動改網路設定,忘了補上DNS……………夠豬頭! Total download size: 8.9 M
Is this ok [y/N]: y
Downloading Packages:
http://ftp.isu.edu.tw/pub/Linux/CentOS/5/os/i386/CentOS/libgomp-4.4.0-6.el5.i386.rpm: [Errno 4] IOError: <urlopen error (-3, '   ')>
Trying other mirror.
http://ftp.isu.edu.tw/pub/Linux/CentOS/5/updates/i386/RPMS/glibc-headers-2.5-49.el5_5.4.i386.rpm: [Errno 4] IOError: <urlopen error (-3, '   ')>
Trying other mirror.
http://ftp.isu.edu.tw/pub/Linux/CentOS/5/updates/i386/RPMS/kernel-headers-2.6.18-194.8.1.el5.i386.rpm: [Errno 4] IOError: <urlopen error (-3, '\xa   3')>
Trying other mirror.
http://ftp.isu.edu.tw/pub/Linux/CentOS/5/updates/i386/RPMS/glibc-devel-2.5-49.el5_5.4.i386.rpm: [Errno 4] IOError: <urlopen error (-3, '\x   9e')>
Trying other mirror.
http://ftp.isu.edu.tw/pub/Linux/CentOS/5/os/i386/CentOS/gcc-4.1.2-48.el5.i386.rpm: [Errno 4] IOError: <urlopen error (-3, '\x9   0')>
Trying other mirror.   補上DNS後可透過YUM正確安裝了 /etc/resolv.conf nameserver 168.95.1.1
(繼續閱讀...)
文章標籤

NoMoney NoHoney 發表在 痞客邦 留言(0) 人氣(259)

  • 個人分類:Linux
▲top
  • 8月 10 週二 201015:21
  • 在Linux作業系統下修改IP、DNS和路由配置

出處 : http://www.hkitn.com/article.php/5786 在Linux作業系統下修改IP、DNS和路由配置 在Linux作業系統下修改IP、DNS和路由配置 ifconfig eth0 新ip 然後編輯/etc/sysconfig/network-scripts/ifcfg-eth0,修改ip   一、修改IP地址 [aeolus@db1 network-scripts]$ vi ifcfg-eth0 DEVICE=eth0 ONBOOT=yes BOOTPROTO=static IPADDR=219.136.241.211 NETMASK=255.255.255.128 GATEWAY=219.136.241.254   二、修改閘道 vi /etc/sysconfig/network NETWORKING=yes HOSTNAME=Aaron GATEWAY=192.168.1.1 三、修改DNS [aeolus@db1 etc]$ vi resolv.conf nameserver 202.96.128.68 nameserver 219.136.241.206   四、重新啟動網路配置 /etc/init.d/network restart   修改ip地址   即時生效: # ifconfig eth0 192.168.0.20 netmask 255.255.255.0   啟動生效:   修改/etc/sysconfig/network-scripts/ifcfg-eth0   修改default gateway   即時生效: # route add default gw 192.168.0.254   啟動生效:   修改/etc/sysconfig/network-scripts/ifcfg-eth0   修改dns   修改/etc/resolv.conf   修改後可即時生效,啟動同樣有效   修改host name   即時生效: # hostname fc2   啟動生效:   修改/etc/sysconfig/network.
(繼續閱讀...)
文章標籤

NoMoney NoHoney 發表在 痞客邦 留言(0) 人氣(172)

  • 個人分類:Linux
▲top
  • 6月 18 週五 201017:50
  • POSTFIX訊息:warning: inet_protocols: configuring for IPv4 support only

因為把IPV6關了,所以LOG都會看到一堆這種訊息,雖然不會影響運作,但是一堆這種訊息久了也是佔空間,看了也厭煩........ 在 /etc/postfix/main.cf 裡指定ipv4即可(ipv4一定要小寫喔,大寫不行)。。

inet_protocols = ipv4

(繼續閱讀...)
文章標籤

NoMoney NoHoney 發表在 痞客邦 留言(0) 人氣(107)

  • 個人分類:Linux
▲top
  • 6月 15 週二 201016:49
  • postfix 重複收信--unable to lock for exclusive access: Resource temporarily unavailable 訊息作怪--更新

1

今天一早,台中分註點反應有兩台PCMAIL無法收,另一台NB收發信沒問題,試了一早上,發現連VPN收信會卡住,但是不使用VPN則可以正常收發信,這就不好搞了,到底是VPN與SERVER端連線有問題嗎?可是若有問題,那NB應該也要跟著有問題。試到下午想撞牆,後來發現...................

當有兩台電腦同時用同帳號使用 OUTLOOK EXPRESS 收發信,尤其其中一台若是使用IMAP,另一台使用POP3,MAIL SERVER就會發生 /var/spool/mail/該帳號 LOCK住的情形,此時就無法收信,會卡在那邊收不下來。

ll /var/spool/mail/ 後看到帳號被系統 lock,這時後想要強制刪除 帳號.Lock 是沒有辦法的。
1

 

[root@mail ~]# lsof | grep roger 秀出該帳號在系統中使用的狀況,這邊可以看到系統還是有卡住該使用者帳號的 POP3 IMAP等程序。
2 

 

真正的解決辦法是叫使用者把OUTLOOK EXPRESS都關掉,等個5~10分鐘,系統會自動解除 lock ,確認帳號 lock 被解除,[root@mail ~]# lsof | grep roger 內沒有POP3與IMAP等程序,再請使用者開OUTLOOK EXPRESS使用看看,應該就可以正常收信了。
4 
3

 

題外話:那卡住的時候,為何被卡住同帳號不使用VPN連線直接走外線就可以收信呢?我只想到這個合理的解釋,就是收信網段的問題,vpn收信是直接使用內部網段IP,所以內部網段造成的收信 lock 問題,與外部網段的程序是區隔開來的,當然還要試試看如果兩台PC同時用同帳號由外部網段直接收信看會不會LOCK才能確定,但是使用者已經快把我殺了,只好作罷,暫時先這樣結案…………不完美的結案。

=================================================================

mail server 用 fedora 9  postfix + dovecot + mailscanner 架設,最近常聽到有重複收信的問題,後來看LOG發現有一些時候會出現 unable to lock for exclusive access: Resource temporarily unavailable 這個訊息,導致這封信會重複寄送,直到信完成寄出系統才會Remove 這封信,也就是說如果有使用 aliases ,如果裡面有5個收信人,結果其中一位收信人收現了這種訊息一直無法寄到使用者信箱,那麼另外四個人會一直收到重複的信,直到這五個人全部都成功寄出為止,難怪一早來又看到有重複的信………

上網查了一下,應該就是下面這位大大所說的原因,先改看看再觀察囉。

 

參考文章:http://bojack.pixnet.net/blog/post/25926521

==================================================================

目前系統的環境是 Postfix + Dovecot

這是最近出現在 maillog 訊息

Mar 15 08:49:49 mail postfix/local[4491]: C7EFD2B7C9D: to=<xxx@xxx.edu.tw>, orig_to=<xxx2008>, relay=local, delay=21, delays=0.06/0/0/21, dsn=4.2.0, status=deferred (cannot update mailbox /var/mail/xxx for user maxling. unable to lock for exclusive access: Resource temporarily unavailable)

因為郵件系統內設定有許多 Aliases,當有人正在針對特定的 Aliases 寄送信件,且此群組內某一個人正好在使用 POP3 收信時,可能就會發生 Lock 的情況,導致系統會重新再寄信該封信件,變成同一封信會收到 2 次以上 ( 大容量信件更是可怕 )

目前查了相關資訊,建議是將 Postfix 和 Dovecot Lock 的機制都設定為一樣,還不確定是否可以解決,正在觀察是否會出現相同的情況

Postfix 目前的設定

mailbox_delivery_lock = flock, dotlock

Dovecot 目前的設定

mbox_read_locks = flock dotlock
mbox_write_locks = flock dotlock

參考的資料如下

酷學園 - postfix 產生cannot update mailbox 和 Resource temporarily unavailable

Mool - maillog 出現 Resource temporarily unavailable

記。回憶 - Postfix + Dovecot , mbox Lock 問題

Dovecot - Mbox Locking

bojack 發表在 痞客邦 PIXNET 迴響(0) 引用(0) 人氣(43)
(繼續閱讀...)
文章標籤

NoMoney NoHoney 發表在 痞客邦 留言(0) 人氣(348)

  • 個人分類:Linux
▲top
12»

自訂側欄

自訂側欄

個人資訊

NoMoney NoHoney
暱稱:
NoMoney NoHoney
分類:
好友:
累積中
地區:

熱門文章

  • (18,069)公司部門英文縮寫簡稱大全(1)
  • (348)postfix 重複收信--unable to lock for exclusive access: Resource temporarily unavailable 訊息作怪--更新
  • (9,160)林宥嘉 - 說謊 歌詞是什麼意思 ?
  • (11,215)使用GPO規則幫使用者自動安裝印表機
  • (897)DelForExp - 可以幫你重新編排 Delphi 程式碼
  • (4,070)每日一句-為什麼要叫衛生眼?
  • (11,328)DELPHI 字串函式大全
  • (19,893)Delphi控制Excel範例大全
  • (1,657)DHCP伺服器探測工具(DHCP Server Locator,dhcploc.exe)─dhcploc.exe
  • (4,268)久久不能自己

文章分類

  • LINUX (1)
  • 汽車 (1)
  • OPENVPN (1)
  • OPENSSL (1)
  • OSSIM (1)
  • 印表機 (1)
  • ANDRIOD (1)
  • 不斷電系統UPS (1)
  • 生活 (6)
  • 鼠來寶 (1)
  • PC零組件 (2)
  • 政治垃圾 (60)
  • 政治與歷史 (13)
  • Open-audit (2)
  • SOPHOS XG (2)
  • NAS (1)
  • TOYOTA (1)
  • RouterOS (3)
  • YAMAHA勁戰4代六期 (1)
  • 政治 (11)
  • SERVER (7)
  • 養生 (1)
  • W124 (14)
  • OFFICE (1)
  • Postfix (7)
  • 遊戲 (1)
  • 音樂 (2)
  • FTP (1)
  • 網路設備 (3)
  • 網頁設計 (2)
  • PHP (3)
  • EXCEL (1)
  • 無料好用工具 (2)
  • MSSQL (6)
  • 飲食 (6)
  • 新聞及政治 (16)
  • 電腦和網際網路 (54)
  • DOS (1)
  • 知識 (6)
  • MySQL (2)
  • 電腦專有名詞 (1)
  • 閒聊 (72)
  • 娛樂 (13)
  • 電腦打版刺繡MARK、臂章 (2)
  • 科技 (13)
  • 電腦虛擬化技術 (28)
  • Windows (45)
  • DELPHI程式語言 (29)
  • 新奇 (15)
  • Linux (19)
  • 未分類文章 (1)

最新文章

  • Synology 群暉 DSM 7.2.2 手動安裝Video Station-How to Add Video Station BACK to DSM 7.2.2
  • LibreNMS Rocky Linux 9.5 安裝 設定 教學
  • #一人一票的意義 新加坡國父李光耀:我從不相信「民主」會帶來進步!
  • 台灣選舉哪裡是民主? 其實是"金主"
  • WINDOWS 11 無法安裝SERVER 2003 或 XP分享的印表機出現 0x00000709 錯誤,印表機救星來了。
  • WINDOWS登入第三方兩步驟驗證(2FA)方案設定教學-PROTECTIMUS-免費版有10個帳號可用
  • 台灣的窘境越來越明顯
  • 國產車油電93萬,這價位在大陸可以買到BYD PHEV續行200公里版本,隔音內裝品質引擎動力都遠勝台灣國產車,台灣人還要被自己人盤多久? 被自己人欺負多久?
  • 台灣傻子多到騙子不夠多來騙真的不是空穴來風
  • 說個笑話:大陸都快要有第四艘航母了,台灣薪資伙食費+600本薪-600

動態訂閱

文章精選

文章搜尋

誰來我家

參觀人氣

  • 本日人氣:
  • 累積人氣: