简体   繁体   English

IIS:给.NET授权增加一条Deny规则

[英]IIS: add a Deny rule to .NET Authorization

Afternoon guys,各位下午好

I'm working on going through some lockdowns for IIS, I need to add a Deny rule to .NET Authorizations for all anonymous users.我正在努力通过 IIS 的一些锁定,我需要为所有匿名用户添加拒绝规则到 .NET 授权。 I have this, which partially works我有这个,部分有效

Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT' -filter "system.web/authorization" -name "." -value @{accessType='Deny';users='?'}

? is an alias for All anonymous usersAll anonymous users的别名

It partially works, as in it creates the rule, but it's set as an Allow Rule even though I'm calling Deny .它部分起作用,因为它创建了规则,但即使我正在调用Deny ,它也被设置为Allow Rule

Does anyone have any ideas on how to get this to register as a Deny Rule ?有没有人对如何将其注册为Deny Rule有任何想法?

I ended up finding the answer in the Related section off to the side.我最终在旁边的Related部分找到了答案。 Don't know why this never popped up in my initial googling.不知道为什么这在我最初的谷歌搜索中从未出现过。 Managing IIS.Net Authorization Rules with a powershell script 使用 powershell 脚本管理 IIS.Net 授权规则

My final code is我的最终代码是

Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT' -filter "system.web/authorization" -name "." -value @{users='?'} -Type 'deny'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM