0% found this document useful (0 votes)
74 views

Introduction To IIS and HTTP

This document provides an overview of Internet Information Services (IIS) and the Hypertext Transfer Protocol (HTTP). It describes the evolution of the IIS web server product across different Windows versions. It also covers key IIS concepts like application pools, sites, and bindings. Additionally, it explains the HTTP protocol, including requests, responses, and common methods like GET and POST.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views

Introduction To IIS and HTTP

This document provides an overview of Internet Information Services (IIS) and the Hypertext Transfer Protocol (HTTP). It describes the evolution of the IIS web server product across different Windows versions. It also covers key IIS concepts like application pools, sites, and bindings. Additionally, it explains the HTTP protocol, including requests, responses, and common methods like GET and POST.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

27. 5.

2019

Introduction to IIS and HTTP


Internet Information Services

Ing. Ondrej Sevecek | Windows Server Product Manager | GOPAS a.s. |


MCM:Directory | MVP:Enteprise Security | Certified Ethical Hacker | MCSE:SharePoint |
[email protected] | www.sevecek.com |
GOPAS: info@gopas,cz | www.gopas.cz | www.facebook.com/P.S.GOPAS

Web Server
 separate product for NT 4.0 (IIS 4.0)
• supports TLS/SSL with Schannel
• metabase binary configuration database (LDAP compliant)
 first integrated within Windows 2000 (IIS 5.0)
• no direct support for ASP.NET
• limited application isolation (service or individual worker process)
 integrated with HTTP.SYS in Windows 2003 (IIS 6.0)
• first XML editing of metabase
• application pools and ASP.NET integration
• shared content storage
 strictly XML configuration in Windows 2008 (IIS 7.0)
• HTTPS in kernel mode
• modular architecture and request pipeline
• request filtering
• installation with ServerManagerCmd.exe
• kernel mode authentication, AppPoolIdentity
• IIS Management Service
• non-Windows FTP accounts
• shared configuration storage
• URL rewrite module

1
27. 5. 2019

Web Server
 slightly improved in Windows 2008 R2 (IIS 7.5)
• Schannel supports AES, SHA2
• complex and scriptable request filtering
• WebDAV extension
• full installation with PowerShell
• support for managed service accounts
• FTPS
 security improved in Windows 2012 (IIS 8.0)
• TLS SNI for multiple certificates on a single IP address
• binding TLS certificates from a central PFX share
• support for group managed service accounts
• dynamic IP restrictions (DoS, x-forwarded-for)
• CPU limits per application pool
• FTP account lockout
 minor improvements in Windows 2012 R2 (IIS 8.5)
• certificate rebind when renewed
• logging custom fields
 minor improvements in Windows 2016 (IIS 10)
• wildcard hostheaders
• running on Nano Server
• HTTP/2
• powershell cmdlets shadowing appcmd

IIS and HTTP.SYS


User Mode
Hyper-V Replication

Reporting Services
IPHTTPS
WinRM
SSTP

IIS
Certificate

HTTP.SYS

Kernel Mode

2
27. 5. 2019

HTTP.SYS
NETSH http show servicestate

NETSTAT -ano | findstr :80

NETSH http show sslcert

Installation

 GUI Add Windows Components wizard


• Windows 2003-
 ocsetup.exe command line
• Windows 2003-
 GUI Server Manager
• Web Server role
• Windows 2008+
 ServerManagerCmd.exe
• Windows 2008
 PowerShell Get-WindowsFeature, Add-WindowsFeature
• Windows 2008 R2+

3
27. 5. 2019

NET Framework versions

 v1.0 core engine


 v1.1 core engine
• can be installed manually yet on Windows 2012 R2
 v2.0 core engine (requires installation SXS media on
Windows 2012+)
• 3.0 update + new functionality
• 3.5 update + new functionality
 v4.0 core engine
• 4.5 update + new functionality
• 4.51 update + new functionality
• 4.6 update + new functionality
• 4.6.2, 4.7, ...

Installation paths and Default Web Site


 %windir%\System32\inetsrv
• metabase.bin (IIS 5.0)
• metabase.xml (IIS 6.0)
 %windir%\System32\inetsrv\config
• applicationHost.config (IIS 7.0+)
 %systemroot%\inetpub
