|
|
|
@ -27,6 +27,31 @@ function Add-IptablesChain {
|
|
|
|
|
iptables -t $Table -N $Chain
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function Test-IptablesRule {
|
|
|
|
|
param (
|
|
|
|
|
[string]$Chain,
|
|
|
|
|
[string]$Table = 'nat',
|
|
|
|
|
[array]$Rule
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
$argument_list = @(
|
|
|
|
|
'-t'
|
|
|
|
|
$Table
|
|
|
|
|
'-C'
|
|
|
|
|
$Chain
|
|
|
|
|
)+$Rule
|
|
|
|
|
|
|
|
|
|
$check_splat = @{
|
|
|
|
|
FilePath = 'iptables'
|
|
|
|
|
ArgumentList = $argument_list
|
|
|
|
|
Wait = $true
|
|
|
|
|
PassThru = $true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$check = Start-Process @check_splat
|
|
|
|
|
|
|
|
|
|
Write-Output ($check.ExitCode -eq 0)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# setup SWARM-NAT chain
|
|
|
|
|
$chain = 'SWARM-NAT'
|
|
|
|
|