Opening Ports

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Luke Davis

    #1

    Opening Ports

    I'm looking for an effective way to open and close TCP ports. Can I do
    this through Tcpclient? And I know this is a potential security risk, so
    what kind of permission must the person running the application possess to
    handle it without errors?

    --
    Luke Davis, MCSE: Security
    DEM Networks - Senior Systems Architect
    7225 N First, Suite 105
    Fresno, CA 93720
    Office: 1 (559) 439-1000
    Fax: 1 (866) 640-2041



  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Opening Ports

    Luke,

    To what end are you trying to open the ports? Are you saying that you
    are trying to open up ports in a firewall? If so, then TcpClient is not the
    right class to use.

    If you are trying to open ports in a firewall, then how you open those
    ports is dependent on the firewall product.

    Which is it that you are trying to do?

    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "Luke Davis" <luke@gorealco. comwrote in message
    news:%23ZMBa7O8 HHA.5404@TK2MSF TNGP02.phx.gbl. ..
    I'm looking for an effective way to open and close TCP ports. Can I do
    this through Tcpclient? And I know this is a potential security risk, so
    what kind of permission must the person running the application possess to
    handle it without errors?
    >
    --
    Luke Davis, MCSE: Security
    DEM Networks - Senior Systems Architect
    7225 N First, Suite 105
    Fresno, CA 93720
    Office: 1 (559) 439-1000
    Fax: 1 (866) 640-2041

    >
    >

    Comment

    • Chris Shepherd

      #3
      Re: Opening Ports

      Luke Davis wrote:
      I'm looking for an effective way to open and close TCP ports. Can I do
      this through Tcpclient? And I know this is a potential security risk, so
      what kind of permission must the person running the application possess to
      handle it without errors?
      Yes, and No, all at the same time. Your question is pretty vague, so it
      would help a great deal if you could pin it down a bit better.

      Leaving the firewall comments to Nicholas and taking them out of
      consideration, opening a port presents no great security risk. Opening a
      port that has an application listening on it that is vulnerable to
      various attacks presents a security risk.

      Semantical discussion aside, you asked about permissions. On Windows,
      the permissions that matter in relation to opening ports are whether
      you're Administrator/System or not. If you are running as System:
      - You can open a listening TCP or UDP socket in the Well-Known port range.
      - You can perform raw socket operations (unlikely that you will ever
      need this).

      This page lists the various port ranges:
      http://www.microsoft.com/technet/com...uy/cg1205.mspx

      As for what to use, assuming still that this is an incoming "server"
      type connection you want to open, then TcpListener is probably what
      you're looking for. If you want to connect out to another box, TcpClient
      should be correct.

      Elaborating more on what you are trying to do will definitely get you
      clearer responses though.

      Chris.

      Comment

      • Luke Davis

        #4
        Re: Opening Ports

        Alright, thanks for the advice. I want to automatically open the ports on
        the Windows, MacAfree, and Symantec software. So TCPclient will not be
        able to do that? It is just good for connecting to a port, but not opening
        the firewall. What namespace/class would be good for that type of
        operation?

        "Chris Shepherd" <chsh@nospam.ch sh.cawrote in message
        news:OhejMnU8HH A.2476@TK2MSFTN GP05.phx.gbl...
        Luke Davis wrote:
        >I'm looking for an effective way to open and close TCP ports. Can I do
        >this through Tcpclient? And I know this is a potential security risk,
        >so what kind of permission must the person running the application
        >possess to handle it without errors?
        >
        Yes, and No, all at the same time. Your question is pretty vague, so it
        would help a great deal if you could pin it down a bit better.
        >
        Leaving the firewall comments to Nicholas and taking them out of
        consideration, opening a port presents no great security risk. Opening a
        port that has an application listening on it that is vulnerable to various
        attacks presents a security risk.
        >
        Semantical discussion aside, you asked about permissions. On Windows, the
        permissions that matter in relation to opening ports are whether you're
        Administrator/System or not. If you are running as System:
        - You can open a listening TCP or UDP socket in the Well-Known port range.
        - You can perform raw socket operations (unlikely that you will ever need
        this).
        >
        This page lists the various port ranges:
        http://www.microsoft.com/technet/com...uy/cg1205.mspx
        >
        As for what to use, assuming still that this is an incoming "server" type
        connection you want to open, then TcpListener is probably what you're
        looking for. If you want to connect out to another box, TcpClient should
        be correct.
        >
        Elaborating more on what you are trying to do will definitely get you
        clearer responses though.
        >
        Chris.

        Comment

        Working...