簡體   English   中英

安全問題IIS7.5 / IIS APPPOOL \用戶未經授權但具有完全控制權?

[英]security issue IIS7.5 / IIS APPPOOL\user not authorized but has full control?

我的安全性似乎有一個奇怪的問題:

我有一個包含以下文件夾的網站:

  • 的Inetpub \\ wwwroot文件
  • 的Inetpub \\ wwwroot的\\ readyfordownload

IIS APPPOOL \\ Classic用戶可以完全訪問此“readyfordownload”文件夾。

現在我有一個控制台APP,它在readyfordownload文件夾中創建一個zipfile。 這是從ac#classlib完成的。 奇怪的是,IIS APPOOL無法訪問此文件,即使它完全控制該文件夾。 此外,classlib首先創建一個xlsx文件,稍后將其添加到zip中。 APPPOOL用戶可以訪問xlsx文件。

如果我從網站后面的代碼在C#classlib中運行相同的函數,則會創建相同的zip文件,並且IIS APPPOOL用戶可以訪問該文件....

有任何想法嗎?

zip是這樣創建的(不是實際代碼,但它是一樣的) http://dotnetzip.codeplex.com/

  using (ZipFile zip = new ZipFile())
 {
     // add this map file into the "images" directory in the zip archive
             zip.AddFile("test.xlsx");
     zip.Save("MyZipFile.zip");

}

操作系統是Windows 2008 R2 Web服務器ZIP庫是Dotnetzip(Ionic)

更新:我最感興趣的是為什么ZIP文件沒有獲得權限,xlsx文件確實....

您是否嘗試過明確設置FileAccessSecurity 也許文件不是從目錄繼承ACL。

apppool用戶可以訪問xlsx文件,因為您的控制台直接在readyfordownload文件夾下創建它。

另一方面,zip文件首先在臨時文件夾中創建,然后復制到您的文件夾中。 這意味着文件上的文件權限設置錯誤。

  1. 確保IIS_IUSR和DefaultAppPool用戶可以訪問您的wwwroot。

  2. 正如scottm建議更改您的控制台代碼,以便為zip文件上的IUSR和DefaultAppPool用戶授予權限。 您的代碼應如下所示:

      using (ZipFile zip = new ZipFile()) { // add this map file into the "images" directory in the zip archive zip.AddFile("test.xlsx"); zip.Save("MyZipFile.zip"); var accessControl = File.GetAccessControl("MyZipFile.zip"); var fileSystemAccessRule = new FileSystemAccessRule( @"BUILTIN\\IIS_IUSRS", FileSystemRights.Read | FileSystemRights.ReadAndExecute, AccessControlType.Allow); var fileSystemAccessRule2 = new FileSystemAccessRule( @"IIS AppPool\\DefaultAppPool", FileSystemRights.Read | FileSystemRights.ReadAndExecute, AccessControlType.Allow); accessControl.AddAccessRule(fileSystemAccessRule); accessControl.AddAccessRule(fileSystemAccessRule2); File.SetAccessControl(path, accessControl); } 

檢查Windows EventLog是否存在相關錯誤。 有關詳細信息,請使用ProcessMonitor ,以便查看權限是否存在問題。

使用“高級安全設置屬性頁”配置文件夾的安全性。 (選擇屬性 - >安全性)。 另請注意,應用程序池可以模擬用戶,以便應用程序可能無法使用應用程序池的標識提供請求。 默認情況下,模擬可能無效。 您必須在Web配置中明確設置它。 例如<identity impersonate="true" /><identity impersonate="true" userName="domain\\user\u0026quot; password="password" />

Sriwantha Sri Aravinda

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM