grinder has asked for the wisdom of the Perl Monks concerning the following question:
I want to prove to myself that my firewall rules are set up correctly, and that it is not possible for a remote host to connect to said port, otherwise is would be possible to bypass the antivirus check.
Someone suggested Net::SMTP. Since it is derived from IO::Socket::INET, it can accept a PeerPort attribute, which would let me do what I want. Unfortunately, what I have written does not work:
#! /usr/bin/perl -w use strict; use Net::SMTP; my $host = shift || die "No host specified on command line.\n"; my $port = shift || die "No port specified on command line.\n"; my $s = Net::SMTP->new( $host, PeerPort => $port ); print $s->banner(), "\n"; $s->to( 'postmaster' ); $s->data(); $s->datasend( scalar gmtime ); $s->datasend( "\n" ); my $foo = <STDIN>; $s->dataend(); $s->quit();
While the script waits on STDIN, I can run a netstat and look for the open socket, and I see:
x.x.x.x.39394 y.y.y.y.25 8675 0 8760 0 ESTABLISHE +D
That is, the connection is opened on the port 25, not the port specified by the PeerPort attribute. I do get the banner, as double proof that the connection is connected on 25. Can someone hit me with a cluestick? Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sending SMTP mail on other than port 25
by abstracts (Hermit) on Apr 26, 2002 at 10:43 UTC | |
|
Re: Sending SMTP mail on other than port 25
by projekt21 (Friar) on Apr 26, 2002 at 10:43 UTC | |
by grinder (Bishop) on Apr 26, 2002 at 12:51 UTC | |
|
Re: Sending SMTP mail on other than port 25
by shotgunefx (Parson) on Apr 26, 2002 at 10:44 UTC | |
|
Re: Sending SMTP mail on other than port 25
by asdfgroup (Beadle) on Apr 26, 2002 at 14:09 UTC | |
by gav^ (Curate) on Apr 26, 2002 at 15:33 UTC | |
by Anonymous Monk on Apr 27, 2002 at 02:09 UTC |