【问题标题】:IIS Server: Restrict users to access files of serverIIS 服务器:限制用户访问服务器的文件
【发布时间】:2020-09-26 04:29:03
【问题描述】:

我有一台服务器,它允许用户免费托管他们的网络应用程序。

在服务器中,我有 4 个不同的池。

2 个池用于 .Net Framework, 1 个池用于 .Net MVC, 1 个池用于 .Net Core 3.1

每个池有 50 多个应用程序。

为了进行安全测试,我创建了一个程序,它采用文件的完整路径/位置并从 IIS 服务器读取该文件。如果任何用户在我的服务器上上传该类型的代码,那么他们可以评估任何文件。

现在,这是我的服务器的问题。

现在,我想做的是,我的用户只能访问他们的应用程序资源,而不能访问其他人的。

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

【问题讨论】:

    标签: security iis web-config hosting


    【解决方案1】:

    为了限制用户访问 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>
    

    如果有什么我可以帮忙的,请随时告诉我。

    【讨论】:

      猜你喜欢
      • 2014-08-26
      • 1970-01-01
      • 2018-02-13
      • 1970-01-01
      • 1970-01-01
      • 2012-01-27
      • 1970-01-01
      • 1970-01-01
      • 2020-09-02
      相关资源
      最近更新 更多