0

I want to allow curl -if localhost:54321 only with ufw. What rule can I apply from the command line?

I have tried ufw allow proto tcp from any to any port 54321 and ufw status shows the following:

To                         Action      From
--                         ------      ----
54321/tcp                  ALLOW       Anywhere
54321/tcp (v6)             ALLOW       Anywhere (v6)

But still I'm unable to curl -if localhost:54321.

  • 2
    There's a pretty clear example on the ufw man page that allows tcp connections from an IP to a port. Did you try that one? – Zip Oct 30 '17 at 10:31
0

From man ufw:

Allow access to udp 1.2.3.4 port 5469 from 1.2.3.5 port 5469:

    ufw allow proto udp from 1.2.3.5 port 5469 to 1.2.3.4 port 5469

Hence the command you're looking for is

     ufw allow proto tcp from <ip_source> to <ip_destination> port 54321
0

Got it:

ufw allow proto tcp from any to any port 54321,54322
ufw allow out proto tcp from any to any port 54321,54322

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.