eShopOnContainers/deploy/windows/add-firewall-rules-for-sts-auth-thru-docker.ps1
Nish Anil 19a3735c09
Merge dev to feature branch (#1476)
* Fixed firewall rules check and improved the script

the check shall be like ~ Get-NetFirewallRule -DisplayName eShopOnContainers-* -ErrorAction Stop

* #1397: Replaced deprecated docker.for.win.localhost by host.docker.internal in src/.env (#1400)

* Updated Readme (#1402)

Fixed sentence structure in Readme.

Changed "and a several" to "with several."

* CatalogService: Fix issue with Status set when items list is empty (#1304)

* Fix issue with Status set when items list is empty

* Change method Count() call to Count property

Co-authored-by: Dmytro Hridin <v-dmytro.hridin@lionbridge.com>

* refactored Equals() method on ValueObject (#1316)

* Fix/1403and1404 removed duplicate Key SubscriptionClientName and added app.UseAuthorization() call (#1406)

* #1403 removed duplicate Key SubscriptionClientName

Removed duplicate key SubscriptionClientName from Tests/Services/Application.FunctionalTests/Services/Marketing/appsettings.json and sorted its content in asc order.

* #1404 Added app.UseAuthorization() call

Added app.UseAuthorization() call to BasketTestsStartup, LocationsTestsStartup, and MarketingTestsStartup to fix failed unit tests IntegrationEventsScenarios.Post_update_product_price_and_catalog_and_basket_list_modified and MarketingScenarios.Set_new_user_location_and_get_location_campaign_by_user_id (see #1404)

* Fix for Campaigns exception and SignalR 401 Unauthorized (#1374)

* update API Gateway - /locations-api/ @ webmarketing/envoy.yaml

* updated signalr services

- envoy: webmarketingapigw
- latest client: webmvc
- service hub: ordering-signalrhub

Co-authored-by: hfz-r <hafiz.roslan@hartalega.com.my>

* Mis-Spelled 'client' (#1411)

* fix parameter error in multiarch job (#1413)

* Private readonly string changed to private const string (#1288)

* fix disposing of direct instantiated objects in calalog service #1392 (#1395)

* Updated version of different packages. (#1420)

* for issue #1423: changed literal string "OpenIdConnect" to constant string (#1424)

Co-authored-by: Jeremiah Flaga <j.flaga@arcanys.com>

* Updated node-fetch package version. (#1426)

* Updated node-fetch package version.

* Updated node-forge version.

* Fixes #1474: webspa container does not build when running docker-compose up.Updated sha hashes in packages-lock.json (#1475)

* Change ReadAllBytes to ReadAllBytesAsync in PicController (#1425)

Co-authored-by: edmondshtogu <edmondshtogu@gmail.com>
Co-authored-by: InstanceFactory <InstanceFactory@users.noreply.github.com>
Co-authored-by: Sumit Ghosh <sumit.ghosh@neudesic.com>
Co-authored-by: Yosef Herskovitz <34112131+H3RSKO@users.noreply.github.com>
Co-authored-by: Dmytro Hridin <dmytro.hridin@gmail.com>
Co-authored-by: Dmytro Hridin <v-dmytro.hridin@lionbridge.com>
Co-authored-by: André Silva <andrefilipegsilva@outlook.com>
Co-authored-by: hfz-r <39443205+hfz-r@users.noreply.github.com>
Co-authored-by: hfz-r <hafiz.roslan@hartalega.com.my>
Co-authored-by: Majid Ali Khan Quaid <contactmakq@gmail.com>
Co-authored-by: Javier Vela <fjvela@gmail.com>
Co-authored-by: Facundo La Rocca <facundo_larocca@yahoo.com.ar>
Co-authored-by: Nabil Sedoud <nsedoud@gmail.com>
Co-authored-by: jeremiahflaga <flaga.jeremiah@gmail.com>
Co-authored-by: Jeremiah Flaga <j.flaga@arcanys.com>
Co-authored-by: Wojciech Rak <wojciechrak@users.noreply.github.com>
Co-authored-by: Zakaria <23211915+zakaria-c@users.noreply.github.com>
2020-09-29 16:36:11 +05:30

54 lines
1.6 KiB
PowerShell

param(
[string]$Name = "eShopOnContainers",
[string]$InboundDisplayName = "eShopOnContainers-Inbound",
[string]$OutboundDisplayName = "eShopOnContainers-Outbound",
[switch]$Elevated
)
function Check-Admin {
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
}
function Add-InboundRule {
New-NetFirewallRule -DisplayName $InboundDisplayName -Confirm -Description "$Name Inbound Rule for port range 5100-5150" -LocalAddress Any -LocalPort 5100-5150 -Protocol tcp -RemoteAddress Any -RemotePort Any -Direction Inbound
}
function Add-OutboundRule {
New-NetFirewallRule -DisplayName $OutboundDisplayName -Confirm -Description "$Name Outbound Rule for port range 5100-5150" -LocalAddress Any -LocalPort 5100-5150 -Protocol tcp -RemoteAddress Any -RemotePort Any -Direction Outbound
}
if ((Check-Admin) -eq $false) {
if ($elevated)
{
# could not elevate, quit
}
else {
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "{0}" -elevated' -f ($myinvocation.MyCommand.Definition))
}
exit
}
try {
$rules = $(Get-NetFirewallRule -DisplayName $Name-* -ErrorAction Stop | Out-String)
if (!$rules.Contains($InboundDisplayName) -and !$rules.Contains($OutboundDisplayName))
{
Add-InboundRule
Add-OutboundRule
}
elseif (!$rules.Contains($InboundDisplayName))
{
Add-InboundRule
}
elseif (!$rules.Contains($OutboundDisplayName))
{
Add-OutboundRule
}
else{
Write-Host "Rules found!"
}
}
catch [Exception] {
Add-InboundRule
Add-OutboundRule
}