Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Commit

Permalink
feat: Add ACL rules for some network endpoints on Windows (#3833)
Browse files Browse the repository at this point in the history
  • Loading branch information
AbelHu authored Mar 16, 2021
1 parent e6b6f49 commit 2f854cb
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
38 changes: 38 additions & 0 deletions parts/k8s/windowsazurecnifunc.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,44 @@ Set-AzureCNIConfig
if ($IsAzureStack) {
Add-Member -InputObject $configJson.plugins[0].ipam -MemberType NoteProperty -Name "environment" -Value "mas"
}

$aclRule1 = [PSCustomObject]@{
Type = 'ACL'
Protocols = '6'
Action = 'Block'
Direction = 'Out'
RemoteAddresses = '168.63.129.16/32'
RemotePorts = '80'
Priority = 200
RuleType = 'Switch'
}
$aclRule2 = [PSCustomObject]@{
Type = 'ACL'
Action = 'Allow'
Direction = 'In'
Priority = 65500
}
$aclRule3 = [PSCustomObject]@{
Type = 'ACL'
Action = 'Allow'
Direction = 'Out'
Priority = 65500
}
$jsonContent = [PSCustomObject]@{
Name = 'EndpointPolicy'
Value = $aclRule1
}
$configJson.plugins[0].AdditionalArgs += $jsonContent
$jsonContent = [PSCustomObject]@{
Name = 'EndpointPolicy'
Value = $aclRule2
}
$configJson.plugins[0].AdditionalArgs += $jsonContent
$jsonContent = [PSCustomObject]@{
Name = 'EndpointPolicy'
Value = $aclRule3
}
$configJson.plugins[0].AdditionalArgs += $jsonContent

$configJson | ConvertTo-Json -depth 20 | Out-File -encoding ASCII -filepath $fileName
}
Expand Down
38 changes: 38 additions & 0 deletions pkg/engine/templates_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2f854cb

Please sign in to comment.