1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PF firewall setting for network programming

Discussion in 'Firewalls' started by Vitamin, Apr 13, 2012.

  1. Vitamin

    Vitamin New Member

    Messages:
    37
    Thanks Received:
    0
    Network programming newb.....just playing around with some code I found online.

    The port that the program is listening on is 3490, in the PF firewall manager, what service should be selected with port 3490 to ensure proper communication during a telnet session? Should I set up telnet for outgoing and incoming via port 3490?

    Below is the pic of my firewall manager

    [​IMG]

    I'm using emacs, if that helps
     
  2. SirDice

    SirDice Moderator Staff Member Moderator

    Messages:
    17,629
    Thanks Received:
    2,386
    OS-X related questions should be asked on an OS-X forum.
     
  3. Vitamin

    Vitamin New Member

    Messages:
    37
    Thanks Received:
    0
    I'm not using OS-X
     
  4. DutchDaemon

    DutchDaemon Administrator Staff Member Administrator Moderator

    Messages:
    10,767
    Thanks Received:
    1,872
    The service name comes from /etc/services. Port 3490 is not bound to a service name. So either put a name in there and use that, or keep using 'Unknown'. Note that the large majority of people here use /etc/pf.conf, where you don't need to define a name like that, though you can (e.g. 'port 22' and 'port ssh' are equivalent)..
     
  5. Vitamin

    Vitamin New Member

    Messages:
    37
    Thanks Received:
    0
    Thanks for the reply.

    The "Unknown" service entry in the picture I attached. It changes from telnet to unknown after a while. What would happen is, telnet session will connect, but I cannot communicate during session. I don't see the customized welcome message for each new accepted connection that is in the program. I type in the telnet window, but the program doesn't receive the message.

    If I do netstat -a I see the Recv-Q with bytes of pending data, but Send-Q is empty. I executed different programming projects, from different websites, but same results. So I assume that my firewall settings are to blame.
     
  6. DutchDaemon

    DutchDaemon Administrator Staff Member Administrator Moderator

    Messages:
    10,767
    Thanks Received:
    1,872
    Assuming you're running the program yourself and want to allow traffic from the outside in (and assuming it runs on the pf machine), a pf rule would look like this. Can't help you with any firewall managers, I don't use any.

    Code:
    pass in quick on em0 inet proto tcp from any to em0 port 3490 keep state flags S/SA
     
  7. Vitamin

    Vitamin New Member

    Messages:
    37
    Thanks Received:
    0
    Thanks, added it, but still have the problem of having a successful telnet session connection, but not being able to send or receive messages. I will go to the development section for programming specific questions.