Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Net::SMTPS => auth no longer works - Migration from Debian to Docker container

by Lotus1 (Vicar)
on Jan 06, 2020 at 18:03 UTC ( #11111071=note: print w/replies, xml ) Need Help??


in reply to Net::SMTPS => auth no longer works - Migration from Debian to Docker container

From the OP:

my $smtp = Net::SMTPS->new( $server, Port => $server_port, Debug => 1, + doSSL => +$mail_sasl_type) || die "cannot connect to server ${server}"; my $sasl = Authen::SASL->new( mechanism => 'PLAIN', debug => 1, callba +ck => {pas +s => $pass, user => $user}); $smtp->auth( $sasl ) || die "cannot do mail auth";

From the output you posted I see the die statement is where it fails at $smtp->auth( $sasl ) || die [...]. Looking at the auth() method I found the documentation points out a difference in Net::SMTPS and Net::SMTP. You might try to specify the AUTHMETHOD as shown at Net::SMTPS.

METHODS Most of all methods of Net::SMTP are inherited as is, except auth(). auth ( USERNAME, PASSWORD [, AUTHMETHOD]) Attempt SASL authentication through Authen::SASL module. AUTHMETHOD is + your required method of authentication, like 'CRAM-MD5', 'LOGIN', .. +. etc. If your selection does not match the server-offerred AUTH mech +anism, authentication negotiation may fail.

Also, the synopsis for Authen::SASL shows mechanism specified as a list of the choices. You only provide PLAIN but it might be looking for one of the other options shown in your debug output.

SYNOPSIS use Authen::SASL; $sasl = Authen::SASL->new( mechanism => 'CRAM-MD5 PLAIN ANONYMOUS', callback => { pass => \&fetch_password, user => $user, } );

Debug output from Net::SMTPS :

Net::SMTPS=GLOB(0x562fb253e128)<<< 250-AUTH PLAIN LOGIN CRAM-MD5 DIGES +T-MD5

Replies are listed 'Best First'.
Re^2: Net::SMTPS => auth no longer works - Migration from Debian to Docker container
by Anonymous Monk on Jan 07, 2020 at 14:14 UTC
    That might be some part of it but I doubt it. I suspect that it probably has to do with a network port that isn't exposed to the real world and/or that is being firewalled by Docker. The OP should please post the Dockerfile and docker-compose.yaml content.

      I can't disagree with that. But in looking at the source to the auth() methods I saw a lot of debug prints that weren't in the OP. It seemed like a quick and easy thing to try.

      In the debug output, it shows communications with the server, and SMTP only uses one socket connection, so I dont think that”s it.

      But, having it work outside docker but not inside seems to be the biggest hint. Maybe there are perl modules needed for the auth that didn’t get included in the docker image? Could also be missing SSL certificates or something. A quick way to check would be to run it under strace and see if it tries to open a file right before saying it cant authenticate. (but running strace inside docker requires the --priveleged flag)

      Hello, here is my docker-compose.yml:
      version: '2' services: fhem: restart: always ports: - "8083:8083" - "7072:7072" image: fhem/fhem:latest volumes: - /share/CE_CACHEDEV1_DATA/Docker/Fhem/volumes/core/:/opt/ +fhem/ networks: - fhem-network mac_address: AA:F8:5F:95:84:11 environment: FHEM_UID: 1000 FHEM_GID: 1000 TIMEOUT: 10 RESTART: 1 TELNETPORT: 7072 TZ: Europe/Berlin IMAGE_LAYER_DEV: 1 CPAN_PKGS: "Frontier::Client MIME::Lite" networks: fhem-network: driver: qnet ipam: driver: qnet options: iface: "bond0"
      I also think it has something to do with Docker, since it works in a normal Debian installation.
Re^2: Net::SMTPS => auth no longer works - Migration from Debian to Docker container
by initB10r (Initiate) on Jan 08, 2020 at 04:34 UTC
    Hello I changed the auth methode in 2 ways, but both fails
    first try:
    $smtp->auth( $user, $pass,'PLAIN') || die "cannot do mail auth";
    result
    perl ./FHEM/sendEmail.pm Net::SMTPS>>> Net::SMTPS(0.09) Net::SMTPS>>> IO::Socket::IP(0.39) Net::SMTPS>>> IO::Socket(1.39) Net::SMTPS>>> IO::Handle(1.39) Net::SMTPS>>> Exporter(5.73) Net::SMTPS>>> Net::SMTP(3.11) Net::SMTPS>>> Net::Cmd(3.11) Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 220 smtp.strato.de ESMTP RZmta (P10 + -) Net::SMTPS=GLOB(0x55ffcc1839b0)>>> EHLO localhost.localdomain Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 250-smtp.strato.de greets 89.245.1. +55 Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 250-ENHANCEDSTATUSCODES Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 250-PIPELINING Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 250-8BITMIME Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 250-DELIVERBY Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 250-SIZE 104857600 Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 250-AUTH PLAIN LOGIN CRAM-MD5 DIGES +T-MD5 Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 250-STARTTLS Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 250-BURL imap Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 250-CHUNKING Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 250 HELP Net::SMTPS=GLOB(0x55ffcc1839b0)>>> STARTTLS Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 220 Ready to start TLS Net::SMTPS=GLOB(0x55ffcc1839b0)>>> EHLO localhost.localdomain Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 250-smtp.strato.de greets 89.245.1. +55 Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 250-ENHANCEDSTATUSCODES Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 250-PIPELINING Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 250-8BITMIME Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 250-DELIVERBY Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 250-SIZE 104857600 Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 250-AUTH PLAIN LOGIN CRAM-MD5 DIGES +T-MD5 Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 250-REQUIRETLS Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 250-BURL imap Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 250-CHUNKING Net::SMTPS=GLOB(0x55ffcc1839b0)<<< 250 HELP Net::SMTPS=GLOB(0x55ffcc1839b0)>>> AUTH-my favorite: PLAIN Net::SMTPS=GLOB(0x55ffcc1839b0)>>> AUTH-server offerred: PLAIN LOGIN C +RAM-MD5 DIGEST-MD5 Net::SMTPS=GLOB(0x55ffcc1839b0)>>> AUTH-negotiated: PLAIN cannot do mail auth at ./FHEM/sendEmail.pm line 18.
    2nd try:
    $smtp->auth( $user, $pass,'LOGIN') || die "cannot do mail auth";
    result
    perl ./FHEM/sendEmail.pm Net::SMTPS>>> Net::SMTPS(0.09) Net::SMTPS>>> IO::Socket::IP(0.39) Net::SMTPS>>> IO::Socket(1.39) Net::SMTPS>>> IO::Handle(1.39) Net::SMTPS>>> Exporter(5.73) Net::SMTPS>>> Net::SMTP(3.11) Net::SMTPS>>> Net::Cmd(3.11) Net::SMTPS=GLOB(0x56154bf1cf60)<<< 220 smtp.strato.de ESMTP RZmta (P8 +-) Net::SMTPS=GLOB(0x56154bf1cf60)>>> EHLO localhost.localdomain Net::SMTPS=GLOB(0x56154bf1cf60)<<< 250-smtp.strato.de greets 89.245.1. +55 Net::SMTPS=GLOB(0x56154bf1cf60)<<< 250-ENHANCEDSTATUSCODES Net::SMTPS=GLOB(0x56154bf1cf60)<<< 250-PIPELINING Net::SMTPS=GLOB(0x56154bf1cf60)<<< 250-8BITMIME Net::SMTPS=GLOB(0x56154bf1cf60)<<< 250-DELIVERBY Net::SMTPS=GLOB(0x56154bf1cf60)<<< 250-SIZE 104857600 Net::SMTPS=GLOB(0x56154bf1cf60)<<< 250-AUTH PLAIN LOGIN CRAM-MD5 DIGES +T-MD5 Net::SMTPS=GLOB(0x56154bf1cf60)<<< 250-STARTTLS Net::SMTPS=GLOB(0x56154bf1cf60)<<< 250-BURL imap Net::SMTPS=GLOB(0x56154bf1cf60)<<< 250-CHUNKING Net::SMTPS=GLOB(0x56154bf1cf60)<<< 250 HELP Net::SMTPS=GLOB(0x56154bf1cf60)>>> STARTTLS Net::SMTPS=GLOB(0x56154bf1cf60)<<< 220 Ready to start TLS Net::SMTPS=GLOB(0x56154bf1cf60)>>> EHLO localhost.localdomain Net::SMTPS=GLOB(0x56154bf1cf60)<<< 250-smtp.strato.de greets 89.245.1. +55 Net::SMTPS=GLOB(0x56154bf1cf60)<<< 250-ENHANCEDSTATUSCODES Net::SMTPS=GLOB(0x56154bf1cf60)<<< 250-PIPELINING Net::SMTPS=GLOB(0x56154bf1cf60)<<< 250-8BITMIME Net::SMTPS=GLOB(0x56154bf1cf60)<<< 250-DELIVERBY Net::SMTPS=GLOB(0x56154bf1cf60)<<< 250-SIZE 104857600 Net::SMTPS=GLOB(0x56154bf1cf60)<<< 250-AUTH PLAIN LOGIN CRAM-MD5 DIGES +T-MD5 Net::SMTPS=GLOB(0x56154bf1cf60)<<< 250-REQUIRETLS Net::SMTPS=GLOB(0x56154bf1cf60)<<< 250-BURL imap Net::SMTPS=GLOB(0x56154bf1cf60)<<< 250-CHUNKING Net::SMTPS=GLOB(0x56154bf1cf60)<<< 250 HELP Net::SMTPS=GLOB(0x56154bf1cf60)>>> AUTH-my favorite: LOGIN Net::SMTPS=GLOB(0x56154bf1cf60)>>> AUTH-server offerred: PLAIN LOGIN C +RAM-MD5 DIGEST-MD5 Net::SMTPS=GLOB(0x56154bf1cf60)>>> AUTH-negotiated: LOGIN cannot do mail auth at ./FHEM/sendEmail.pm line 18.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11111071]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2021-01-27 11:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?