There are different ways to restrict clients from viewing resources on an IIS server. Resources can be configured to authorize access only to clients who use certificates, or to specific authenticated client user names, or to specific IP addresses or DNS host names.
This topic provides examples to configure IIS to restrict client access based on IP addresses or DNS host names. Each example modifies the IPSecurity metabase property, which can be configured for a service, a site, a virtual directory, or a Web file.
Using ADSI in VBScriptUsing ADSI in VBScript
The following example shows you how to use the VBScript scripting language to set an IP restriction on the default Web site and display the restrictions contained in the IPSecurity metabase property.
This example uses ADSI. For an example that uses System.DirectoryServices, see Setting IP Security Using System.DirectoryServices.
Visual Basic Script
' Set up variables.
Set IIsWebVirtualDirObj = GetObject("IIS://localhost/W3SVC/1/Root")
Set IIsIPSecurityObj = IIsWebVirtualDirObj.IPSecurity
Dim IPList
IPList = Array()
' If GrantByDefault is True, you can only use IPDeny and DomainDeny.
If True = IIsIPSecurityObj.GrantByDefault Then
' Insert a new restriction.
IPList = IIsIPSecurityObj.IPDeny
If (-1 = Ubound(IPList)) Then WScript.Echo("Currently no IP Addresses are denied")
Redim IPList (Ubound(IPList)+1)
IPList (Ubound(IPList)) = "123.0.0.1,255.255.255.0"
' Set the new lists back in the metabase in two stages, and then save
' the metabase.
IIsIPSecurityObj.IPDeny = IPList
IIsWebVirtualDirObj.IPSecurity = IIsIPSecurityObj
IIsWebVirtualDirObj.Setinfo
WScript.Echo("The IPRestriction has been set")
' Display the IP restrictions.
IIsWebVirtualDirObj.Getinfo
Set IIsIPSecurityObj = IIsWebVirtualDirObj.IPSecurity
IPList = IIsIPSecurityObj.IPDeny
WScript.Echo("These IP addresses are denied:")
For Each IP In IIsIPSecurityObj.IPDeny
WScript.Echo(IP)
Next
End if
Subscribe to:
Post Comments (Atom)
Blog Archive
-
▼
2007
(117)
-
▼
November
(47)
- Install mod_python on cpanel server
- Identifying Process
- httpd segmenation Fault
- httpd issues , service started but sites not browsing
- View httpd , smtp other connections ( Unix )
- http and https site issues
- Set up VPN for UNix servers
- View Error Logs ( unix )
- View Server Info , Configs ( Unix )
- View IPs Causing attack
- How to open ports
- Install BIND or Named , wtih YUM
- Check mail logs for a particular Domain
- Block the IPs / for particular port
- full disk space issues ( Finding out the culprit )
- How to find out IPs trying to login to ssh
- ffmpeg installation error , partition remounted
- Exim load , finding email ID
- pure -ftpd , increase no . of dirctories viewable
- How to flush DNS in linux
- Disable ping on the server ( unix )
- Setting Index page ( Unix )
- Detect DDOS
- Exim Admin
- Direct Admin License Issues
- Cron Job
- Critical Namd Issue
- Mysql Admin
- Configure User Quota on a Plain server ( Unix )
- Command to change the Date ( Unix )
- checking error logs for a domain and httpd logs pl...
- Check and close your DNS servers ( unix )
- How To change the port ( SSH )
- CGI Issues not able to bowse the page
- Bind Configuration ERRor ( Named )
- Adding IPs on plain CentOS server ( Unix )
- High Traffic balance with this script ( Unix )
- IIS Tunning
- IIS Tweaking
- ERROR 2003: Can't connect to MySQL server on 'loc...
- Retrieve IUSER Password with this Script
- Reverse DNS lookup in Windows
- Server Application Error
- Server Performance Advisor ( Windows )
- Setting Up IPsecurity with ADSI ( Script )
- System Restore Windows
- Error while Removing Name serversfromWHM ICANN error
-
▼
November
(47)
No comments:
Post a Comment