MailWatch UTF-8 中文化

目前網路上已有好心人士中文化, 可參考 http://blog.yam.com/rei92/article/15738264

雖介面UTF-8中文化, 但是目前大家還是習慣以Big5編碼來寄送郵件,因此在MailWatch中看到的主旨還是亂碼, 尤其當畫有中日韓非UTF-8編碼時,瀏覽器編碼得手動切來切去, 反而介面變成亂碼….

最好的方式就是大家改用UTF-8, 但是依最常用的outlook express軟體預設Big5狀況來看應該還要很長一段時間才可能實現.

這邊先以上述中文化檔案加上修改程式方式將編碼轉換至UTF-8, 讓同一畫面可以顯示不同語言. 但若信件主旨非US-ASCII且未指定編碼(不符合RFC 2047)者先暫時當作是Big5編碼成UTF-8, 這一類大部分應該也是垃圾郵件居多. 但若因檔頭有多種編碼或無主旨可能造成判斷錯誤, 不過基本上大部分狀況下是OK的.

MailWatch UTF-8 中文化

MailWatch UTF-8 中文化

在Apache網頁驗證AD使用者

1. 讓Apache 2.2支援PAM驗證
下載安裝Mod_Auth_External
apxs -c mod_authnz_external.c
apxs -i -a mod_authnz_external.la

2.安裝密碼認證程式
下載安裝 pwauth
編輯 config.h ,
#define PAM (原為#define SHADOW_SUN)
#define SERVER_UIDS 48 (請根據Apache執行者的 UID 調整)
關掉下面這行(因為winbind取得的ID遠大於500)
/*#define MIN_UNIX_UID 500
編譯
[root@centos5 pwauth]# make
[root@centos5 pwauth]# mv pwauth /usr/local/sbin
[root@centos5 pwauth]# mv unixgroup /usr/local/sbin

3.修改 httpd.conf ,理論上安裝mod_auth_external 時會自動增加下面這行
LoadModule authnz_external_module modules/mod_authnz_external.so

4.修改conf.d的mrtg.conf (以修改這個檔為範例)
<Ifmodule>
AddExternalAuth pwauth /usr/sbin/pwauth
SetExternalAuthMethod pwauth pipe
</Ifmodule>
<Directory>
AllowOverride AuthConfig
</Directory>

5.新增 /etc/pam.d/pwauth 內容如下
auth required pam_nologin.so
auth include system-auth
account include system-auth
session include system-auth

6.在mrtg下新增.htaccess 內容如下
AuthType Basic
AuthName Login
AuthBasicProvider external
AuthExternal pwauth
GroupExternal unixgroup
require valid-user

7. Winbind 部分請自行設定完整

Mailwatch 1.0.4 無法顯示Clamd掃描的病毒報告及圖表

MailScanner使用Clamd掃毒引擎時,Mailwatch下面兩個報表無法使用

TOP VIRUS REPORT 會出現 JpGraph Error: Illegal pie plot. Sum of all data is zero for Pie!

VIRUS REPORT 則無法秀出任何結果

雖然 1.0.4 已加入 Clamd 支援不過程式碼有誤,需修改 functions.php 以下區段:

case ‘clamd’:
//define(VIRUS_REGEX, ‘/(.+) contains: (\S+)/’);
define(VIRUS_REGEX, ‘/(.+) was infected: (\S+)/’);
break;

以及 rep_viruses.php

case(“clamd”):
$scanner[$vscanner][‘name’] = “ClamD”;
//$scanner[$vscanner][‘regexp’] = “/(.+) contains (\S+)/”;
$scanner[$vscanner][‘regexp’] = “/(.+) was infected: (\S+)/”;
break;

Mailwatch 1.0.4 標頭、主旨無法顯示

在Recent Messages點 [ ] 進入詳細資料時 Messages Header 及 Subject 無法顯示中文,解決方式為修改detail.php

if ($fieldn == “To:” || $fieldn == “Subject:”) {
//$row[$f] = htmlentities($row[$f]);
$row[$f] = htmlspecialchars($row[$f]);
}

以及

if ($fieldn == “Message Headers:”) {
//$row[$f] = nl2br(str_replace(array(“\\n”,”\t”),array(“<BR/>”,”     “),htmlentities($row[$f])));
$row[$f] = nl2br(str_replace(array(“\\n”,”\t”),array(“<BR/>”,”     “),htmlspecialchars($row[$f])));
}

CONVMV: perl 的批次檔案/目錄名稱轉碼

    iconv是好用的轉碼程式,但是對於批次轉目錄/檔案名稱時就有點麻煩,需要自己寫個小程式。不過其實免了,已有人開發了這個好用的PERL小程式叫做CONVMV

    下載點 http://www.j3e.de/linux/convmv/,目前最新版本為1.10

測試(僅列出結果)將filename目錄下的所有Big5檔名轉換為utf-8

$ convmv -f big5 -t utf-8 filename/*

實際轉檔

$ convmv –notest -f big5 -t utf-8 filename/*

MySQL 複製失敗

    按照官方說法只要MySQL Master的版本不比Slave新仍可以複製。由於Slave機器硬體更新系統亦從RH8升級到CENTOS5,內附MySQL為5.0版,直接將原來的BINARY資料庫直接複製過來使用,並未遇上短密碼的問題。但是網頁部分卻發生帳號無法登入的問題,目前仍無法解決。

    至於資料庫複製起初正常,但在Master新增某些資料時便會造成複製失敗。在拜過Google大神後,有人提到加大max_allow_packet後還是無法改善,看來只有更換回4.1一途了…

Centos 5 : Yum Update 無法升級 perl-5.8.8-10

進行yum update時出現以下錯誤

[root@mindman yum.repos.d]# yum upgrade perl
Loading “installonlyn” plugin
Setting up Upgrade Process
Setting up repositories
Reading repository metadata in from local files
Resolving Dependencies
–> Populating transaction set with selected packages. Please wait.
—> Package perl.i386 4:5.8.8-10.el5_0.2 set to be updated
–> Running transaction check

Dependencies Resolved

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

Package Arch Version Repository Size
=========================================

Updating:
perl i386 4:5.8.8-10.el5_0.2 updates 12 M

Transaction Summary
=========================================

Install 0 Package(s)
Update 1 Package(s)
Remove 0 Package(s)

Total download size: 12 M
Is this ok [y/N]: y
Downloading Packages:
Running Transaction Test
Finished Transaction Test

Transaction Check Error:
file /usr/lib/perl5/5.8.8/Getopt/Long.pm from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Getopt-Long-2.36-1
file /usr/lib/perl5/5.8.8/newgetopt.pl from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Getopt-Long-2.36-1
file /usr/share/man/man3/Getopt::Long.3pm.gz from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Getopt-Long-2.36-1
file /usr/lib/perl5/5.8.8/Test/Builder.pm from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Test-Simple-0.70-1
file /usr/lib/perl5/5.8.8/Test/Builder/Module.pm from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Test-Simple-0.70-1
file /usr/lib/perl5/5.8.8/Test/Builder/Tester.pm from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Test-Simple-0.70-1
file /usr/lib/perl5/5.8.8/Test/More.pm from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Test-Simple-0.70-1
file /usr/lib/perl5/5.8.8/Test/Simple.pm from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Test-Simple-0.70-1
file /usr/share/man/man3/Test::Builder.3pm.gz from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Test-Simple-0.70-1
file /usr/share/man/man3/Test::Builder::Module.3pm.gz from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Test-Simple-0.70-1
file /usr/share/man/man3/Test::Builder::Tester.3pm.gz from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Test-Simple-0.70-1
file /usr/share/man/man3/Test::Builder::Tester::Color.3pm.gz from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Test-Simple-0.70-1
file /usr/share/man/man3/Test::More.3pm.gz from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Test-Simple-0.70-1
file /usr/share/man/man3/Test::Simple.3pm.gz from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Test-Simple-0.70-1
file /usr/share/man/man3/Test::Tutorial.3pm.gz from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Test-Simple-0.70-1
file /usr/lib/perl5/5.8.8/Math/BigFloat.pm from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Math-BigInt-1.86-1
file /usr/lib/perl5/5.8.8/Math/BigInt.pm from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Math-BigInt-1.86-1
file /usr/lib/perl5/5.8.8/Math/BigInt/Calc.pm from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Math-BigInt-1.86-1
file /usr/lib/perl5/5.8.8/Math/BigInt/CalcEmu.pm from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Math-BigInt-1.86-1
file /usr/share/man/man3/Math::BigFloat.3pm.gz from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Math-BigInt-1.86-1
file /usr/share/man/man3/Math::BigInt.3pm.gz from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Math-BigInt-1.86-1
file /usr/share/man/man3/Math::BigInt::Calc.3pm.gz from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Math-BigInt-1.86-1
file /usr/share/man/man3/Math::BigInt::CalcEmu.3pm.gz from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Math-BigInt-1.86-1
file /usr/lib/perl5/5.8.8/Math/BigRat.pm from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Math-BigRat-0.19-1
file /usr/share/man/man3/Math::BigRat.3pm.gz from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Math-BigRat-0.19-1
file /usr/lib/perl5/5.8.8/bigint.pm from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-bignum-0.21-1
file /usr/lib/perl5/5.8.8/bignum.pm from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-bignum-0.21-1
file /usr/lib/perl5/5.8.8/bigrat.pm from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-bignum-0.21-1
file /usr/share/man/man3/bigint.3pm.gz from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-bignum-0.21-1
file /usr/share/man/man3/bignum.3pm.gz from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-bignum-0.21-1
file /usr/share/man/man3/bigrat.3pm.gz from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-bignum-0.21-1
file /usr/lib/perl5/5.8.8/i386-linux-thread-multi/Sys/Syslog.pm from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Sys-Syslog-0.18-1
file /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Sys/Syslog/Syslog.so from install of perl-5.8.8-10.el5_0.2 conflicts with file from package perl-Sys-Syslog-0.18-1

Error Summary
————-
原來是因為安裝了 MailScanner 造成的 , MailScanner 內附的一些 perl 模組以 –force 方式安裝 , 因此簡單的解決方式就是以手動方式以 –force 參數安裝新版 perl , 若 yum 已將該檔案下載至 /var/cache/yum/updates/packages , 直接以

# rpm -Uvh –force /var/cache/yum/updates/packages/
perl-5.8.8-10.el5_0.2.i386.rpm

修改 /etc/yum.repos.d/rpmforge.repo ,加入不檢查清單

exclude=perl-MIME-Base64 perl-Test-Simple perl-Getopt-Long perl-Math-BigInt perl-Math-BigRat perl-bignum perl-Sys-syslog
重新執行 yum update

最後重新安裝 MailScanner 即可