如何自動將網站的 http:// 網址轉址為 https://

弱點掃瞄

弱點: Site does not enforce HTTPS

The site responds to HTTP requests without ultimately redirecting the browser to a secure version of the page. Since the site allows plaintext traffic, a man-in-the-middle attacker is able to read and modify any information passed between the site and the user. There are a variety of situations in which an attacker can intercept plaintext traffic in a man-in-the-middle position, including but not limited to:

  1. Open Wi-Fi Hotspots
  2. WPA/WPA2 encrypted hot-spots where the attacker connected before the victim
  3. Malicious Wi-Fi access points
  4. Compromised switches and routers
  5. ARP poisoning on the same wired network

It's important to remember that in many of the above situations, an attacker can not only read traffic, but also actively modify the traffic. Even if a site that does not contain sensitive information, an attacker can still inject malicious content to a user’s browser.

  • Severity: High
  • Risk: Site does not enforce the use of HTTPS encryption, leaving the user vulnerable to man-in-the-middle attackers (who can falsify data and inject malicious code).
  • Recommendation: Any site served to a user (possibly at the end of a redirect chain) should be served over HTTPS.

繼續閱讀

使用 .htaccess 簡單防護 WordPress 的管理程式

本站曾用過 Limit Login Attempts 這個 WordPress 的外掛程式,用以防止被暴力破解登入密碼。當有人一直以錯誤的密碼進行登入時,就會對其 IP 進行幾個小時的封鎖,然後 mail 通知你又有什麼 IP 被封鎖了,效果其實也還不錯。

不過其實只要用「.htaccess 的權限認證方式」,就可以針對 wordpress 的 wp-login.php 這個單一檔案做防護,也可以達到很好的效果。

.htaccess 認證

首先找一個安全的地方放置 .htusers 這個檔案。所謂的「安全」,是指至少不要在網頁可以被下載到的路徑.htusers 的設定方式請參考本站另一篇文章:

密碼請不要用跟 WordPress 原本的登入密碼一樣。

編輯 wordpress 目錄下的 .htaccess,在檔案最後如入:

AuthType Basic
AuthName "Restricted Area"
AuthUserFile "/path/to/.htusers"
<Files wp-login.php>
require valid-user
</Files>

如果你想進一步針對整個 wp-admin 目錄做防護,則進到 wordpress 下的 wp-admin 目錄,新增或編輯 .htaccess,一樣在檔案最後如入:

AuthType Basic
AuthName "Restricted Area"
AuthUserFile "/path/to/.htusers"
require valid-user

參考網頁

WordPress 的錯誤訊息: You don’t have permission to access post.php ...

如果你在上傳圖片時,出現:

 Http Error

或是發表文章時,出現

You don’t have permission to access /wordpress/wp-admin/post.php on this server.

這是 Apache 的 mod_security 造成之錯誤,這時候你可以在 wp-admin 的目錄下新增 .htaccess 檔案,內容如下:

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

這樣應該就可以輕鬆解決了。

參考網頁

  1. 窄多之Blog: PHP post error: Forbidden - You don't have permission to access
  2. Hongkiat: WordPress 2.5 Image Upload Error [Wordpress Fix]

[PHP]Simple Filelist 簡易檔案列表程式 *

檔案下載

  • 名  稱: Simple Filelist
  • 版  本: 1.1
  • 檔案大小: 3 KB
  • 語言介面: 英文版
  • 版本性質: Freeware
  • 釋出日期: 2006/11/20
  • 作業平台: Linux
  • 原創網站: Vixual
  • 檔案下載:

一般網站基於安全性及隱私權…等的原因,管理者通常會將網站上的目錄瀏覽功能(Indexes)給關閉,讓訪客無法直接看到網站上放了些什麼檔案。

但人性總是予盾的,關閉了的功能,在某些時候又會想要啟用,因為人們總是在失去的時候才感到後悔莫及...(Sorry,離題了)。因此,我就寫了這個簡單的 PHP 小程式,當我們需要在特定目錄啟用瀏覽的功能時 ,除了請管理者幫忙,或者自己修改「.htaccess」之外,只要有這個小程式就可以解決問題了。
繼續閱讀