Firewall – Deny from localhost with ufw

firewallufw

I have a service running on port 1339. Is it possible to deny requests from localhost to this port? Currently I have an ufw rule to allow requests from a specified IP but localhost can access the port as well. I don't want users logged in to the server access the url with curl or wget, the port should only be accessible from the specified IP. Is this possible?

Best Answer

I guess it should be possible, with something like this:

ufw deny from 127.0.0.1 to any port 1339

According to the ufw syntax, that's how you block a specific port on an specific IP.