簡體   English   中英

IIS 服務器:限制用戶訪問服務器文件

[英]IIS Server: Restrict users to access files of server

我有一台服務器,它允許用戶免費托管他們的 web 應用程序。

在服務器中,我有 4 個不同的池。

2個池用於.Net Framework,1個池用於.Net MVC,1個池用於.Net Core 3.1

每個池有 50 多個應用程序。

對於安全測試,我創建了一個程序,它采用文件的完整路徑/位置並從 IIS 服務器讀取該文件。 如果任何用戶在我的服務器中上傳該類型的代碼,那么他們可以評估任何文件。

現在,這是我的服務器的問題。

現在,我想做的是,我的用戶只能訪問他們的應用程序資源,而不能訪問其他人的。

但是,我不知道該怎么做。

為了限制用戶訪問 IIS 中的文件,我們可以參考根 web.config 文件中的以下配置。

<location path="myfolder">
<system.webServer>
    <security>
        <authorization>
            <remove users="*" roles="" verbs="" />
         <!--for authentication, we should enable either windows authentication or form authentication in IIS authentication module.-->
            <add accessType="Allow" roles="Administrators" />
        </authorization>
    </security>
</system.webServer>
</location>

它將限制Myfolder下的所有內容。 特別是,排除特定文件。

     <location path="my.jpg">
     <system.webServer>
         <security>
             <authorization>
                 <remove users="*" roles="" verbs="" />
                 <add accessType="Allow" roles="Administrators" />
             </authorization>
         </security>
     </system.webServer>
 </location>

如果有什么我可以幫忙的,請隨時告訴我。

暫無
暫無

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

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