You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.
#!/usr/bin/perl -Tw =head1 NAME auth_smtpd - Authenticate user via local network SMTP server =head1 DESCRIPTION This plugin implements a authentication plugin that check sender is the user of SMTP server in local network. =head1 CONFIGURATION Add the plugin to the plugins file in the configuration directory: auth/auth_smtpd smtp_server smtp_port Replace smtp_server and smtp_port with the IP address and port number of the SMTP server that will provide the authentication. Defaults to an IP address of 127.0.0.1 and port 25. =head1 NOTES Requires the Net::SMTP::TLS CPAN module. =head1 AUTHOR Original plugin by: jennifer@thecomputerclinic.ca Plugin updated by: James Turnbull (james@lovedthanlost.net) =head1 COPYRIGHT AND LICENSE =cut sub register { my ( $self, $qp, @args ) = @_; $self->register_hook( "auth-plain", "auth_smtpd" ); $self->register_hook( "auth-login", "auth_smtpd" ); $self->register_hook( "auth-cram-md5", "auth_smtpd" ); if (@args > 0) { if ($args[0] =~ /^([\.\w_-]+)$/) { $self->{_smtp_server} = $1; } else { die "Bad data in smtp server: $args[0]"; } $self->{_smtp_port} = 25; if (@args > 1 and $args[1] =~ /^(\d+)$/) { $self->{_smtp_port} = $1; } $self->log(LOGWARN, "WARNING: Ignoring additional arguments.") if (@args > 2); } else { die("No SMTP server specified in plugins file."); } # set any values that are not already $self->{_smtp_server} ||= "127.0.0.1"; $self->{_smtp_port} ||= 25; } sub auth_smtpd { use Net::SMTP::TLS; my ( $self, $transaction, $mechanism, $user, $clearPassword, $hashPassword, $ticket ) = @_; my ($smtpdhost, $smtpdport, $mesg); # pull values in from config $smtpdhost = $self->{_smtp_server}; $smtpdport = $self->{_smtp_port}; my $mailer; $self->log(LOGINFO, "auth_smtpd/Used $mechanism authentication mechanism for $user on server $smtpdhost at port $smtpdport."); eval { $mailer = new Net::SMTP::TLS( $smtpdhost, Hello => '', Port => $smtpdport, User => $user, Password=> $clearPassword) ; }; # failed if ($@){ return DECLINED; return ( DENY, "auth_smtpd/$mechanism authentication for $user failed." ); } else { $mailer->quit; return ( OK, "auth_smtpd/$mechanism authentication for $user" ); } }