This repository has been archived by the owner on Feb 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from jborean93/iis-integration-tests
Iis integration tests
- Loading branch information
Showing
7 changed files
with
344 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Script to install an IIS website with windows authentication only as well as setting up a local admin account | ||
# Authors: Jordan Borean | ||
# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ | ||
|
||
function SetupUser() { | ||
$computername = $env:computername | ||
$username = 'User' | ||
$password = 'Password01' | ||
$desc = 'Automatically created local admin account' | ||
|
||
$computer = [ADSI]"WinNT://$computername,computer" | ||
$user = $computer.Create("user", $username) | ||
$user.SetPassword($password) | ||
$user.Setinfo() | ||
$user.description = $desc | ||
$user.setinfo() | ||
$user.UserFlags = 65536 | ||
$user.SetInfo() | ||
$group = [ADSI]("WinNT://$computername/administrators,group") | ||
$group.add("WinNT://$username,user") | ||
} | ||
|
||
function SetupIIS () { | ||
Import-Module WebAdministration | ||
|
||
$cert = New-SelfSignedCertificate -DnsName ("127.0.0.1") -CertStoreLocation cert:\LocalMachine\My | ||
$rootStore = Get-Item cert:\LocalMachine\Root | ||
$rootStore.Open("ReadWrite") | ||
$rootStore.Add($cert) | ||
$rootStore.Close(); | ||
|
||
New-Item C:\temp -Type Directory -Force | ||
New-Item C:\temp\iisroot -Type Directory -Force | ||
New-Item C:\temp\iisroot\contents.txt -Type File -Force -Value "contents" | ||
|
||
$iisExec = "C:\Windows\System32\inetsrv\appcmd.exe" | ||
|
||
Start-Process -FilePath $iisExec -ArgumentList "add site /name:""Site1"" /id:11 /physicalPath:""C:\temp\iisroot"" /bindings:http/*:81:" -Wait | ||
Start-Process -FilePath $iisExec -ArgumentList "set config ""Site1"" -section:system.webServer/security/authentication/anonymousAuthentication /enabled:""False"" /commit:apphost" -Wait | ||
Start-Process -FilePath $iisExec -ArgumentList "set config ""Site1"" -section:system.webServer/security/authentication/windowsAuthentication /enabled:""True"" /commit:apphost" -Wait | ||
Start-Process -FilePath $iisExec -ArgumentList "set config ""Site1"" -section:system.webServer/security/authentication/windowsAuthentication /extendedProtection.tokenChecking:""Require"" /extendedProtection.flags:""None"" /commit:apphost" -Wait | ||
Start-Process -FilePath $iisExec -ArgumentList "stop site /site.name:""Site1"" " -Wait | ||
Start-Process -FilePath $iisExec -ArgumentList "start site /site.name:""Site1"" " -Wait | ||
|
||
Start-Process -FilePath $iisExec -ArgumentList "add site /name:""Site2"" /id:12 /physicalPath:""C:\temp\iisroot"" /bindings:http/*:82:" -Wait | ||
Start-Process -FilePath $iisExec -ArgumentList "set config ""Site2"" -section:system.webServer/security/authentication/anonymousAuthentication /enabled:""False"" /commit:apphost" -Wait | ||
Start-Process -FilePath $iisExec -ArgumentList "set config ""Site2"" -section:system.webServer/security/authentication/windowsAuthentication /enabled:""True"" /commit:apphost" -Wait | ||
Start-Process -FilePath $iisExec -ArgumentList "set config ""Site2"" -section:system.webServer/security/authentication/windowsAuthentication /extendedProtection.tokenChecking:""None"" /extendedProtection.flags:""None"" /commit:apphost" -Wait | ||
Start-Process -FilePath $iisExec -ArgumentList "stop site /site.name:""Site2"" " -Wait | ||
Start-Process -FilePath $iisExec -ArgumentList "start site /site.name:""Site2"" " -Wait | ||
|
||
Set-Location IIS:\SslBindings | ||
New-WebBinding -Name "Site1" -IP "*" -Port 441 -Protocol https | ||
New-WebBinding -Name "Site2" -IP "*" -Port 442 -Protocol https | ||
$cert | New-Item 0.0.0.0!441 | ||
$cert | New-Item 0.0.0.0!442 | ||
} | ||
|
||
function main () { | ||
SetupUser | ||
SetupIIS | ||
} | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,6 @@ httpretty | |
flake8 | ||
mock | ||
wheel | ||
requests | ||
six | ||
unittest2 |
Oops, something went wrong.