apache / apache/cloudstack

ACL with multiple CIDRs does not honor rule id

Open
#12,668 1 comment 0 reactions 0 assignees View on GitHub
component:virtual-router status:needs-reproducing
Dominant language
Java
Stars
3.1k
Forks
1.4k
Avg merge
6d 19h
Merged PRs (30d)
32

Description

### problem

If you have a CIDR list like:

rule 1: [ "1.2.3.4/32", "2.3.4.5/32"] tcp allow port 22
rule 65535: [ "0.0.0.0/0"] deny port any

What you end up with when inspecting the VR is:

```
-A ACL_OUTBOUND_eth12 -d 1.2.3.4/32 -p tcp -m tcp --dport 22 -j ACCEPT
-A ACL_OUTBOUND_eth12 -j DROP
-A ACL_OUTBOUND_eth12 -d 2.3.4.5/32 -p tcp -m tcp --dport 22 -j ACCEPT
```

This is clearly not the desired behavior.

### versions

Cloudstack 4.22.0

### The steps to reproduce the bug

See description

### What to do about it?

Don't use more than one CIDR per rule

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue using the two ACL rules in the report, then inspect the generated ACL_OUTBOUND_eth12 chain in the virtual router. Trace how multiple CIDRs in one rule are ordered and verify that the rule's DROP does not precede the remaining CIDR match; done means all CIDRs in the allow rule are evaluated before the next rule.

Written by the indexing model from the issue text.

Assessment

Domain
authorization, networking, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.