Isaksson / node-red-contrib-unifi

MIT License
51 stars 20 forks source link

Feature Request: Firewall Rules On/Off #45

Closed Ricardo-Miguel-Caldeira closed 2 years ago

Ricardo-Miguel-Caldeira commented 3 years ago

Any chance of implemienting a simple ON/OFF firewall rulles please? This would be very interesting...

rest/firewallrule | GET/PUT | User defined firewall rules.

Thanks!

Isaksson commented 3 years ago

I would like to add that function, but the problem is that I do not have an USG so I can't find the correct command for this.

ozett commented 3 years ago

i have a USG... may i can provide some information?

Ricardo-Miguel-Caldeira commented 3 years ago

I would like to add that function, but the problem is that I do not have an USG so I can't find the correct command for this.

I have a UDMP... Let me know if can I help!

kgalilio commented 3 years ago

This would be a great feature to have. Currently the unifi controller can only block wireless clients. Several customers complained for the past one year, but no fix available yet to block wired clients. If this unifi node can dynamically enable/disable firewall rules, it will solve our problem and enable us to activate a preset firewall rule to drop all traffic from/to a certain client. I have UDM Pro. Please let me know if you would like me to provide any logs if it would help implementing this feature.

Isaksson commented 3 years ago

Thanks to you all that would like to provide help with logs and things like that. It's very time consuming to send logs, read log, make the coding and then send the files for test and then new logs and same thing all over again for several days.

What I need is access to the controller and the permission to enable/disable firewall rules, and I understand if you guys don't want to give me that kind of access to your environment. And even if I get access I could not promise that it's possible to do this enable/disable from this node.

Maybe someone has a Test environment with a UDM Pro? Or same spare equipment that they could connect or send to me to use for this kind of development.

ozett commented 3 years ago

would still be great to trigger on/off with node-red. but my usg is in use everday.. 😢

image

found some start: https://help.ui.com/hc/en-us/articles/360005460813-UniFi-USG-Advanced-Policy-Based-Routing-

but cannot automate... 😢

ozett commented 3 years ago

i gave this here a try with ssh and it looked somehow like success.

(but that did not change the gui-button, was alway green ) 🧛 image

maybe someon can bring this into this module here?

ssh into the USG, do this cmd: show firewall statistics

image

disable == set disable

do cmd:

configure && set firewall name GUEST_IN rule 2006 disable

do cmd:

commit
save

image

enable == delete disabled

do cmd:

configure && set firewall name GUEST_IN rule 2006 enable

do cmd:

commit
save

image

image

🌹 but the automation from node-red would be better... 😄

does the api allow "disable/enable" ? image