• logs
• custErr
• wwwroot = Default Web Site
• temp

4
27. 5. 2019

Default Web Site (ID=1)


 By default installed
 Not always necessary (usually configuration can be finished
manually if not present)
• AD CS Web Enrollment
• AD CS Policy/Enrollment Web Services
• Exchange CAS server
• AD FS before Windows 2012 R2
 AD FS Windows 2012 R2+ has direct HTTP.SYS hosting
• SQL Reporting Services until SQL Server 2008 R2
 SQL RS 2008 R2 has direct HTTP.SYS hosting
• Internet printing
 Who does not need Default Web Site
• SharePoint 2010+
• DirectAccess 2012+
• AD FS and WAP on Windows 2012 R2+
• SQL RS 2008 R2+

Post installation WF exceptions


 Inbound
 Process SYSTEM (HTTP.SYS)
 TCP 80
 TCP 443
• although not opened
• firewall hides (stealth) even unopened ports

5
27. 5. 2019

HTTP

 Hypertext Transport Protocol


 Plaintext or wrapped inside TLS/SSL HTTPS
 TCP 80 or TCP 443 by default
 Request-response based nature
• every request must contain all parameters
• any request can hit a different farm member

Web server farms (load balancing with separate


TCP connection)
State
State
server
server

Web1

Browser \\FS
Browser
client \\FS
Browser
client https://finance config
client config
LB LB IP Web2
device
GUI web
GUI web
service content switch
service \\FS
client \\FS
client http proxy content
content
Web3

DB
DB

6
27. 5. 2019

Web server farms (load balancing with direct


TCP connection)
State
State
server
server

Web1

Browser \\FS
Browser
client \\FS
Browser
client Client
https://finance config
client IP config
LB
Web2
device
GUI web
GUI web
service
service
Client NLB ethernet switch \\FS
client IP
\\FS
client content
content
Web3

DB
DB

Web Site

 Virtual web server


 Binding to http(s):IP:port:host
• more web servers on the same IP:port
 Returns content from a physical disk location

7
27. 5. 2019

URI = URL + Query


URL = Protocol + Host + URN
 Unified Resource Identifier

https :// web10.gopas.cz /SitePages/default.aspx ?ID=8&Param=Test #HTMLtagID

protocol host (FQDN) URN Query String Fragment

 Unified Resource Name


• /
• /SitePages/default.aspx
• /Lists/Products/EditForm.aspx
 Query String
• /Lists/Products/EditForm.aspx?ID=8&Param1=X;Param2=Y
 Fragment
• /Wiki.aspx?ID=7#heading1 (references any id="", or <hX>, or <A name="">)

HTTP Methods

 GET
 HEAD
 POST

 GET If-Modified-Since, 304 Not Modified


 GET Authorization
 Kerberos / NTLM
 Basic
 POST
 "postback" to the same URL

8
27. 5. 2019

GET vs. POST method

 GET
• URL (URI) encoded form parameters
• ?, #
• bookmarks, history, refresh + reenter
 POST
• might have URL (URI) encoded parameters as well
• mostly included inside request body
• cannot bookmark, no history, invisible in the address bar, F5
asks to resend

URL examples
 http://web10/default.aspx
• not an FQDN, cannot be resolved from internet
 https://web10.gopas.cz/default.aspx
• using FQDN, might be resolvable from internet

 http://finance/Seznam českých jmen.htm


 http://finance/Seznam%20českých%20jmen.htm
 http://finance/seznam%20%C4%8Desk%C3%BDch%20jmen.htm

 file://C:\MyPages\test.htm
• local file only
 file://\\fileserver\WebPages\test.htm

9
27. 5. 2019

Encoding URI and header characters

 URI and headers must be 7bit US-ASCII only


 URI characters encoded with %xx in hex format
 Header data are usually encoded with Base-64
• a-z, A-Z, 0-9, =/+
• Ahoj Ondřeji = QWhvaiBPbmTFmWVqaQ==

Static content and returned HTMLs

 Static file
• must have MIME type defined
 Default document
• if not any present, tries Directory Browsing, or HTTP 403
 Directory browsing
• if no explicit URL is specified, generates HTML with
directory listing

10
27. 5. 2019

Virtual Directories
 Folder structure from URL perspective

HTTP Status Codes

 200 OK
 30x redirect
• temporary, permanent, method, not modified
 40x client error
• unauthorized, forbidden, bad request
 50x server error
• internal error, overloaded temporarily, gateway timeout

 Substatus not visible to clients by default


• Error pages can switch to detailed errors

11
27. 5. 2019

404 Not Found - substatus codes in IIS


What Error code
Site not found 404.1
Denied by policy 404.2
Denied by mime map 404.3
No handler 404.4
Request Filtering: URL Sequence denied 404.5
Request Filtering: Verb denied 404.6
Request Filtering: File extension denied 404.7
Request Filtering: Denied by hidden segment 404.8
Denied since hidden file attribute has been set 404.9
Request Filtering: Denied because request header is too long 404.10
Request Filtering: Denied because URL doubled escaping 404.11
Request Filtering: Denied because of high bit characters 404.12
Request Filtering: Denied because content length too large 404.13
Request Filtering: Denied because URL too long 404.14
Request Filtering: Denied because query string too long 404.15
.NET 2.0/4.0 version not registered 404.17

MIME/content types

 text/html
 image/jpeg
 image/png
 .doc = application/msword
 .docx = application/vnd.openxmlformats-
officedocument.wordprocessingml.document
 application/pdf

12
27. 5. 2019

Logging

 W3C log always UTC time


 Logging settings at server-level only default for new
sites
 NETSH HTTP FLUSH LOGBUFFER

Static content HTTP headers

13
27. 5. 2019

HTTP.SYS tracing

logman start httptrace -p Microsoft-Windows-


HttpService 0xFFFF -o trace-output.etl -ets

logman stop httptrace -ets

tracerpt.exe trace-output.etl -of XML -o trace-


output.xml

IIS Error Pages

14
27. 5. 2019

Static content compression into TEMP


Dynamic content compressed on the fly

Compression settings server wide

15
27. 5. 2019

Pipeline and HTTP modules

Dynamic content

 Common gateway interface (CGI)


• simple EXE producing output into stdout
 Active Server Pages (ASP)
• since ever, still supported
 PHP
• similar to ASP
• third-party, yet supported since Windows 2008 R2
 NET Framework ASPX
• various languages such as C#, VB.NET, Python
• inline-code
• code-behind
 ISAPI DLLs such as RPCProxy.dll with Handler Mappings
 HTTP Modules such as Exchange PowerShell or SharePoint
SPRequestModule

16
27. 5. 2019

Classic ASP error messages

Custom and ASP.NET developer errors


 Error html vs. IIS detailed errors
• can be customized
• or if missing, generic error message as pure text is returned
• or errorMode="Detailed"
 ASP.NET detailed errors: mode="Off"

<configuration>
<system.web>
<customErrors mode="On|Off|RemoteOnly" />
</system.web>
<system.webServer>
<httpErrors errorMode="Detailed" />
</system.webServer>
</configuration>

17
27. 5. 2019

WAS, W3SVC and HTTP.SYS


User Mode

W3WP.exe
WAS Service
W3SVC Sevice

W3WP.exe

W3WP.exe
ASP.NET
.config queue
ASP.NET
queue ASP.NET
queue
.config

TCPIP.SYS HTTP.SYS
HTTP.SYS
queue

Kernel Mode

Some events from WAS

18
27. 5. 2019

AppPool
recycling

and

Rapid Fail
Protection

IISRESET
+ /noforce

19
27. 5. 2019

Limits
 TCP/IP stack driver limit
• HKLM\System\CurrentControlSet\Service\TCPIP\Parameters
 TcpNumConnections = DWORD = 0 - 16 777 214

Limits
 Web site limits
• http.sys

 Apppool limit
• http.sys

20
27. 5. 2019

Limits
 ASP.NET limits
• httpRuntime - executionTimeout

Limits
 ASP.NET limits
• machine.config
• processModel – maxWorkerThreads, maxIoThreads

21
27. 5. 2019

Service code isolation


FrontEnd BackEnd

http://finance \\FSFinance

account account DB_Finance

G:\IIS\finance

http://warehouse account

account

DB_Warehouse

\\FSWarehouse
G:\IIS\warehouse

Isolation
Domain Account Network Groups Local Network Kerberos OS
Password Isolation Isolation PAC
Validation

NT SYSTEM automatic Administrators no MACHINE$ no 2000


AUTHORITY 30 days

NT Network Service automatic Users no MACHINE$ no XP


AUTHORITY 30 days

NT Local Service no Users no anonymous no XP


AUTHORITY

NT SERVICE <serviceName> automatic Users yes MACHINE$ no Vista


30 days 2008

IIS APPPOOL <appPoolName> automatic Users yes MACHINE$ no Vista


30 days 2008

<domain> <userName> manual Users yes yes yes 2000

<domain> <managedSvcAccount> automatic Users yes yes no 7


30 days 2008 R2

<domain> <groupSvcAccount> automatic Users yes yes no 8


30 days 2012

22
27. 5. 2019

AppPool identity

 appcmd list apppool /text:*

Group Managed Service Account (gmsa)

# on DC
New-AdServiceAccount
-Name web-finance
–DnsHostName finance.gopas.virtual
–PrincipalsAllowedToRetrieveManagedPassword gps-wfe1$,gps-wfe2$

# on each WFE
Add-WindowsFeature RSAT-AD-PowerShell
Install-AdServiceAccount

23
27. 5. 2019

HTTP authentication

 HTTP authentication
• no logoff
• Windows offers SSO
 Cookie-based application authentication with forms-
based logon page
• smaller network footprint than Kerberos
• cookie expiration
• cookie sharing with state server

HTTP authentication
Name Type SSO Windows Third party

Anonymous nothing from impersonates IUSR by default


client should use application pool identity instead
Basic clear-text no any yes

Windows NTLM hashed yes any ?


obsolete

Windows Kerberos encrypted yes AD domain ??


mutual no Kernel mode
Windows 7/2008 R2+
Windows Negotiate Kerberos or yes any with NTLM ???
NTLM AD domain with Kerberos
Windows 2000+ with Kerberos
Digest hashed no Windows XP+ yes
Windows 2003 DC
TLS client certificate encrypted yes any yes
mutual

24
27. 5. 2019

SSO from IE/Edge/Chrome


 IE, Edge, Chrome respect Windows Internet Settings
• Local Intranet zone

 http://portal
 *.gopas.virtual

SSO from Firefox (no *.wildcard support)

25
27. 5. 2019

NTLM loopback check


 Loopback access with NTLM on alias
• LSASS has the same NTLM token with different server
name in cache
 HKLM\System\CCS\Control\LSA\MSV1_0
• BackConnectionHostNames = MULTI_SZ
 HKLM\System\CCS\Control\LSA
• DisableLoopbackCheck = DWORD = 1

Kerberos
 AppPool user/comuters account
• System, Network Service, AppPoolIdentity
• domain user account
 servicePrincipalName
• http/portal
• http/portal.gopas.virtual

SETSPN -a "http/portal" svc-web


SETSPN -a "http/portal.gopas.virtual" svc-web

26
27. 5. 2019

Forms authentication

 Plain-text authentication
 Cookies based further access
• expiration in the browser
• expiration on the server
• explicit log-out available
 Customizable user interface
 Implemented in ASP.NET code logic
• might be exposed in GUI or might not

HTTP cookies

 Name=Value; Name=Value; ...


 Path=/subPath
• limited to a subpath
 Domain=.gopas.cz
• can enable cookie from a subdomain to go to other thirt-
level subdomains
 Expires=23-May-2015 22:13:08 GMT
 Max-Age=[seconds]

27
27. 5. 2019

Configuration storage

<location >

%windir%\System32\inetsrv\Config applicationHost.config

%webRoot% web.config

%webRoot%\SubFolder web.config
%webRoot%\SubFolder web.config
%webRoot%\SubFolder web.config
<location >

Configuration storage

<location >

%windir%\System32\inetsrv\Config applicationHost.config

%windir%\Microsoft.NET\Framework64\v2.0…\Config machine.config
%windir%\Microsoft.NET\Framework64\v4.0…\Config machine.config

%windir%\Microsoft.NET\Framework64\v2.0…\Config Web.config
%windir%\Microsoft.NET\Framework64\v4.0…\Config web.config

%webRoot% web.config

%webRoot%\SubFolder web.config
%webRoot%\SubFolder web.config
%webRoot%\SubFolder web.config
<location >

28
27. 5. 2019

Request blocking

 Windows Firewall
• source IP addresses
 IP address and domain name restrictions
• IP address/range/network
• domain names require DNS PTR reverse lookup
• Proxy mode on Windows 2012+
 Dynamic IP restrictions
• logging only mode: sc-status = 200, sc-substatus = 502
 Request filtering (no regex)
• extensions, size of URL and payload, methods, URL pattern,
query string pattern, hidden segment (/segment/ or /file.name
exactly), header patterns and patterns by .ext (the Rules)
• use Hidden segments in collisions like /bin/ and /binary/ to block
"bin" sequence

Double escaping and high-bit characters

 URL part only, not considered in query strings


• only the query and/or fragments

 http://portal/username.aspx
 http://%70 %6F %72 %74 %61 %6C /username.aspx
 http://%25 %37 %30 %25 %36 %46 %25 %37 %32
%25 %37 %34 %25 %36 %31 %25 %36 %43
/username.aspx

 + or % after de-escaping in URL is blocked

29
27. 5. 2019

Proxy mode with Dynamic IP restrictions

 Requests coming over proxies


 X-Forwarded-For: client, first-proxy, second-proxy, last-
proxy
 Must make the proxy addresses trusted as Allowed IP
entries
• source IP address of the TCP connection is the last-proxy
• client IP from the X-Forwarded-For is untrusted

Proxy mode (static/dynamic IP restrictions)

Blocked
Client IP

Client

Web

30
27. 5. 2019

Proxy mode (static/dynamic IP restrictions)

Blocked
Client IP

Client

Proxy
IP

Proxy Web

Proxy mode (static/dynamic IP restrictions)

Blocked
Client IP

Client

Proxy
IP

Proxy X-Forwarded-For Web


Blocked Client IP

31
27. 5. 2019

Transport Layer Security

 Standard cryptographic protocol for secure


transmissions
• RSA/DSA/EC, RC4, DES, AES, MD5, SHA1, …
 Encryption and server identity authentication
• HTTPS, SSTP, IPHTTPS, LDAPS, SQL, RDPS, SMTPS,
Hyper-V replication, 802.1x EAP, IPSec IKEExt
 Client certificate authentication
 Requires public key certificate on the server

SSL vs. TLS vs. DTLS


 SSL 2.0 (1995) - Windows 2000+
• MITM can downgrade cipher suite to 40-bit
• MAC hashes can be downgraded to 40-bit
 SSL 3.0 (1996) - Windows 2000+
• Support for DH, Fortezza key exchanges
• Support for non RSA certificates
 TLS 1.0 (1999) - Windows 2000+
• Security same as SSL 3.0
• Protocol not compatible with SSL 3.0
• IETF and US FIPS standard
 TLS 1.1 and 1.2 (2006, 2008) - Windows 7/2008 R2
• More recent standards offering SHA2 and ECDH suites
• Can fallback to TLS 1.0 without TCP RST
 DTLS 1.0 (based on TLS 1.0) and 1.2 (based on TLS 1.2) - Windows 8/2012
• Update available for Windows 7/2008 R2 (KB2574819)
• UDP datagram based communications such as RDP-UDP

32
27. 5. 2019

Secure / insecure

 Insecure
• SSL 2.0, SSL 3.0
• DES, MDx, SHA1, RC4
 Must have for compatibility reasons
• TLS 1.0
 Good
• TLS 1.1, TLS 1.2, …

Current secure algorithms and support

 since Windows 7 and Windows 2008 R2


• AES, SHA2 (SHA-256, SHA-384, SHA-512), RSA 2048,
ECDH
• TLS 1.1+

 certificates
• must contain Subject Alternative Name (SAN)
• all names must be present in SAN
• public CAs do not issue non-public DNS domains

33
27. 5. 2019

What we do not want

 SHA-1 (weak at 80/63bit currently)


• 2017-01-01T00:00:00 Windows stops accepting SHA-1 leaf
certificates???
 RC4 (non-FIPS, some limited exploits, rumors, MS
not recommended, RFC 7465 prohibited since
Feb2015)
 MD5, MD4 (non-FIPS)
 RSA 1024
 SSL 2.0, SSL 3.0 (prone to attacks)

Do not confuse signature with thumbprint

34
27. 5. 2019

Disable SSL 2.0

 HKLM\System\CurrentControlSet\Control\SecurityPro
viders \SCHANNEL\Protocols
• \PCT 1.0
• \SSL 2.0
 \Client
– Enabled = DWORD = 0
 \Server
– Enabled = DWORD = 0
• \SSL 3.0
 \Client …

Enable TLS 1.1 and TLS 1.2

 HKLM\System\CurrentControlSet\Control\SecurityPro
viders \SCHANNEL\Protocols
• \TLS 1.1
• \TLS 1.2
 \Client
– Enabled = DWORD = 1
– DisabledByDefault = DWORD = 0
 \Server
– Enabled = DWORD = 1
– DisabledByDefault = DWORD = 0

35
27. 5. 2019

Automatic (re)binding

 IIS manual setting


 Windows 2012 R2+ with automatic rebind if enabled

PowerShell (re)binding
$serverName = 'portal'
dir Cert:\LocalMachine\My | ? {
($_.Issuer -ne $_.Subject) -and
($_.DnsNameList -contains $serverName) -and
($_.NotBefore -lt [DateTime]::Now) -and
($_.NotAfter -gt [DateTime]::Now) -and
($_.HasPrivateKey) -and
(-not $_.Archived) -and
($_.Extensions['2.5.29.37'].EnhancedKeyUsages['1.3.6.1.5.5.7.3.1'] -ne $null) } |
Sort -Desc NotAfter | Select -First 1

36
27. 5. 2019

Change TLS allowed suites and order

Windows XP/2003- TLS/SSL cipher suites (no AES)

TLS_RSA_WITH_RC4_128_MD5
TLS_RSA_WITH_RC4_128_SHA
TLS_RSA_WITH_3DES_EDE_CBC_SHA
TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA
TLS_RSA_WITH_DES_CBC_SHA
TLS_DHE_DSS_WITH_DES_CBC_SHA
TLS_RSA_EXPORT1024_WITH_RC4_56_SHA
TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA
TLS_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA
TLS_RSA_EXPORT_WITH_RC4_40_MD5
TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5
TLS_RSA_WITH_NULL_MD5
TLS_RSA_WITH_NULL_SHA

SSL_RSA_WITH_RC4_128_SHA
SSL_RSA_WITH_3DES_EDE_CBC_SHA
SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA
SSL_RSA_WITH_RC4_128_MD5

37
27. 5. 2019

Windows 7/2008 R2 TLS v1.1 cipher suites (AES/EC/SHA2)

TLS_RSA_WITH_AES_128_CBC_SHA256 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA_P384
TLS_RSA_WITH_AES_128_CBC_SHA TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA_P256
TLS_RSA_WITH_AES_256_CBC_SHA256 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA_P384
TLS_RSA_WITH_AES_256_CBC_SHA TLS_DHE_DSS_WITH_AES_128_CBC_SHA256
TLS_RSA_WITH_RC4_128_SHA TLS_DHE_DSS_WITH_AES_128_CBC_SHA
TLS_RSA_WITH_3DES_EDE_CBC_SHA TLS_DHE_DSS_WITH_AES_256_CBC_SHA256
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256 TLS_DHE_DSS_WITH_AES_256_CBC_SHA
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P384 TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P256 TLS_RSA_WITH_RC4_128_MD5
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P384 SSL_CK_RC4_128_WITH_MD5
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P256 SSL_CK_DES_192_EDE3_CBC_WITH_MD5
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384 TLS_RSA_WITH_NULL_SHA256
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256_P256 TLS_RSA_WITH_NULL_SHA
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256_P256
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA384_P384 SSL_RSA_WITH_RC4_128_SHA
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA384_P384 SSL_RSA_WITH_3DES_EDE_CBC_SHA
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA_P256 SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA
SSL_RSA_WITH_RC4_128_MD5

Validate your TLS server

 http://www.ssllabs.com

38
27. 5. 2019

SSL enforcement vs. HTTP 403 error

Redirects

 302 normal redirect


 301 permanent change
• browsers can update cache, bookmarks and links
 307 temporary change

 Always create separate site for the redirects!


 Switch anonymous authentication to use AppPoolIdentity
 NTFS permissions Read for IIS APPPOOL\redirapppool

 Redirecting with including query string


• https://finance$S$Q + exact destination

39
27. 5. 2019

Client started HTTP and 302 redirect

HTTP GET /uri.htm


Host: www.gopas.cz

HTTP 302 Redirect

Server
Client

Location: HTTPS://www.gopas.cz/uri.htm

HTTPS GET /uri.htm


Host: www.gopas.cz

Client started HTTP and HTTPS links <a href>

HTTP GET /uri.htm


Host: www.gopas.cz

HTTP 200 OK
HTML: …
Server
Client

<a href="https://www.gopas.cz/link1.htm>
<a href="https://www.gopas.cz/link2.htm>
<img src="https://www.gopas.cz/pic1.png>

HTTPS GET /link1.htm


Host: www.gopas.cz

40
27. 5. 2019

MITM attack with HTTPS strip (SSL strip)

Certificate

Attacker

Server
Client

HTTP HTTPS

Strict-Transport-Security (HSTS)

HTTP GET /uri.htm


Host: www.gopas.cz

HTTP 200 OK
HTML: …
Server
Client

Strict-Transport-Security: max-age=360;
includeSubDomains;
<a href="https://www.gopas.cz/link2.htm>
<img src="https://www.gopas.cz/pic1.png>

Cache
HTTPS GET /link1.htm
Host: www.gopas.cz

41
27. 5. 2019

More web servers on a common IP address - single host header

Server Certificate
www.gopas.cz
TLS tunnel
IP : Port IP: 10.10.0.37:443

HTTP GET /uri.htm

WebSite
Client

User-Agent: Internet Explorer


Accept-Language: cs-cz
Host: www.gopas.cz

More web servers on a common IP address - different host headers


on Windows 2008 R2-

Server Certificate
www.gopas.cz
TLS tunnel
IP : Port IP: 10.10.0.37:443
Website

HTTP GET /uri.htm


Client

Host: www.gopas.cz
Website

HTTP GET /uri.htm


Host: www.sevecek.com

42
27. 5. 2019

Host header vs. wildcard certificate on Windows 2008 R2-

Server Certificate
*.gopas.cz
TLS tunnel
IP : Port IP: 10.10.0.37:443

Website
HTTP GET /uri.htm
Client

Host: www.gopas.cz

Website
HTTP GET /uri.htm
Host: kurzy.gopas.cz

Server Name Indication (SNI) with Windows 7 (IE7) and Windows


2012+

Server Certificate
TLS tunnel www.gopas.cz
IP : Port : Host
Website

IP: 10.10.0.37:443
HTTP GET /uri.htm
Client

Host: www.gopas.cz
Website

HTTP GET /uri.htm


Host: www.sevecek.com
Server Certificate
www.sevecek.co
m
IP: 10.10.0.37:443

43
27. 5. 2019

Network Load Balancing


State
IP1 State
server
IP NLB
server

Web1
https://www.gopas.cz
Browser \\FS
Browser
client IP2 \\FS
Browser
client Client
https://bi config
client IP1:Port1 IP NLB config
NLB
ethernet Web2
switch
GUI web
GUI web
service
service Client NLB ethernet switch \\FS
client IP2:Port2 \\FS
client content
content
Web3
IP3

IP NLB

DB
DB

NLB notes #1

44
27. 5. 2019

NLB notes #2 (dedicated vs. cluster IPs)

NLB notes #3 (or create a new zone)

45
27. 5. 2019

NLB notes #4 (on both nodes manually)

Testing load balancing

 HTTP response headers (IIS server level)


• add custom header: NLB-Node: severName

 HTTP response headers (web-site level)


• temporarily disable Connection keep-alive

46
27. 5. 2019

Testing load-balancing with PowerShell


Invoke-WebRequest

Central shared IIS configuration


 Manual config
• windows features
 Add-WindowsFeature …
• group managed service accounts registration
 Install-AdServiceAccount …
• SSL certificates
 netsh http show sslcert
 Netsh http add sslcert

 What does not work


• additional HTTP headers per server

47
27. 5. 2019

PHP integration
 install PHP
• download PHP
• download VC 201x redistributable
 Add-WindowsFeatures Web-CGI
 register Handle Mapping per site
• *.php -> PHP-CGI.exe
 allow the PHP-CGI.exe in server CGI restrictions

PHP integration

48
27. 5. 2019

PHP integration

49

You might also like