Net::S...ARTTLS(3pm)
π Net::Server::Mail::ESMTP::STARTTLS π
okay bestie, so this is a Perl module from the User Contributed Perl Documentation set, and it's literally the little glow-up your Net::Server::Mail::ESMTP server needs to do TLS. here's the whole vibe β¨
β¨ NAME β¨
Net::Server::Mail::ESMTP::STARTTLS β a module to support the STARTTLS command in Net::Server::Mail::ESMTP
like. that's it. that's the whole job. and it eats. π
π¦ SYNOPSIS π¦
here's the whole serve, copy-paste ready, no notes:
use strict;
use Net::Server::Mail::ESMTP;
my @local_domains = qw(example.com example.org);
my $server = IO::Socket::INET->new( Listen => 1, LocalPort => 25 );
my $conn;
while($conn = $server->accept)
{
my $esmtp = Net::Server::Mail::ESMTP->new(
socket => $conn,
SSL_config => {
SSL_cert_file => 'your_cert.pem',
SSL_key_file => 'your_key.key',
# Any other options taken by IO::Socket::SSL
}
);
# activate some extensions
$esmtp->register('Net::Server::Mail::ESMTP::STARTTLS');
# adding optional STARTTLS handler
$esmtp->set_callback(STARTTLS => \&tls_started);
$esmtp->process();
$conn->close();
}
sub tls_started {
my ($session) = @_;
# Now, allow authentication
$session->register('Net::Server::Mail::ESMTP::AUTH');
}
ok so notice the set_callback(STARTTLS => \&tls_started) bit? that's you getting a lil notification the moment TLS has actually started, and that's when you slide in and register Net::Server::Mail::ESMTP::AUTH. because you are NOT doing auth over plaintext, bestie. not on my watch. π«Ά
πΈ DESCRIPTION πΈ
so here's the tea: this module conducts a TLS handshake with the client the second it receives the STARTTLS command. it uses IO::Socket::SSL β and it requires 1.831+, no negotiating on that β to perform the handshake and secure the traffic. π₯
there's also one extra option, SSL_config, that gets passed to Net::Server::Mail::ESMTP's constructor. it contains options for IO::Socket::SSL's constructor, so if you wanna know what goes in there, please refer to IO::Socket::SSL's perldoc for details. iykyk π
π SEE ALSO π
please, see Net::Server::Mail. that's the main character this whole module is supporting. π
β¨ AUTHOR β¨
this module has been written by Xavier Guimard <x.guimard@free.fr> using libs written by:
- Mytram
<rmytram@gmail.com> - Dan Moore
"<dan at moore.cx>"
collab of the century tbh π
π AVAILABILITY π
available on CPAN. yes, THE CPAN.
anonymous Git repository:
git clone git://github.com/rs/net-server-mail.git
Git repository on the web:
<https://github.com/rs/net-server-mail>
go forth and clone, bestie π¦
π BUGS π
please use the CPAN system to report a bug (http://rt.cpan.org/). don't be shy, don't DM it to me, put it in the system. π
πΈ LICENSE AND COPYRIGHT πΈ
Copyright (C) 2009 - Dan Moore <dan at moore.cx>
Copyright (C) 2013 - Mytram <rmytram@gmail.com>
Copyright (C) 2013 - Xavier Guimard <x.guimard@free.fr>
this program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
see http://dev.perl.org/licenses/ for more information.
real talk though β this is security code, so like, respect the1.831+requirement and actually pass a real cert and key inSSL_config. the vibe is immaculate but the handshake is load-bearing. π
okay bye ily, this page was served to you by perl v5.34.0, dated 2022-05-26, straight from the User Contributed Perl Documentation. slay β¨π π«Ά
π¦ where this page comes from
- debian bookworm: libnet-server-mail-perl 0.28-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libnet-server-mail-perl 0.28-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libnet-server-mail-perl 0.28-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libnet-server-mail-perl 0.28-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libnet-server-mail-perl 0.28-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms