Skip to content

[firewall rules] Additional documentation for filters in the API #6032

Closed

Description

@karencfv

Not sure if this is the right repo for this issue, happy to move it if it belongs elsewhere.

I have some firewall rules that don't specify any ports in the filters:

$ oxide vpc firewall-rules view --vpc fa59febf-92a0-4eb7-8eae-0ff62258502b
success
VpcFirewallRules {
    rules: [
        VpcFirewallRule {
            action: Allow,
            description: "allow all connections from anywhere",
            direction: Inbound,
            filters: VpcFirewallRuleFilter {
                hosts: None,
                ports: None,
                protocols: Some(
                    [
                        Icmp,
                        Tcp,
                        Udp,
                    ],
                ),
            },
            id: 9714b9bc-b4d5-4023-bc83-123222ada61e,
            name: Name(
                "allow-all",
            ),
            priority: 65533,
            status: Enabled,
            targets: [
                Vpc(
                    Name(
                        "calico-test",
                    ),
                ),
            ],
            time_created: 2024-07-10T05:32:26.683745Z,
            time_modified: 2024-07-10T05:32:26.683745Z,
            vpc_id: fa59febf-92a0-4eb7-8eae-0ff62258502b,
        },
        VpcFirewallRule {
            action: Allow,
            description: "allow all outbound traffic to anywhere",
            direction: Outbound,
            filters: VpcFirewallRuleFilter {
                hosts: None,
                ports: None,
                protocols: Some(
                    [
                        Icmp,
                        Tcp,
                        Udp,
                    ],
                ),
            },
            id: 29d53e48-b79d-444a-b91f-3e5996798e98,
            name: Name(
                "allow-internal-outbound",
            ),
            priority: 65534,
            status: Enabled,
            targets: [
                Vpc(
                    Name(
                        "calico-test",
                    ),
                ),
            ],
            time_created: 2024-07-10T05:32:26.683753Z,
            time_modified: 2024-07-10T05:32:26.683753Z,
            vpc_id: fa59febf-92a0-4eb7-8eae-0ff62258502b,
        },
    ],
}

When i try to connect using port 80 the connection is refused

$ nc -v 45.154.216.153 80
nc: connect to 45.154.216.153 port 80 (tcp) failed: Connection refused

When I try to connect using port 22 the connection succeeds

$ nc -v 45.154.216.153 22
Connection to 45.154.216.153 22 port [tcp/ssh] succeeded!
SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.3

Is this expected? It feels a bit odd to have some ports enabled by default and others not

Activity

  1. added
    networking
    on Jul 10, 2024
  2. FelixMcFelix commented on Jul 10, 2024

    @FelixMcFelix
    Contributor

    I believe this is expected; the firewall isn't blocking any traffic, from what I can see. If we were blocking the traffic on port 80, then I think we'd see a timeout when opening the TCP socket (as, e.g., the SYN would never reach the guest). Instead, it looks like we're seeing the guest send a TCP RST and kill the connection. That could be due to not having any socket bound/listening on port 80, or firewall config in the guest.

  3. karencfv commented on Jul 14, 2024

    @karencfv
    ContributorAuthor

    Awesome thanks!

    So, just to clarify, if we don't specify any ports then all ports are allowed? Perhaps we should document this somewhere 🤔

  4. david-crespo commented on Jul 14, 2024

    @david-crespo
    Contributor

    That’s a property of all the things we call “filters” — that’s what makes them filters. I agree we need to explain this every chance we get.

    IMG_5560

  5. karencfv commented on Jul 15, 2024

    @karencfv
    ContributorAuthor

    The user may not be using the console, perhaps the docs can live directly on the API

  6. david-crespo commented on Jul 15, 2024

    @david-crespo
    Contributor

    Definitely. I’ll make a note to check the doc comments on the firewall rule types and see how they get handled by the openapi schema and the docs site.

  7. karencfv commented on Jul 15, 2024

    @karencfv
    ContributorAuthor

    Thanks! Happy to help as well :)

  8. changed the title [-][firewall rules] Port 22 is enabled by default if no ports are set in filters[/-] [+][firewall rules] Additional documentation for filters in the API[/+] on Jul 15, 2024
  9. added this to the 10 milestone on Jul 22, 2024
  10. added a commit that references this issue on Jul 25, 2024
    71fe60a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    networking

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions