1

Environment: Windows Server 2012 SharePoint 2013 IIS 8

I have deployed the Sharepoint 2013 site in the App server(Windows 2012). We have seperate DB server.

My site was working fine.

Until I ran the vbs script given by Security team, inorder to harden the IIS.

Const REG_SZ        = 1
Const REG_EXPAND_SZ = 2
Const REG_BINARY    = 3
Const REG_DWORD     = 4

Set objShell = WScript.CreateObject("WScript.Shell")


' 1.1: Ensure Web Content Is on Non-System Partition
WScript.Echo "# 1.1: Ensure Web Content Is on Non-System Partition" & vbCrLf
Set objExec = objShell.Exec("%systemroot%\system32\inetsrv\appcmd list vdir")
Do
    line = objExec.StdOut.ReadLine()
    If InStr(line, "%SystemDrive%\inetpub\wwwroot") Then
        WScript.Echo "* Please remove this web site: " & line
    End If
Loop While Not objExec.Stdout.atEndOfStream
WScript.Echo vbcrlf & "-------------------------------------------------------------" & vbCrLf


' 1.2: Require Host Headers on all Sites
WScript.Echo "# 1.2: Require Host Headers on all Sites" & vbCrLf
Set objExec = objShell.Exec("%systemroot%\system32\inetsrv\appcmd list sites")
Do
    line = objExec.StdOut.ReadLine()
    tmpArray = Split(line, ",")
    'Wscript.Echo "tmpArray:" &  tmpArray(1)
    tmpArray2 = Split(tmpArray(1), ":")
    'Wscript.Echo "tmpArray2:" &  tmpArray2(3)
    If Trim(tmpArray2(3)) = "" Then
        WScript.Echo "* Please configure Host Header for this web site: " & line
    End If
    's = s & line & vbcrlf
Loop While Not objExec.Stdout.atEndOfStream
'WScript.Echo s
WScript.Echo vbcrlf & "-------------------------------------------------------------" & vbCrLf


' 1.3 - Disable Directory Browsing
WScript.Echo "# 1.3: Disable Directory Browsing" & vbCrLf

Script ran successfully, but All of the Sharepoint Sites are not accessible now. :(

Its just HTTP 404 not found error. (Even Central Admin)

I checked in the IIS, the sites are just running fine. I tried the urls (_layouts/15/settings.aspx), Nope..

I tried looking into event viewer, Sharepoint Logs. No clue :(

Any one faced similar problem. Can help to resolve this issue ?

Update: After Allowing unknown file extension. 404 gone, But when I reloaded the Central admin it becomes like below (MISSING CSS & IMAGES)

Missing CSS & Images in the Central Admin

1 Answer 1

3

WOW, thats alot of lazy changes to IIS. Stuff that i wouldnt recommend.... if you need to do it than do one thing at a time or atleast test it on a test server first! i understand you might have 100's of web apps and app pools but doing multiple changes for all webapps is crazy --- unless well tested on just one webapp to start with!!


as for the issue:

the part that i could see that would return a 404 that i spotted within the code was changes to host header for each site!

what are the host settings in iis for each site?

iis -> under sites click on any site -> right hand side click on bindings

what can you see? do you have a host headed, whats the port? ip address?

first get central admin so go view that first!

binding settings:

i think the port is standard throughout as 42820 type is http ip should be blank (when edit item its all unassigned ips) no host no binding info!

once done click ok, now back at the site settings on iis, select basic settings below bindings.

click test settings. if the path is visable and available and the account used for app pool account for central admin than you should get two ticks, if not you need to fix those issues!

repeat process for all other sites!

EDIT

now we know the cause we can solve the issue! as you noted it cant handle .asp/aspx which by default above iis6 is true that it doesnt handle custom asp pages in mime. So the guy who wrote the script needs to understand that iis7+ do not include .asp in mime types so there would be no need for this part of the script :)

if you look in iis manager under the site handler mappings you would see asp/aspx but under mime types you would find nothing.

9
  • FYI, I couldnt access even CA, its 404. :( Jul 2, 2014 at 3:38
  • I executed the VBS Script in test server IIS one by one and try to replicate the scenario. It pays. Disallow unknown file extension is the root cause(.aspx is not in the MIME type of IIS). Huh.. Why this default .asp file extensions are not added in the MIME type ? Jul 2, 2014 at 3:40
  • just ammended my answer. Is your site working now or still getting 404?
    – Ali Jafer
    Jul 2, 2014 at 7:21
  • Ofcourse, you are right. After Allowing unknown file extension. 404 gone, But here comes the another problem. I just amended in my question. Jul 4, 2014 at 6:00
  • now the site is up and running you check error log in 15 hive? or in event viewer? this could be a permission issue with css and images/JS scripts to 15 hive
    – Ali Jafer
    Jul 7, 2014 at 7:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.