POEST::Plugin::Check::Hostname - Check for a proper host in HELO.


poest documentation Contained in the poest distribution.

Index


Code Index:

NAME

Top

POEST::Plugin::Check::Hostname - Check for a proper host in HELO.

ABSTRACT

Top

Check for a proper host in the HELO command sent from the client.

DESCRIPTION

Top

Events

HELO

Intercept the HELO event. If configured to require a hostname in the HELO sent by the client, it will check the acceptible hosts list for the host specified. If said host is in the list, execution will continue on to the standard HELO implementation that greets the client. If it fails, an error will be sent to the client.

ELOH

Same as HELO.

Configuration

requirehost

If true, a specified (and correct) host will be required. Otherwise these checks will be bypassed. Kind of useless without this, isn't it?

allowedhost

This option has multiple values. A list of hosts that are allowed for this SMTP server.

AUTHOR

Top

Casey West, <casey@dyndns.org>

COPYRIGHT AND LICENSE

Top

SEE ALSO

Top

perl, POEST::Server, POEST::Plugin.


poest documentation Contained in the poest distribution.
# $Id: Hostname.pm,v 1.3 2003/04/08 00:27:30 cwest Exp $
package POEST::Plugin::Check::Hostname;

use strict;
$^W = 1;

use vars qw[$VERSION @ISA];
$VERSION = (qw$Revision: 1.3 $)[1];

use POEST::Plugin;
@ISA = qw[POEST::Plugin];

sub EVENTS () { [ qw[ HELO ELOH] ] }

sub CONFIG () { [ qw[ requirehost allowedhost ] ] }

*HELO = *ELOH = sub {
	my ($kernel, $heap, $self, $session, $cmd, $host)
		= @_[KERNEL, HEAP, OBJECT, SESSION, ARG0, ARG1];
	my $client = $heap->{client};

	if ( $self->{requirehost} ) {
		my (@hosts) = ref $self->{allowedhost} ?
			@{ $self->{allowedhost} } : $self->{allowedhost};

		unless ( $host && grep { $host eq $_ } @hosts ) {
			$client->put( SMTP_ARG_SYNTAX_ERROR, qq[Syntax: $cmd hostname] );
			$session->stop;
		}
	}
};

1;

__END__