Skip to content

Firewall rules using VPC as target should allow/deny traffic based on private IP, not external IP #380

@askfongjojo

Description

@askfongjojo

While investigating oxidecomputer/omicron#3373, I've dug in a bit more on just the default firewall rule behavior (w/o making any changes to the VPC fw rules). This is the opte firewall setup for a brand new project and default VPC (and no change to the fw rules):

BRM44220011 # /opt/oxide/opte/bin/opteadm list-layers -p opte6
NAME         RULES IN   RULES OUT  DEF IN   DEF OUT  FLOWS     
gateway      1          5          deny     deny     0         
firewall     3          0          deny     stateful allow 0         
router       0          2          allow    deny     0         
nat          1          2          allow    allow    0         
overlay      1          1          deny     deny     0  

BRM44220011 # /opt/oxide/opte/bin/opteadm dump-layer firewall -p opte6
Layer firewall
======================================================================
Inbound Flows
----------------------------------------------------------------------
PROTO  SRC IP           SPORT  DST IP           DPORT  HITS     ACTION                
TCP    172.20.17.42     64834  172.30.0.5       5201   0        no-op                 

Outbound Flows
----------------------------------------------------------------------
PROTO  SRC IP           SPORT  DST IP           DPORT  HITS     ACTION                
TCP    172.30.0.5       5201   172.20.17.42     64834  1        no-op                 

Inbound Rules
----------------------------------------------------------------------
ID     PRI    HITS   PREDICATES                             ACTION            
2      65534  1      inner.ip.proto=TCP                     "Stateful Allow"
                     inner.ulp.dst=22                      

1      65534  1      meta: vni=7524168                      "Stateful Allow"
0      65534  0      inner.ip.proto=ICMP                    "Stateful Allow"
DEF    --     0      --                                     "deny"

Outbound Rules
----------------------------------------------------------------------
ID     PRI    HITS   PREDICATES                             ACTION            
DEF    --     47     --                                     "stateful allow

I created an instance in it and ran an iperf3 server on it.

ubuntu@default-fwrules:~$ iperf3 -s -D
ubuntu@default-fwrules:~$ exit
logout
Connection to 172.20.26.45 closed.
pisces-2:docs angela$ nc -vz 172.20.26.45 5201
Connection to 172.20.26.45 port 5201 [tcp/targus-getdata1] succeeded!

Based on the default rules, the only port accessible on tcp should be 22. So it'd look like the deny-all default is not taking effect.

Next, I tried disabling the allow-ssh rule and saw that the change was reflected in the opte port:

BRM44220011 # /opt/oxide/opte/bin/opteadm dump-layer firewall -p opte6
Layer firewall
======================================================================
Inbound Flows
----------------------------------------------------------------------
PROTO  SRC IP           SPORT  DST IP           DPORT  HITS     ACTION                
TCP    172.20.17.42     64897  172.30.0.5       22     0        no-op                 

Outbound Flows
----------------------------------------------------------------------
PROTO  SRC IP           SPORT  DST IP           DPORT  HITS     ACTION                
TCP    172.30.0.5       22     172.20.17.42     64897  1        no-op                 

Inbound Rules
----------------------------------------------------------------------
ID     PRI    HITS   PREDICATES                             ACTION            
4      65534  1      meta: vni=7524168                      "Stateful Allow"
3      65534  0      inner.ip.proto=ICMP                    "Stateful Allow"
DEF    --     0      --                                     "deny"

Outbound Rules
----------------------------------------------------------------------
ID     PRI    HITS   PREDICATES                             ACTION            
DEF    --     50     --                                     "stateful allow"

Afterwards, I was still able to SSH to the vm. This further confirms that there is no firewall at all.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions