this post was submitted on 11 Oct 2024
6 points (61.5% liked)

Selfhosted

40137 readers
571 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

I want to set up ufw on my server, but something wrong here. Even when I trying to block 22 port ssh still working and nothing changing. I have ufw enabled, but nothing works.

you are viewing a single comment's thread
view the rest of the comments
[–] sxan@midwest.social 3 points 1 month ago (1 children)

Make sure you're applying them to the active profile.

[–] someoneFromInternet@lemmy.ml -3 points 1 month ago (1 children)
[–] sxan@midwest.social 1 points 1 month ago (1 children)
[–] someoneFromInternet@lemmy.ml 1 points 1 month ago (1 children)
[–] sxan@midwest.social 2 points 1 month ago

It's listed as the "profile" in the screenshots you're listing, but that's the ruleset you're altering.

I used nft or iptables, and my interaction with ufw has been sparse, and mostly through the UI, because the rulesets the GUI generates are incomprehensible. There should be a command in ufw to report which profile is active.

I'm going to guess this is a dead-end, since you've been using the CLI and I have to believe it uses the active profile by default, unless you tell it otherwise. However, in the GUI, if you edit rules in a profile it doesn't automatically apply to your current ruleset. And if you alter your current ruleset, it doesn't automatically persist it. So, even if you change a rule on the Home profile, and the Home profile is active, it doesn't automatically get applied to the running ruleset; you have to take another action to apply it.

Mind you, that's all through the UI; I've never used the ufw command line, so this is (again) probably a red herring. I find ufw to be obtuse at best, because of the Byzantine rulesets it generates.