John,

> Given a service such as e-mail which uses a non-privileged 
> port to send mail out, are there are any specific mechanisms as 
> to which port is selected?  This will no doubt be dependant on the
> O/S, but is it really a random numbered port, the first 
> non-privileged port it knows is not in use, or does the O/S have 
> any other mechanism for selecting the port?

These are (usually) called ephemeral ports.  The logic is OS specific.  Your answers 
are here:

http://www.ncftpd.com/ncftpd/doc/misc/ephemeral_ports.html
http://www.iana.org/assignments/port-numbers

> My problem is that given that a site has a firewall blocking specific
> non-privileged ports (e.g. 2222) against all IP traffic (both 
> as a source port or a destination port), if a genuine site tries to 
> e-mail them a message and the sending host selects that port (2222)
> then the mail message will not be sent. The MTA will probably queue 
> the message and ... 

The scenario you describe could happen.  A general rule saying "no traffic at all on 
port X" is probably not such a hot idea.

People usually set up their firewall rules with only half of the information.   For 
instance, allow TCP connections from the internet to machine X if the destination port 
is Y.  Any source port would be acceptable.

Regards,
David

Reply via email to