netbird icon indicating copy to clipboard operation
netbird copied to clipboard

Access Control: possibility to create not bidirectional rules (one direction) & port ranges in ACLs

Open florian-obradovic opened this issue 1 year ago • 14 comments

Dear Team,

as an admin I want to create one-way / not bidirectional ACLs where I am allowed to:

  1. ICMP ping everyone (I want to ping all machines but they shouldn't be allowed to ping all admin machines) < this works with stateful firewalls
  2. access all machines with all ports for all protocols / or two rules for each proto (UDP / TCP)
  3. define port ranges in ACL like 1433-1438 or 1-65535

CleanShot 2024-07-24 at 22 56 47@2x

Best regards, Flo.

florian-obradovic avatar Jul 24 '24 21:07 florian-obradovic

+1 from my side. That's really an important feature.

Gauss23 avatar Sep 03 '24 11:09 Gauss23

Partial-duplicate of #1328

JonTheNiceGuy avatar Oct 17 '24 22:10 JonTheNiceGuy

+1, otherwise following best practices in 'least privilege' setup is a faaar too tedious task.

ThHirsch avatar Nov 07 '24 01:11 ThHirsch

Hmm, the API documentation is stating, that port RANGES can be specified. see: Api-docu which states elemnts of "port_ranges - start - end' So is this just a missing piece int the current UI and we could create port-ranges for TCP and UDP by API already? Are there any plans to to have it in the UI soon?

ThHirsch avatar Nov 23 '24 17:11 ThHirsch

Hmm, the API documentation is stating, that port RANGES can be specified. see: Api-docu which states elemnts of "port_ranges - start - end' So is this just a missing piece int the current UI and we could create port-ranges for TCP and UDP by API already? Are there any plans to to have it in the UI soon?

I tried to set a policy via API with the following payload:

{
    "name": "Admin Common Ports to All",
    "description": "",
    "enabled": true,
    "query": "",
    "rules": [
        {
            "bidirectional": false,
            "description": "",
            "name": "Admin Common Ports to All",
            "action": "accept",
            "protocol": "tcp",
            "enabled": true,
            "sources": [
                "ctpbua196f2c73bgvc40"
            ],
            "destinations": [
                "ctp6us196f2c73bgvc00"
            ],
            "port_ranges": [
                {
                    "start": 1,
                    "end": 65535
                }
            ]
        }
    ],
    "source_posture_checks": []
}

Got the following answer: {"message":"for all or icmp protocol type flow can be only bi-directional","code":422} It seems like the UI isn't the blocker.

mad73923 avatar Jan 20 '25 08:01 mad73923

So, I was talking to someone who was a project member, but isn't any more, who suggested doing instead of like @mad73923 wrote, do this instead:

{
    "name": "Admin Common Ports to All",
    "description": "",
    "enabled": true,
    "query": "",
    "rules": [
        {
            "bidirectional": false,
            "description": "",
            "name": "Admin Common Ports to All",
            "action": "accept",
            "protocol": "tcp",
            "enabled": true,
            "sources": [
                "ctpbua196f2c73bgvc40"
            ],
            "destinations": [
                "ctp6us196f2c73bgvc00"
            ],
            "ports": [
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
                ........
                65535
            ]
        }
    ],
    "source_posture_checks": []
}

OK, so listing all 64454 ports does work from a policy perspective, but what it also does do is crash the web UI.

If you are entirely managing your policy using the API, it's fine, but as soon as you try to use the webUI for it, it's no longer fine!

JonTheNiceGuy avatar Jan 20 '25 18:01 JonTheNiceGuy

Hi @JonTheNiceGuy alright, seems like a feasible hack. But a crashing webUI is no option for me. BR

mad73923 avatar Jan 20 '25 19:01 mad73923

I've heard rumors that a feature addressing this is in the making. @mlsmaycon is that true?

the-project-group avatar Jan 20 '25 19:01 the-project-group

So I've also just run into this and this would be very important to have as right now manually adding a huge list of ports isn't really feasible.

Blackclaws avatar May 06 '25 08:05 Blackclaws

I was making the switch from Tailscale to NetBird today, and I also ran into this.

This is unfortunately causing me to revert back to Tailscale for the time being. I have high hopes for NetBird.

YellowSnowman23 avatar Jun 21 '25 06:06 YellowSnowman23

Both features have been addressed in the latest release IIRC. I didn’t test it yet.

flotpg avatar Jun 21 '25 08:06 flotpg

Image

This policy results in "Any peer in "ALL" group can connect to any peer with "Admin" group"

Here is an example peer with just the "All" group

Image

Edit: To add, I was on the peer with just the "All" group and i could RDP (Port 3389 obv) to WS-Arlis machine with the "Admin" group. Despite there being no policy to allow that (Yes the default policy is deleted as well)

YellowSnowman23 avatar Jun 21 '25 18:06 YellowSnowman23

Maybe the latest release v0.48.0 fixes this issue?

PatrLind avatar Jun 23 '25 12:06 PatrLind

On the netbird.io: Image

artemklevtsov avatar Jun 23 '25 13:06 artemklevtsov

Maybe the latest release v0.48.0 fixes this issue?

Yeah, everything other than iOS is on v0.48.0. Problem still persists

YellowSnowman23 avatar Jun 24 '25 03:06 YellowSnowman23

Again, I was switching to netbird, but I saw this issue not fixed. Opened more than a year ago. The dashboard clearly doesn't seem to work. This should have been a high priority issue.

zsmith009 avatar Jun 30 '25 00:06 zsmith009

Is unidirectional still missing for all and ICMP ?

@mlsmaycon https://github.com/netbirdio/netbird/pull/3826 < is this addressing my use case?

the-project-group avatar Jul 06 '25 19:07 the-project-group

I am not 100% sure when exactly it was implemented on the frontend, but it's possible to create unidirectional rules for all kinds of traffic using the web dashboard for a few days/weeks already.

Image

nazarewk avatar Sep 11 '25 09:09 nazarewk

Thanks, works!

the-project-group avatar Sep 11 '25 14:09 the-project-group

@mlsmaycon, @bcmmbaga, @pascal-fischer I think I found a bug (v0.59.3), probably related to https://github.com/netbirdio/netbird/pull/3826 ?

I have a unidirectional policy which allows peers which are member of Netbird-Admins to access all others. This doesn't work if the target peer is in the same Netbird-Admins group:

Image

It works if I: a) set the group to bidirectional b) add a policy to which allows admins -> admins and disable the admins -> all:

Image

flotpg avatar Oct 08 '25 20:10 flotpg

Hi @flotpg,

Thanks for reporting this! We’re able to reproduce the issue and are already working on a fix.

bcmmbaga avatar Oct 09 '25 14:10 bcmmbaga