Windows Server 2008 中 Windows Server Backup 學習筆記

Windows Server Backup (WSB) 是一種全新的備份方式,對用慣 NTBACKUP 的人來說,很難直接透過 MMC 操作介面就理解實際的運作方式,一定要認真看書或文章才能理解 Windows Server Backup 這個新玩意,我特別將我這幾天吸收的幾個重要觀念整理一下,好東西要跟好朋友分享。

備份方式的差異

  • NTBACKUP 是以檔案為主(file-based)的備份和還原工具
    • 你可以備份檔案到任意目錄、UNC 或磁帶(Tape)上
  • Windows Server Backup 則是以磁碟(volume)和區塊為主(block-based)的備份和還原工具
    • 你只能備份「磁碟(Volume)」或「磁碟分割(Partition)」到「另一個實體磁碟」
    • 你也可以備份到 UNC 路徑,只是效能不好

Windows Server Backup (WSB) 的重要觀念

  • WSB 依賴磁碟區陰影複製服務快照集(Volume Shadow Copy Service snapshots)
  • 我第一次看到 [單次備份精靈] / [指定進階選項] 時當下立即傻眼,完全看不懂這段話的意思

單次備份精靈 / 指定進階選項

  • WSB 有「完整備份」和「增量備份」,但本質上都是「完整備份」只是備份的方式不同。若看 [最佳化備份效能] 的說明文字還可以理解一點點,不過只算 Know How 但還是不知道 Know Why

    最佳化備份效能
  • 「完整備份」利用「備份目標磁碟」的進行磁碟區陰影複製服務快照集增量比對
    • 快照集只會儲存變更過的區塊
    • 優點:備份時不會影響原系統的執行效能。
    • 缺點:使用「完整備份」會依賴目標磁碟磁碟區陰影複製服務的運算,所以在比對資料區塊(block)差異時會花較多時間,所以備份時間比較長。
  • 「增量備份」利用「備份來源磁碟」的進行磁碟區陰影複製服務快照集增量比對
    • 快照集只會儲存變更過的區塊
    • 優點:由於比對本機磁碟的陰影複製快照集比較快,所以可以節省備份時間。
    • 缺點:使用「增量備份」會依賴來源磁碟磁碟區陰影複製服務的運算,所以當本機磁碟 I/O 繁重時,會對系統效能帶來衝擊。
    • 建議:當「來源磁碟」的磁碟 I/O 過重時,建議採用「完整備份」。

HOW TO: 如何手動備份系統狀態(System State)

除了原本本機磁碟以外,必須多準備一個磁碟或分割區(假設為 F: ),透過以下指令才能備份:

wbadmin start systemstatebackup -backupTarget:f:

C:\>wbadmin start systemstatebackup -backupTarget:f:
wbadmin 1.0 - 備份命令列工具
(C) Copyright 2004 Microsoft Corp.

正在啟動系統狀態備份 [2009/7/24 下午 08:42]
正在抓取磁碟區資訊...

這會將系統狀態從磁碟區 SYSTEM(C:) 備份到 f:。
您是否要開始備份作業?
[Y] 是 [N] 否 y

正在建立備份要求之磁碟區的陰影複製。
正在建立備份要求之磁碟區的陰影複製。
正在識別要備份的系統狀態檔案 (這可能需要幾分鐘的時間)...
找到 (770 個) 檔案
找到 (1584 個) 檔案
找到 (2764 個) 檔案
找到 (4321 個) 檔案
找到 (5451 個) 檔案
找到 (7416 個) 檔案
找到 (9223 個) 檔案
找到 (10783 個) 檔案
找到 (13247 個) 檔案
找到 (15293 個) 檔案
找到 (20895 個) 檔案
找到 (28872 個) 檔案
找到 (30905 個) 檔案
找到 (34560 個) 檔案
找到 (40137 個) 檔案
找到 (45335 個) 檔案
找到 (49797 個) 檔案
找到 (55012 個) 檔案
找到 (59121 個) 檔案
找到 (64253 個) 檔案
找到 (64253 個) 檔案
找到 (64253 個) 檔案
找到 (64253 個) 檔案
找到 (64253 個) 檔案
找到 (64253 個) 檔案
系統狀態檔案的搜尋完成
正在啟動檔案的備份
整體進度 - 0% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 0% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 0% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 0% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 1% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 2% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 2% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 3% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 3% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 4% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 4% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 4% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 5% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 5% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 6% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 6% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 7% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 7% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 7% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 8% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 8% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 9% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 10% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 10% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 11% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 12% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 13% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 14% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 14% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 15% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 16% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 17% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 17% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 18% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 18% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 18% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 19% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 20% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 20% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 21% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 21% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 22% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 22% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 22% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 22% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 23% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 23% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 24% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 24% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 25% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 25% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 25% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 26% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 27% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 27% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 28% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 29% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 30% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 31% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 32% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 33% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 33% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 34% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 34% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 35% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 36% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 37% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 38% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 39% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 39% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 40% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 41% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 42% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 43% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 44% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 44% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 45% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 46% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 47% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 47% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 47% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 47% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 48% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 49% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 50% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 51% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 51% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 52% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 52% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 52% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 53% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 54% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 56% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 56% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 56% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 56% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 56% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 56% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 57% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 57% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 57% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 57% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 57% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 57% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 57% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 57% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 57% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 57% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 58% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 58% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 58% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 58% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 58% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 58% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 58% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 58% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 58% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 58% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 58% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 58% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 59% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 60% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 60% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 62% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 62% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 63% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 64% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 64% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 64% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 64% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 65% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 65% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 66% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 67% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 67% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 68% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 69% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 69% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 71% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 72% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 73% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 74% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 75% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 75% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 76% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 77% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 77% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 79% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 79% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 80% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 82% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 84% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 87% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 87% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 88% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 88% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 89% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 89% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 90% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 90% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 91% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 92% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 92% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 93% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 93% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 94% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 95% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 95% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 96% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 97% (目前正在備份 'System Writer' 報告的檔案)
整體進度 - 97% (目前正在備份 'System Writer' 報告的檔案)
由 'System Writer' 報告的檔案備份已完成
整體進度 - 98% (目前正在備份 'FRS Writer' 報告的檔案)
由 'FRS Writer' 報告的檔案備份已完成
由 'IIS Config Writer' 報告的檔案備份已完成
由 'IIS Metabase Writer' 報告的檔案備份已完成
由 'WMI Writer' 報告的檔案備份已完成
由 'COM+ REGDB Writer' 報告的檔案備份已完成
整體進度 - 99% (目前正在備份 'NTDS' 報告的檔案)
由 'NTDS' 報告的檔案備份已完成
由 'Registry Writer' 報告的檔案備份已完成
整體進度 - 99% (目前正在備份其他系統狀態檔案)

備份的摘要:
------------------

已順利完成系統狀態的備份 [2009/7/24 下午 09:16]

已順利備份檔案記錄
'C:\Windows\Logs\WindowsServerBackup\SystemStateBackup 24-07-2009 20-42-21.log'

由於 Windows Server Backup 在備份「系統狀態」時並不會像在正常備份程序一樣建立目標磁碟區的快照集,而是由每一個系統狀態備份產生全新一組的 VHD 檔案,所以非常佔空間,像我公司的 AD 備份完系統狀態後的大小為 8GB,也挺占空間的。

另外,WBADMIN 會將重要的系統檔案應用程式資料庫備份到目標磁碟區,檔案會置於為系統狀態備份保留的資料夾中。備份大小會比以前 NTBACKUP 的備份多出 5GB 的空間,這是因為 WSB 會備份作業系統的核心檔案。

相關連結

  

此文章由 will 發表於 2009/7/31 下午 04:38:07

永久連結 | 評論 (0) | 此文章的RSSRSS comment feed |

分類: 系統管理

標籤: , , , , ,

收藏:

避免 ActiveX 攻擊: 立即下載 MS09-034, MS09-035 安全更新

台灣微軟昨天發佈兩個緊急安全更新補充程式編號 MS09-034 (重大) 與 MS09-035 (中度) 與 安全性摘要報告 973882,並強烈呼籲所有用戶應立即更新電腦,以避免電腦遭受攻擊,各位可以透過 Windows Update 自動更新 或透過以下網址下載安全更新補充程式。

上述的網址內包括許多更新檔的下載連結,如果不知道怎麼選就靠 Windows Update 幫你更新就對了。

這次 Visual Studio 2008 SP1 的更新檔非常大,有 365.2 MB 之多,我發現有許多人透過 Windows Update 會失敗,遇到這種情況建議自行下載更新補充程式執行安裝,這樣比較能知道錯誤發生在哪裡,更新過程可能需要重開機才能完成安裝。

想瞭解本次 Active Template Library (ATL) Security Update 的人也許想看看以下這個影片:

相關連結

  

此文章由 will 發表於 2009/7/30 上午 11:57:43

永久連結 | 評論 (0) | 此文章的RSSRSS comment feed |

分類: Visual Studio | Security | 系統管理

標籤: , , , , , ,

收藏:

推薦使用 Microsoft Anti-Cross Site Scripting Library V3.0

微軟最近推出了 Microsoft Anti-Cross Site Scripting Library V3.0 正式版(RTM),但在國內似乎沒看到許多人提到這套函示庫,就我來觀察有幾點可能的原因:

從 Wikipedia 上的 Cross-site scripting (XSS) 提到 XSS 有三種類型:

  • 非固定式 XSS 攻擊 (Non-persistent)
    1. 這是最常見的攻擊類型,日前好幾次大規模 XSS 攻擊事件都是此類攻擊。
    2. 沒經驗的開發人員最容易遭受此類型的 XSS 攻擊。
    3. 像 Request, Request.Form, Request.QueryString, Request.Cookie, Request.Headers 等等都是常見的攻擊來源。
  • 固定式 XSS 攻擊 (Persistent)
    • 又稱 Stored-XSS 攻擊。
    • 駭客會試圖將「攻擊 XSS 字串」透過各種管道寫入到目標網站的資料庫中,讓瀏覽網站的使用者下載病毒、執行特定指令碼、當成 DDoS 的跳板、…等等。
  • 以 DOM 為基礎的 XSS 攻擊 (DOM-based)
    • 此類型會利用網頁透過 JavaScript 動態顯示資訊到頁面中(透過 DOM 修改內容),但內容並未透過 HtmlEncode 過,導致遭駭客傳入惡意指令碼(JavaScript或VBScript)並讓使用者遭殃,或試圖修改原有網頁中的資訊用以欺騙使用者執行特定動作或進行資訊詐騙。
    • 另一種是透過 Browser 的漏洞將 JavaScript 先寫入本機電腦,然後在透過被 XSS 攻擊過的網頁載入本機 JavaScript 檔案進行本機電腦的攻擊,例如植入病毒或木馬之類的程式。

我們都知道在 ASP.NET 中預設都會阻擋可能會導致 XSS 攻擊的字串,例如 < 或 > 符號。相關資訊可參考:How To: Prevent Cross-Site Scripting in ASP.NETRequest Validation - Preventing Script Attacks,建議每位開發人員都應該閱讀這幾篇文章。

不過若因為專案所需,例如「網站後台」為了內容管理的需求可能就會將這項基本防護功能關閉,這時就有可能會讓你的資料庫被污染,以導致被攻擊的 HTML/Scripting 被輸出到前台網頁上。

有經驗的 ASP.NET 開發人員都知道如何撰寫阻擋 XSS 的程式碼,一個最簡單的也最常見的防護方式就是在頁面輸出變數時都一律加上 HttpUtility.HtmlEncode 方法,但頁面多或開發人員多的時候可就不見得頁面每一個地方都能記得加上,除非你有錢購買靜態程式碼分析軟體定期分析你的 ASP.NET 專案。

從上述得知,你能夠在 ASP.NET 專案中做出的努力都稱為:「黑名單防護策略」,也就是針對特定網頁明確寫程式阻擋 XSS 攻擊,沒寫到的地方就破功了。

