Unable to disable Http TRACE method on Azure - http

I have an App Service on Azure that has four virtual applications and no application in the root directory. I have a need to disable Http TRACE requests for all applications and the root URL (a custom domain).
Right now, if I run nmap -script=http-methods.nse [domain].com, I get "Potentially risky methods: TRACE" as part of the result. I've been unable to disable this via web.config, wether with <verbs>, <requestFiltering>, or <handlers>.
Do you know of any way to disable HTTP Trace across virtual applications on Azure? Thank you!

Related

Error Service 'LogService.LogService' has zero application (non-infrastructure) endpoints

I have a asp.net aspx web application projects where i have LogService.svc file which I believed is wcf service file.
When i run the application in Local IIS 'http://localhost/LogService/LogService.svc' it does not show error message while
when i publish the same project in the Test Server. It shows error 'Service 'LogService.LogService' has zero application (non-infrastructure) endpoints. '
Service ‘Namespace.ServiceName’ has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.
And for get more information please visite :

how to use Dispatcher to publish from CQ5 Author instance to CQ5 publish instance..?

I'm able to publish site from author instance to publish instance using generic procedure, now i want to publish this with help of Dispatcher i download it and configure it with IIS now i'm confusing which instance should we host on IIS and how to host that instance, so someone suggest me best way to complete my job.
Thanks
You can setup the dispatcher instance in front of author or can be publish, But ideal use of dispatcher apply when we set up in front of publish to perform Load Balancing / Caching. To set up dispatcher in front of author or publish is based upon the configuration in dispatcher.any via renders as below
/renders
{
/rend01
{
# Hostname or IP of the render
/hostname localhost
# Port of the render
/port "8589"
# Connect timeout in milliseconds, 0 to wait indefinitely
# /timeout "0"
}
}
Also you can go through few blogs online that can explain it fully.
Thanks

Is it possible to set IP restrictions for Windows Azure Web sites?

We are using Windows Azure Web Sites, so we don't create Web roles. Now we need to temporarily set IP restrictions for the site, and I am not sure this is possible for Web Sites.
What is usually done is adding ipSecurity element to system.webServer section in web.config. But the ipSecurity section is locked by default, so it must be first unlocked by running a script command. But running Startup script is not possible for Azure Web sites, is it?
Does this mean that for Azure Web Sites (that don't have Web roles) it's simply not possible to configure IP range restriction?
Nir Mashkowski explains in a blog post on how you can enable IP Restriction in Windows Azure Web Sites.
AFAIK ipSecurity is not active on Azure Web Sites.
Workaround: you can write a small piece of code in global.asax Application_BeginRequest and check the client ip address on your allowed IP addresses list. You can load the list on Application_Start.
protected void Application_BeginRequest(...)
{
string clientIP = request.UserHostAddress;
if (!Check(clientIP, myOKList))
{
Response.Write("<html><body>You are not authorized!</body></html>");
Response.End();
}
}

HTTP Error 401.1 when using WinHttp.WinHttpRequest.5.1 in classic ASP site

General information
Operating System: Windows Server 2003 R2 Service pack 2
Webserver: IIS 6
NTAuthenticationProviders: NTLM only
Webapplication: Classic ASP
Browsers used: IE7, IE8, IE9
There’s a Classic ASP web application called knowledgebase, within an IIS website called eblcplaza like so: eblcplaza/knowledgebase/.
eblcplaza has anonymous access AND Integrated Windows Authentication enabled.
knowledgebase has anonymous access disabled and Integrated Windows Authentication enabled
knowledgebase is a Classic ASP application has its own Application pool which runs under the predefined Application pool identity “Network service”
When I’m logged in with my NT account I can access any page I want just fine. The problem is with the WinHttp.WinHttpRequest.5.1 component. It’s used in some parts of knowledgebase to do a server side request to retrieve content from some .asp scripts which reside within the web application.
The problem started when Anonymous access was turned off on knowledgebase . Note, turning it back on is not an option.
Example of a request using WinHttpRequest:
set WinHTTPRequest = Server.CreateObject("WinHttp.WinHttpRequest.5.1")
WinHTTPRequest.SetTimeouts 20000, 20000, 20000, 20000
call WinHTTPRequest.Open("POST", someUrlToAspScript, false)
WinHTTPRequest.SetAutoLogonPolicy 0
WinHTTPRequest.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
WinHTTPRequest.Send strQueryString
Response.Write(WinHTTPRequest.ResponseText)
With SetAutoLoginPolicy set to 0, I get the following error message on the pages where WinHttpRequest is used:
You do not have permission to view this directory or page using the credentials that you supplied.
HTTP Error 401.1 - Unauthorized: Access is denied due to invalid credentials.
Internet Information Services (IIS)
With SetAutoLoginPolicy set to 2 (Do not automatically send user credentials according to MSDN), I get the following error message on the pages where WinHttpRequest is used:
You do not have permission to view this directory or page using the credentials that you supplied because your Web browser is sending a WWW-Authenticate header field that the Web server is not configured to accept.
HTTP Error 401.2 - Unauthorized: Access is denied due to server configuration.
I know for a fact that my NT user account has the proper rights to access those .asp scripts and so does the Network Service account.
I tried figuring out what could be the problem for several days know, tried setting the NTAuthenticationProviders to only NTLM and both Negotiate and NTLM amongst other things, but nothing worked so far.
Please help me out, It’s starting to drive me crazy.
Regards,
Bart
I guess the pages in knowledgebase are accessed with the anonymous account where you start from at eblcplaza. Try to enable NTLM only on the page in eblcplaza where you use the request, you can do that on that file only. Like that your credentials get passed to knowledgebase. On both pages log the Session("username") variable.
First of all let's clear up what it is you asking the server to do. It will have demanded your credentials from the client with which it is now impersonating you for security purposes. The WinHTTP request it is making to a service (WinHTTP doesn't know that its the exact same application) that now demands credentials. What you want this impersonating thread to do is use your creds to authenticate against an "external" service.
I suspect that what is happening here is that the server is not cleared to re-use your credentials in this way. If I recall correctly (which may not be that certain) a server needs to be granted the right to delegate in order to do that. It may also be possible to allow this if Kerberos is used instead of NTLM to perform windows integrated security.
However all that may be academic. You should understand that an app making a http request to itself has the potential to hang when under load in a way that would require a recycle to release.
Consider this alternative. Given that ServicePage.asp is a page used both directly by the browser and by an internal ClientPage.asp do the following.
Rip out the service code from ServicePage.asp and place in a VBScript class in a new ServiceInclude.asp. Now add the this ServiceInclude.asp as an include file in ServicePage.asp where ServicePage.asp only contains the plumbing necessary to instance the class and use it to generate its output.
Modify ClientPage.asp so that instead of attempting WinHttp to ServicePage.asp it simply includes the ServiceInclude.asp, instances the contained class and uses the class to provide the service required.

How do I get the host domain name in ASP .NET without using HttpContext.Current.Request?

I've got an ASP .Net application running on IIS7. I'm using the current url that the site is running under to set some static properties on a class in my application. To do this, I'm getting the domain name using this (insde the class's static constructor):
var host = HttpContext.Current.Request.Url.Host;
And it works fine on my dev machine (windows XP / Cassini). However, when I deploy to IIS7, I get an exception: "Request is not available in this context".
I'm guessing this is because I'm using this code in the static constructor of an object, which is getting executed in IIS before any requests come in; and Cassini doesn't trigger the static constructor until a request happens. Now, I didn't originally like the idea of pulling the domain name from the Request for this very reason, but it was the only place I found it =)
So, does anyone know of another place that I can get the host domain name? I'm assuming that ASP .Net has got to be aware of it at some level independent of HttpRequests, I just don't know how to access it.
The reason that the domain is in the request is...that's what's being asked for. For example these are a few stackexchange sites from http://www.stackexchangesites.com/:
http://community.ecoanswers.com
http://www.appqanda.com
http://www.irosetta.com/
If you ping them, you'll see they all point to the same IP/Web Server and be served by the same app (or multiple apps in this case, but the example holds if it was one big one)...but the application doesn't know which one until a host header comes in with the request asking the server for that site. Each request may be to a different domain...so the application doesn't know it.
If however it doesn't change, you could store it as an appSetting in the web.config.
Use global.asax or write a HttpModule and subscribe to start request events. You will have the request passed into your event handler.
Use this instead:
HttpRuntime.AppDomainAppVirtualPath
Or if you want the physical path:
HttpRuntime.AppDomainAppPath
For further reading:
http://weblogs.asp.net/reganschroder/archive/2008/07/25/iis7-integrated-mode-request-is-not-available-in-this-context-exception-in-application-start.aspx

Resources