mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-06-01 13:32:35 +08:00
fix: aws secgroup out rule is deny any
This commit is contained in:
@@ -125,9 +125,6 @@ func AddDefaultRule(rules []SecurityRule, defaultRule SecurityRule, localRuleStr
|
||||
defaultRule.Priority = max
|
||||
}
|
||||
defaultRule.Priority -= int(order)
|
||||
if onlyAllowRules {
|
||||
defaultRule.Priority = -1
|
||||
}
|
||||
return append(rules, defaultRule)
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ func (self *SAwsRegionDriver) GetDefaultSecurityGroupInRule() cloudprovider.Secu
|
||||
}
|
||||
|
||||
func (self *SAwsRegionDriver) GetDefaultSecurityGroupOutRule() cloudprovider.SecurityRule {
|
||||
return cloudprovider.SecurityRule{SecurityRule: *secrules.MustParseSecurityRule("out:allow any")}
|
||||
return cloudprovider.SecurityRule{SecurityRule: *secrules.MustParseSecurityRule("out:deny any")}
|
||||
}
|
||||
|
||||
func (self *SAwsRegionDriver) GetSecurityGroupRuleMaxPriority() int {
|
||||
|
||||
@@ -34,7 +34,7 @@ func TestAwsRuleSync(t *testing.T) {
|
||||
|
||||
data := []TestData{
|
||||
{
|
||||
Name: "Test out deny rules",
|
||||
Name: "Test remove out allow rules",
|
||||
LocalRules: secrules.SecurityRuleSet{
|
||||
localRuleWithPriority("out:deny any", 1),
|
||||
},
|
||||
@@ -49,6 +49,30 @@ func TestAwsRuleSync(t *testing.T) {
|
||||
remoteRuleWithName("", "out:allow any", 1),
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "Test out deny rules",
|
||||
LocalRules: secrules.SecurityRuleSet{
|
||||
localRuleWithPriority("out:deny any", 1),
|
||||
},
|
||||
RemoteRules: []cloudprovider.SecurityRule{},
|
||||
Common: []cloudprovider.SecurityRule{},
|
||||
InAdds: []cloudprovider.SecurityRule{},
|
||||
OutAdds: []cloudprovider.SecurityRule{},
|
||||
InDels: []cloudprovider.SecurityRule{},
|
||||
OutDels: []cloudprovider.SecurityRule{},
|
||||
},
|
||||
{
|
||||
Name: "Test out allow rules",
|
||||
LocalRules: secrules.SecurityRuleSet{},
|
||||
RemoteRules: []cloudprovider.SecurityRule{},
|
||||
Common: []cloudprovider.SecurityRule{},
|
||||
InAdds: []cloudprovider.SecurityRule{},
|
||||
OutAdds: []cloudprovider.SecurityRule{
|
||||
remoteRuleWithName("", "out:allow any", 0),
|
||||
},
|
||||
InDels: []cloudprovider.SecurityRule{},
|
||||
OutDels: []cloudprovider.SecurityRule{},
|
||||
},
|
||||
}
|
||||
|
||||
for _, d := range data {
|
||||
|
||||
Reference in New Issue
Block a user