Since firewall rules work on an order of precedent, it's likely that you have the deny rule that comes after some other rule that allows the traffic through and thus that traffic never hits the deny rule.
You can see the order of the rules by running ufw status numbered
to confirm if that's the case.
To resolve you could try to delete the deny rule and then add it back with the specific NUM
order position you need it to be so that traffic is denied before the allow rule allows it through.
To keep it simple, let's say your deny rule is number 5
and the allow rule letting it through before the deny is number 2
. If that were the case, then run these commands to reorder properly...
ufw delete 5
ufw insert 1 deny 78.128.113.58/24 to any
This would put the deny rule above the allow rule and ensure the correlated traffic is denied before it hits the allow rule. Just be sure to check the ufw status numbered
after you make adjustments to ensure the operation didn't move any other rules around improperly ordering them. It's be best to also be sure to have a backup of the configuration settings beforehand too just in case.
Supporting Resources