如何在 .net 中禁用 fips

发布于 2024-09-28 14:29:35 字数 471 浏览 0 评论 0原文

我想在 asp .net x64 应用程序中禁用 fips。在 web.config 中,我添加了

<runtime>
    <enforceFIPSPolicy enabled = "false">
</runtime>

将 debug 设置为 false。

但是我的应用程序不起作用。我应该在 << 中声明运行时部分吗?配置部分> ?如果是,那么这是一条正确的线

<section name="runtime" type="System.Configuration.IgnoreSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowLocation="false"/>

I want to disalbe fips in asp .net x64 application. In web.config I added

<runtime>
    <enforceFIPSPolicy enabled = "false">
</runtime>

I set debug to false.

However my application do not work. Should I declare runtime section in < configSections > ? If yes then is it a proper line

<section name="runtime" type="System.Configuration.IgnoreSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowLocation="false"/>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

随梦而飞# 2024-10-05 14:29:35

解决方案仅适用于 IIS >= 7.5

看起来 IIS 不允许您通过 Web 应用程序的 web.config 来操作此设置。一种解决方法是创建一个(或多个)专用应用程序池,并配置应用程序池的 CLR 并禁用 FIPS 强制。 IIS 7.5 引入了 CLRConfigFile 属性,您可以使用该属性来指定应用程序池的 .NET 配置文件。这使我们能够更精细地控制配置影响哪些应用程序 - 而不是我们在 machine.config 或组策略设置中禁用它的霰弹枪方法。

1. 创建一个配置文件 c:\inetpub\AppPoolClrConfig\noFipsWeb.config,其中包含以下内容(文件的位置和名称并不重要):

<configuration>
    <runtime>
        <enforceFIPSPolicy enabled = "false" />
    </runtime> 
</configuration>

2. 授予对文件的读取权限应用程序池运行的身份:

icacls c:\inetpub\AppPoolClrConfig\noFipsWeb.config /grant "IIS APPPOOL\YourAppPoolName":(R)

3. 通过设置池的 CLRConfigFile 属性来配置应用程序池以加载此配置文件:

cmd:

%windir%\System32\inetsrv\appcmd.exe set config  -section:system.applicationHost/applicationPools /[name='{AppPoolName}'].CLRConfigFile:"{FilePath}"  /commit:apphost

sample:

%windir%\System32\inetsrv\appcmd.exe set config  -section:system.applicationHost/applicationPools /[name='YourAppPoolName'].CLRConfigFile:"c:\inetpub\AppPoolClrConfig\noFipsWeb.config"  /commit:apphost

由于 IIS 7.5 中的错误,我们还需要清除managedRuntimeLoader 属性,否则 CLRConfigFile 将被忽略:

%windir%\System32\inetsrv\appcmd.exe set config  -section:system.applicationHost/applicationPools /[name='YourAppPoolName'].managedRuntimeLoader:""  /commit:apphost

4.重新启动 IIS。使用上述应用程序池的 Asp.NET 应用程序现在应该忽略 FIPS。

致谢:

Scott Forsyth 解释如何配置应用程序池使用与标准 aspnet.config 文件不同的 CLR 文件

Jose Reyes 记录了 IIS 7.5 中忽略 CLRConfigFile 属性的错误

Solution only works for IIS >= 7.5

It doesn't look like IIS allows you to manipulate this setting through a web application's web.config. One work-around is to create a dedicated App Pool (or multiple), and configure the App Pool's CLR with FIPS enforcement disabled. IIS 7.5 introduced a CLRConfigFile property that you can use to specify an App Pool's .NET configuration file. This gives us more granular control over which applications the configuration impacts - instead of the shotgun approach where we disable it in machine.config or the group policy setting.

1.Create a configuration file, c:\inetpub\AppPoolClrConfig\noFipsWeb.config, with the following content (the location and name of the file is immaterial):

<configuration>
    <runtime>
        <enforceFIPSPolicy enabled = "false" />
    </runtime> 
</configuration>

2.Grant read permissions on the file to the identity under which the App Pool runs:

icacls c:\inetpub\AppPoolClrConfig\noFipsWeb.config /grant "IIS APPPOOL\YourAppPoolName":(R)

3.Configure the App Pool to load this config file by setting the pool's CLRConfigFile property:

cmd:

%windir%\System32\inetsrv\appcmd.exe set config  -section:system.applicationHost/applicationPools /[name='{AppPoolName}'].CLRConfigFile:"{FilePath}"  /commit:apphost

sample:

%windir%\System32\inetsrv\appcmd.exe set config  -section:system.applicationHost/applicationPools /[name='YourAppPoolName'].CLRConfigFile:"c:\inetpub\AppPoolClrConfig\noFipsWeb.config"  /commit:apphost

Due to a bug in IIS 7.5, we need to also clear the managedRuntimeLoader property or else the CLRConfigFile will be ignored:

%windir%\System32\inetsrv\appcmd.exe set config  -section:system.applicationHost/applicationPools /[name='YourAppPoolName'].managedRuntimeLoader:""  /commit:apphost

4.Restart IIS. Your Asp.NET applications that are using the App Pool above should now be ignoring FIPS.

Credits to:

Scott Forsyth for explaining how to configure an app pool to use a different CLR file than the standard aspnet.config file.

Jose Reyes for documenting the bug in IIS 7.5 that ignored the CLRConfigFile Property

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文