原罪的雜記

關閉HTTP TRACE 避免Cross Site Scripting風險 –for Unix/Unix like

From: http://vincent119.blogspot.com/2008/08/apache.html  & http://forum.parallels.com/showthread.php?t=81732

關閉 ServerToken 功能

ServerToken 的功能是在 Apache 1.3 以後的版本才出現的,而 ProductOnly 關鍵字則是在 1.3.12 之後才出現。ServerToken 主要是控制伺服器在表頭區域回應給用戶端的資訊,例如使用何種作業系統或模組。因此,入侵者可能利用這些資訊而採用特定的攻擊方法,來更快速進行滲透或破解。所以提供的資訊越少則越安全。因此可以利用 ServerToken 功能:其語法為: ServerTokens MajorMinorMin[imal]Prod[uctOnly]OSFull 預設為: ServerTokens Full 分別說明: ServerTokens Prod[uctOnly] –> 伺服器可能回傳: Server: Apache

ServerTokens Major –> 伺服器可能回傳: Server: Apache/2

ServerTokens Minor –> 伺服器可能回傳: Server: Apache/2.0

ServerTokens Min[imal] –> 伺服器可能回傳: Server: Apache/2.0.41

ServerTokens OS –> 伺服器可能回傳: Server: Apache/2.0.41 (Unix)

ServerTokens Full (or not specified) –> 伺服器可能回傳:Server sends (e.g.): Server: Apache/2.0.41 (Unix) PHP/4.2.2 MyMod/1.2

因此,若要讓回傳的資訊最少,則可以在 httpd.conf 中加入:

ServerTokens Prod

關閉 HTTP TRACE 功能

HTTP TRACE 是一個 HTTP request method,主要是用來做 debug,此方法會回傳 client 的 HTTP request 內容,並放置於於 TRACE response 中的 entity body。因此,惡意攻擊者可利用此方法取得敏感的伺服器資訊,例如 cookies 或表頭中的認證資料。此方法預設為打開,但為了安全方面的考量,最好將此方法給關閉。

一般來說,您可以利用mod_rewrite來關閉 HTTP TRACE 的功能,首先將 httpd.conf 中的 LoadModule rewrite_module modules/mod_rewrite.so 註解打開,讓 HTTP 有mod_rewrite 的功能,並且在加入下列的規則:

RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]

如果您的 Apache 版本是 2.0 以上,則有比較快速的方法來關閉(因為上述的方法必須開啟 mod_rewrite 的功能):

TraceEnable off

如此則關閉了 HTTP TRACE 的功能。

參考文章: http://wiki.oss.org.tw/index.php/Apache_Tips#.E9.97.9C.E9.96.89_HTTP_TRACE_.E5.8A.9F.E8.83.BD

備註:若apache為2.0版本以上,在httpd.conf加入兩行code:
ServerTokens Prod
TraceEnable off

三月 3rd, 2009 Posted by 原罪 | Linux, freebsd | no comments

MailScanner 安裝設置(中文版) — mailscanner.conf

From:http://linux.vbird.org/somepaper/20030905-mailscanner-conf.htm

譯者林毓能(Linul)linul@tslg.idv.tw日期2003/09/05譯於http://www.tslg.idv.tw

所有的設設值都包含在/opt/mailscanner/etc/mailscanner.conf這個檔案中(隨各個套件設定而有所不同),每一個都會以下的內容進

行說明,如果要使用不同的設置檔,請修改MailScanner的命令列。

空白列會被忽略,和一開頭延伸至之後的空白格意思是一樣的,而註釋則是由開頭為『#』的符號開始,之後的一整行都為註釋,所以的選項的格式都如下所示:

option=value

許多的選項中的規則設定也可能是包含在特定的檔案中,可以用來控制使用資訊位址(addressofmessages),或是從哪個IPAddress來的message的功能,你將會在MailScanner安裝目錄中的etc/rules目錄中發現一些MailScanner規則的範例及說明。

在以下的說明中,這些選項都被使用類型分類,並列表出來,而且同樣的依順序排列在mailscanner.conf中。

假若您覺的這些看起來非常多的話,先不用擔心,mailscanner.conf提供了很多實用的預設值,你也許只需要修改些許部份就可以開始使用MailScanner了。

四月 9th, 2008 Posted by 原罪 | Linux, freebsd | no comments

在安裝Spamassassin時,發生了以下not fund的一些訊息…

在安裝Spamassassin時,發生了以下not fund的一些訊息…

===>   p5-Mail-SpamAssassin-3.2.4_2 depends on package: p5-Net-DNS>=0.60 - not found
===>    Verifying install for p5-Net-DNS>=0.60 in /usr/ports/dns/p5-Net-DNS
     => No directory for p5-Net-DNS>=0.60.  Skipping..
===>   p5-Mail-SpamAssassin-3.2.4_2 depends on package: p5-IO-Zlib>=1.04 - not found
===>    Verifying install for p5-IO-Zlib>=1.04 in /usr/ports/archivers/p5-IO-Zlib
     => No directory for p5-IO-Zlib>=1.04.  Skipping..
===>   p5-Mail-SpamAssassin-3.2.4_2 depends on package: p5-IO-Compress-Zlib>=2.04 - not found
===>    Verifying install for p5-IO-Compress-Zlib>=2.04 in /usr/ports/archivers/p5-IO-Compress-Zlib
     => No directory for p5-IO-Compress-Zlib>=2.04.  Skipping..
===>   p5-Mail-SpamAssassin-3.2.4_2 depends on package: p5-Compress-Zlib>=2.04 - not found
===>    Verifying install for p5-Compress-Zlib>=2.04 in /usr/ports/archivers/p5-Compress-Zlib
     => No directory for p5-Compress-Zlib>=2.04.  Skipping..
:
:
:(…略)

二月 24th, 2008 Posted by 原罪 | freebsd | no comments

unknown LIBTOOL version: 15.

usr空間爆掉事件後,安裝mysql50時又發生了「unknown LIBTOOL version: 15.」事件,莫非又是cvsup惹的禍?

經爬文詳查後,發現也有網友發生類似的狀況…

ports安裝時,會去驗證LIBTOOL,而發生「unknown LIBTOOL version: 15.」的Error code,原因也在於cvsup沒去抓ports-devel所導致的.

解決辦法很簡單…

二月 23rd, 2008 Posted by 原罪 | freebsd | no comments

使用cvsup去更新ports-tree後,發現/usr空間不足

# uname -r
6.2-RELEASE

掛載usr的容量,原本是切割1500M給它…
在cvsup後,發現掛載usr的容量空間不足,爆掉了…(如圖1)

usr-1.jpg
(圖1)  有效的容量空間竟然是  -116M

二月 23rd, 2008 Posted by 原罪 | freebsd | no comments

ports-tree不存在mod_php5?

cvsup更新ports-tree後,在安裝PHP時發現…

# uname -r
6.0-RELEASE 

# cd /usr/ports/www/mod_php5
/usr/ports/www/mod_php5: No such file or directory.

那A安內?! 

二月 18th, 2008 Posted by 原罪 | freebsd | no comments

架構基於FreeBSD和Postfix虛擬域郵件系統5.5

文章來源:http://www.thismail.org/bbs/viewthread.php?tid=2685&page=1&extra=page%3D1

架構基於Free BSD和Postfix虛擬域郵件系統5.5

架構基於Free BSD和Postfix虛擬域郵件系統5.5

Copyright c 2004、2005、2006、2007、2008

本文介紹使用FreeBSD+Postfix+Mysql+cyrus-sasl+Courier-ima+Maildrop+spamassasin+clamav來架構一個具有多域名,有webmail防病毒和垃圾郵件並有web管理界面的郵件系統。實現發郵件數量限制。類似於163的那種,一天只能發多少封郵件。

Jacky, $Revision: 5.5 bate $Date: 2007-12-13
 

二月 18th, 2008 Posted by 原罪 | freebsd | no comments

setting X11BASE=${LOCALBASE} in make.conf.

cvsup更新ports-tree後,使用/usr/ports去安裝任何一個套件時,會發生以下訊息:

# make install clean
On FreeBSD before 6.2 ports system unfortunately can not set default X11BASE by itself so please help it a bit by setting X11BASE=${LOCALBASE} in make.conf.
On the other hand, if you do wish to use non-default X11BASE, please set variable USE_NONDEFAULT_X11BASE.
*** Error code 1

二月 6th, 2008 Posted by 原罪 | freebsd | no comments

安裝cvsup

在用ports安裝套件時,養成先用cvsup去更新的好習慣.
1.先安裝cvsup(若未安裝,則會出現 cvsup:Command not found. 的訊息)

# cd /usr/ports/net/cvsup-without-gui
# make install clean

2.接著應該會看到Options for libiconv的畫面(FreeBSD 6.0 為例) ↓

一月 30th, 2008 Posted by 原罪 | freebsd | no comments

如何刪除ports安裝的套件

會用ports安裝,總也要學會移除、刪除(學也要學整套的嘛)
方法有很多種 …

1.可以到ports的路徑下,使用make deinstall
例如…

一月 27th, 2008 Posted by 原罪 | freebsd | no comments