costales / gufw

Linux Firewall
GNU General Public License v3.0
129 stars 33 forks source link

Unable to add port range #65

Closed dajusc closed 10 months ago

dajusc commented 10 months ago

Problem description:

When the "port"-Textedit contains port ranges like "4242:4343" the "Add"-Button is disabled (see screenshot below) ,and hence the port range can't be added as a firewall rule.

According to the tooltip that appears when hovering the mouse over the "port"-Textedit the input "4242:4343" should be the correct syntax to add a port range.

Adding a single ports like "4242" works just fine.

Adding a port range using bash and ufw without using gufw works (command e.g. "$sudo ufw allow 4242:4343/udp")

Expected behavior: The "Add"-Button should not be disabled when port ranges like "4242:4343" are inserted into the "port"-Textedit, and it should hence be possible to add them as a ufw rule.

Tested on/with: Linux Mint 21.2 Cinnamon 5.8.4 gufw 22.04.0 (from system repo) German locale

Screenshots: gufw_01 gufw_02

p1gp1g commented 10 months ago

I've had the same issue. Port ranges can't be set if you don't specify the protocol (Both). It will work as soon as you choose TCP or UDP

dajusc commented 10 months ago

Thank you for the additional info @p1gp1g! So the issue is not as problematic as I initially thought, because you can just add port ranges for TCP/UDP one after the other.

It would still be great if it could be fixed.

costales commented 10 months ago

That is an ufw behavior, there is not a possible fix.

dajusc commented 10 months ago

@costales thank you for your answer. You are correct in the sense, that the operation apparently can't be mapped to a single ufw command. However, it is possible to realize the operation by two separate ufw commands: one per protocol.

I have implemented this and it seems to work: https://github.com/dajusc/gufw/commit/2348e60634203d9dfa5624c6512ad05f585d9653 Please review the commit referenced above and tell me if I should create a pull request.

PS.: I only minimally changed the functions/signals related to the disabling/enabling of the add-button. There could be some cleanup if desired... PPS.: Nice Easter egg ;)

costales commented 10 months ago

Hi, Sorry, but I want to be attached to how ufw works. Thank you for the feedback and code. Best regards.

dajusc commented 10 months ago

Hello and thank you for your answer.

This argument doesn't seem conclusive to me, because you implemented e.g. the functionality "Remove the selected rule(s)" also by executing multiple ufw commands sequentially: https://github.com/costales/gufw/blob/511b686e9f576237aed92f7e445ce7bff55ba97b/gufw/gufw/view/gufw.py#L552-L555

But okay, your project, your decision. Best regards

costales commented 10 months ago

Yes David, because I did things (profiles it's the best example) outside the ufw behavior in the past, I regretted them several times... Thank you for your feedback, I really appreciate it!

Marcos Costales.

On Sun, Nov 26, 2023 at 3:10 PM David Schaefer @.***> wrote:

Hello and thank you for your answer.

This argument doesn't seem conclusive to me, because you implemented e.g. the functionality "Remove the selected rule(s)" also by executing multiple ufw commands sequentially:

https://github.com/costales/gufw/blob/511b686e9f576237aed92f7e445ce7bff55ba97b/gufw/gufw/view/gufw.py#L552-L555

But okay, your project, your decision. Best regards

— Reply to this email directly, view it on GitHub https://github.com/costales/gufw/issues/65#issuecomment-1826794940, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABM5GQXSSGBRZ4P2OCSE3UDYGNEWXAVCNFSM6AAAAAA7MDWKZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRWG44TIOJUGA . You are receiving this because you modified the open/close state.Message ID: @.***>

dajusc commented 10 months ago

Hello Marcos,

Thank you for your explanation. Got it.

Also btw thank you for the great gufw project! Wouldn't have engaged improving it if I wouldn't find it great. :)

Best regards David

Costales @.***> hat am 26.11.2023 15:50 CET geschrieben:

Yes David, because I did things (profiles it's the best example) outside the ufw behavior in the past, I regretted them several times... Thank you for your feedback, I really appreciate it! -- Marcos Costales.

On Sun, Nov 26, 2023 at 3:10 PM David Schaefer @.***> wrote:

Hello and thank you for your answer.

This argument doesn't seem conclusive to me, because you implemented e.g. the functionality "Remove the selected rule(s)" also by executing multiple ufw commands sequentially:

https://github.com/costales/gufw/blob/511b686e9f576237aed92f7e445ce7bff55ba97b/gufw/gufw/view/gufw.py#L552-L555

But okay, your project, your decision. Best regards

— Reply to this email directly, view it on GitHub https://github.com/costales/gufw/issues/65#issuecomment-1826794940, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABM5GQXSSGBRZ4P2OCSE3UDYGNEWXAVCNFSM6AAAAAA7MDWKZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRWG44TIOJUGA . You are receiving this because you modified the open/close state.Message ID: @.***>

— Reply to this email directly, view it on GitHub (https://github.com/costales/gufw/issues/65#issuecomment-1826804204), or unsubscribe (https://github.com/notifications/unsubscribe-auth/ABP7V35QZUGMEUI4RMWVRFTYGNJKDAVCNFSM6AAAAAA7MDWKZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRWHAYDIMRQGQ). You are receiving this because you authored the thread.Message ID: @.***>