而採用 Anti-XSS Library 最大的不同就在於它採用「白名單防護策略」,預設將會以最嚴格的設定預防所有潛在的 XSS 攻擊,只有特定編碼的字元、允許的特殊符號可以允許通過 HTTP 傳輸,任何在設定以外的字元或發現潛在的 XSS 攻擊行為時就會對相關字元進行編碼,例如:HtmlEncode、UrlEncode、LDAP Encode、XPath Encode、… 等。

在安裝的時候預設安裝路徑為:C:\Program Files\Microsoft Information Security\Microsoft Anti-Cross Site Scripting Library v3.0\ ,過程中提供兩個選項讓你安裝:

Microsoft Anti-Cross Site Scripting Library V3.0 -- 預設安裝路徑為:C:\Program Files\Microsoft Information Security\Microsoft Anti-Cross Site Scripting Library v3.0\

分別說明如下:

Anti-Cross Site Scripting Library

  • 這個是一個 .NET 組件,提供一個 Microsoft.Security.Application 命名空間,與一個 AntiXSS 類別,類別中有許多靜態方法方便開發人員在 ASP.NET 專案中直接套用。
  • 內建的方法包括有HtmlEncode, JavaScriptEncode, UrlEncode, VisualBasicScriptEncode, XmlAttributeEncode, XmlEncode 等,每個方法都有一些特殊方法,值得研究一下。
  • 完整的說明請參見 "C:\Program Files\Microsoft Information Security\Microsoft Anti-Cross Site Scripting Library v3.0\Help\Anti-XSS_Library_Help.chm" 說明文件。
  • 這個 Library 也適用於 ASP.NET MVC 類型的專案。

Security Runtime Engine (SRE)

  • SRE 是一個用 .NET 撰寫而成的 HTTP module,可透過 web.config 設定載入 HTTP module 並透過 antixssmodule.config 設定檔的定義(放在應用程式根目錄)即可自動保護整個 ASP.NET 網站。(備註:SRE 較不適用於 ASP.NET MVC 專案
  • 在 C:\Program Files\Microsoft Information Security\Microsoft Anti-Cross Site Scripting Library v3.0\Security Runtime Engine\ConfigGen 目錄下有提供一個 ConfigGen.exe 程式可分析 ASP.NET 發佈的預先編譯網站的 dll 組件,並依據網站內使用的 ASP.NET 控制項進行分析,將一些經常遭受 XSS 攻擊的控制項進行自動防護作業。例如針對 Page.Title 屬性、Label 控制項的 Text 屬性、CheckBox 控制項的 Text 屬性、…等等。
  • 以下是 antixssmodule.config 的設定範例:
<?xml version="1.0" encoding="utf-8"?>

  <Configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  
  <!--This section lists the controls and encoding contexts supported by SRE-->
  <ControlEncodingContexts>
      <ControlEncodingContext FullClassName="System.Web.UI.WebControls.Label" PropertyName="Text" EncodingContext="Html" />
      <ControlEncodingContext FullClassName="System.Web.UI.WebControls.HyperLink" PropertyName="Text" EncodingContext="Html" />
  </ControlEncodingContexts>
  
  <!--This section can be used to configure double encoding support-->
  <DoubleEncodingFilter Enabled="True" />
  
  <!--This section can be used to configure encoding for derived controls-->
  <EncodeDerivedControls Enabled="True" />
  
  <!--This section can be used to configure color coding of the output -->
  <MarkAntiXssOutput Enabled="False" Color="Blue"/>

  <!--This section includes the configuration for suppressing SRE for the listed files and folders-->
  <Suppressions>
      <Exclude Path="/Page_1.aspx" />
      <Exclude Path="/ExcludedDirectory/Page_2.aspx" />
  </Suppressions>

</Configuration>
        

套用 Security Runtime Engine (SRE) HTTP module 會對網站執行效能帶來一些衝擊,不過衝擊並不大,基於安全考量應該可以接受。

在 "C:\Program Files\Microsoft Information Security\Microsoft Anti-Cross Site Scripting Library v3.0\Sample Application" 目錄下有個簡易的範例程式,可以讓你徹底感受這套軟體的威力,在 web.config 裡的 validateRequest 設定為 false 的情況下,也能夠讓你的網站遠離 XSS 攻擊的威脅。

ASP.NET MVC 專案建議可以使用 Anti-Cross Site Scripting Library 搭配先前介紹的 CAT.NET 進行網站安全防護與安全檢測。

相關連結

  

此文章由 will 發表於 2009/7/28 下午 09:19:15

永久連結 | 評論 (4) | 此文章的RSSRSS comment feed |

分類: Security | .Net | ASP.NET | ASP.NET MVC | Web

標籤: , ,

收藏:

ASP.NET MVC 開發心得分享 (9):發佈 MVC 網站的方式

之前曾經寫過【ASP.NET 網站部署可考慮使用 Web Deployment Project 】而我們所有的 ASP.NET 專案也幾乎都用 WDP 部署網站,連 ASP.NET MVC 也不例外。但我們之前有個專案因為需要開發多國語系網站,因此會用到 App_GlobalResources 目錄放置網站所需的資源檔(*.resx),在透過 WDP 封裝部署之後就會全部編譯成組件,而且預先編譯(Pre-compiled)過的網站是不允許動態編譯的,也就是說透過 WDP 部署含有資源檔的專案會造成日後資源檔維護的困擾。

因為客戶希望網站部署之後能透過 Lutz Roeder's .NET Resourcer 更新各國語系的翻譯內容,如果利用 WDP 部署的話,就變成每次都要重新編譯網站,這樣就太大費周章了。

遇到這種類型的專案,就必須改用 Visual Studio 2008 中的發佈網站(Publish)功能,就可以保留全域資源檔 (App_GlobalResources) 在輸出的目錄,並且可以在部署後隨時更新資源檔的內容。

Visual Studio 2008 中的發佈網站(Publish)功能   保留全域資源檔 (App_GlobalResources) 在輸出的目錄,並且可以在部署後隨時更新資源檔的內容 

採用 Publish 部署方式的缺點就是無法自訂 WDP 中的 MSBuild Task 設定,這樣就會導致有些原本希望自動化的作業無法達成,例如部署後刪除特定目錄或檔案之類的動作。

相關連結

  

此文章由 will 發表於 2009/7/27 上午 11:12:50

永久連結 | 評論 (0) | 此文章的RSSRSS comment feed |

分類: ASP.NET MVC

標籤: , , , ,

收藏:

影片:Microsoft Expression Web 3 SuperPreview 使用教學

Microsoft Expression Web 3 SuperPreview 是個非常簡單易用的網頁版型比較軟體,可讓網頁設計人員在網頁設計完成後得以透過 SuperPreview 比對 IE6, IE7, IE8, Firefox 等瀏覽器的顯示差異,是個非常強大且實用的工具,這次我利用錄影的方式讓大家能更清楚的能發現 SuperPreview 的強大威力。

這是我第一次用畫面錄影的方式做教學,採用 Tech SmithCamtasia Studio 畫面錄影工具錄製,過程還算順利,一共錄了 10 分鐘,但過程吃了不少螺絲,害我花了三個小時做剪接,把一些吃囉絲、口吃、腦筋一片空白的部分刪掉。^_^

※ 備註:開始播放後可點選 HD 的版本,聲音與畫面會好一點點或可下載原始尺寸的影音檔。

原始影片下載 ( 若下載的影片無法播放,請安裝 TechSmith Screen Capture Codec )

錄製心得

一個人自言自語才是最需要克服的心理障礙!

2009-07-30 更新:Microsoft Expression Web 3 SuperPreview 使用教學 (完整版)

這幾天發現漏講了 Toggle Guide Visibility 的功能,因此補充後重新上傳如下:

※ 備註:開始播放後可點選 HD 的版本,聲音與畫面會好一點點或可下載原始尺寸的影音檔。

原始影片下載 ( 若下載的影片無法播放,請安裝 TechSmith Screen Capture Codec )

相關連結

  

此文章由 will 發表於 2009/7/26 下午 06:50:56

永久連結 | 評論 (7) | 此文章的RSSRSS comment feed |

分類: 介紹好用工具 | Web

標籤: , ,

收藏: