作者 主題: Apache 的 FollowSymLinks 和 Security 有關嗎?  (閱讀 10075 次)

0 會員 與 1 訪客 正在閱讀本文。

chienwen

  • 懷疑的國中生
  • **
  • 文章數: 37
    • 檢視個人資料
    • 線上字典
引用
FollowSymLinks
    The server will follow symbolic links in this directory.

    Even though the server follows the symlink it does not change the pathname used to match against <Directory> sections.

    Note also, that this option gets ignored if set inside a <Location> section.

    Omitting this option should not be considered a security restriction, since symlink testing is subject to race conditions that make it circumventable.
( http://httpd.apache.org/docs/2.2/mod/core.html#options )

請教紅字部分的意思,是不是說「不要為了安全性而刪除這個選項」?
:D

darkranger

  • 榮譽學長
  • 俺是博士!
  • *****
  • 文章數: 1384
    • 檢視個人資料
    • https://darkranger.no-ip.org
有人討論過了:
http://archive.netbsd.se/?ml=apache-docs&a=2008-09&t=8625428

但我還是不知道怎麼解釋它....

chienwen

  • 懷疑的國中生
  • **
  • 文章數: 37
    • 檢視個人資料
    • 線上字典
http://www.maxi-pedia.com/FollowSymLinks
這邊提到,用 mod_rewrite 是一定要打開 FollowSymLinks。

引用
FollowSymLinks must be enabled when using mod_rewrite. If FollowSymLinks is disabled together with mod_rewrite, you will encounter the 500 internal server error.

我在使用 mediawiki 的 short URL 時,用到 mod_rewrite。
http://www.mediawiki.org/wiki/Manual:Short_URL

若是一定要用 FollowSymLinks,又擔心 security,這邊建議改用 SymlinksIfOwnerMatch,副作用是造成效能減慢:
http://onlamp.com/pub/a/apache/2004/02/19/apache_ckbk.html
引用
Problem
You wish to balance the security needs associated with symbolic links with the performance impact of a solution, such as using Options SymLinksIfOwnerMatch, which causes a server slowdown.
Solution
For tightest security, use Options SymlinksIfOwnerMatch, or Options -FollowSymLinks if you seldom or never use symlinks.
For best performance, use Options FollowSymlinks.

看來電腦和人一樣,想要穿的露骨一點 (short URL),就要小心著涼!
:D

redjack

  • 活潑的大學生
  • ***
  • 文章數: 426
    • 檢視個人資料
看來電腦和人一樣,想要穿的露骨一點 (short URL),就要小心著涼!

還有怪叔叔 XD
Knowledge is Power

chienwen

  • 懷疑的國中生
  • **
  • 文章數: 37
    • 檢視個人資料
    • 線上字典
引用
Omitting this option should not be considered a security restriction, since symlink testing is subject to race conditions that make it circumventable.
整句話的意思,我體會出來了,意即:
「不要為了安全性而刪除這個選項,應該用符號連結檢測去減低這個風險。」

也就是說:
1. FollowSymLinks 確實會造成風險。
2. 但省略 FollowSymLinks 可能造成網頁無法執行、或降低效能。
3. 若你擔心 symlink 造成風險,應該去檢查 symlink,而不是關掉 FollowSymLinks。

註: 這個指令就可以找出 symlink 來檢查:
find /usr/local/apache/htdocs -type l -print
:D