OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Subject: Re: closing network ports
From: Bennett Todd (betRAHUL.NET)
Date: Thu Jul 13 2000 - 12:53:22 CDT


2000-07-13-02:56:34 Marcin Wójtowski:
> On Wed, 12 Jul 2000, Desai, Ashish wrote:
> > Any open port must have a corresponding process.
> And what if I wrote and test my bug program which open socket
> and forget to close it. Program finish his job, but port is
> unavaible. What then?

If your program is still running, then the port does still have
a corresponding process, which you can identify with lsof, and
kill. If it doesn't have an init script then the deed is done,
nothing more is needed.

If your program finishes its job and _exits_, it matters not whether
you remember to close the port or not; the claim that an open
port must have a corresponding process is a statement about how
Unix behaves: on process exit, associated open file descriptors,
including those that happen to be network sockets, are closed by
the operating system, as part of its process destruction. The port
will stop servicing incoming requests (and therefore cease to be a
security worry) the instant the process exits. It will also become
available for other processes to bind to it at the same instant.

-Bennett


  • application/pgp-signature attachment: stored