Friday, June 25, 2010

Restrict or Lock down sharepoint webservice file ( _vti_bin), _layouts and other important files

I would like to share some idea specially for internet facing - anonymous public site. It is very very important to restrict anonymous user to restrict to access web service of your site and access files located at _layouts. Also it is important to keep open few of the files from _layouts e.g. _layouts/accessdenied.aspx, _layouts/error.aspx

Solution: You can add required configuration tags into web.config file
example:


Cheer!!. Keep safe your internet facing anonymous site.

2 comments:

Pradeep said...

Hi,

I do understand that the above will block the access to all the Sharepoint Web Services. How can we allow access to one particular Sharepoint Web Service (for example, _vti_bin/lists.asmx)? Can we provide access to this service for a particular user account? or for a particular application?

Any help would be greatly appreciated?

Thanks and Regards,
K. Pradeep

RobertoSLJunior said...

@Pradeep

< location path="your path" >
 < system.web>
  < authorization>
   < allow users="*"/>
   < /authorization>
  < /system.web>
< /location >

or

< location path="your path">
 < system.web>
  < authorization>
   < allow users="John"/> // allow Roberto ..note: you can have multiple users seperated by comma e.g. Roberto,Pradeep,etc
   < deny users="*"/> // deny others
  < /authorization>
 < /system.web>
< /location>


If you have roles managment setup for users:


<location path="your path">
 <system.web>
  <authorization>
   <allow roles="Developers"/> //Allow users in developers role
   <deny users="*"/> // Deny others
  </authorization>
 </system.web>
</location>