cygport announce fails unable to find mailserver

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

cygport announce fails unable to find mailserver

Brian Inglis
Hi folks,

Do any/some/many of you use cygport ...cygport announce to generate your update
announcements, and does it work successfully?

It has never worked for me, but Thunderbird, git send-email, mailx, mail, email,
s-nail, my own scripts, with similar configs, and telnet, work okay, as shown at
the bottom of this email and the log.

Any ideas why cygport ... announce using perl libnet/Net::SMTP would have
problems, how to diagnose or debug, and fix?

Relevant code follows +/_pkg_announce /usr/share/cygport/lib/pkg_upload.cygpart

Attached log has irrelevant output and escape sequences removed, commands added,
and remainder sanitized; summary is:

$ cygport --debug tzcode.cygport announce |& tee cygport-announce-no-mailserver.log
...
>>> Preparing announcement tzcode-2020d-1.x86_64
+ __pkg_announce
...
+ /usr/bin/vim /tmp/cygwin-announce-tzcode-2020d-1.oKxmkN
Vim: Warning: Output is not to a terminal
ZZ
+ perl /dev/fd/62
++ cat
Sending announcement of tzcode-2020d-1 via smtp
No mailserver at smtp at /dev/fd/62 line 16.
+ error 'Sending announcement failed, mbox is
/tmp/cygwin-announce-tzcode-2020d-1.oKxmkN'
+ case $? in
+ local errorcode=9
+ echo -e '*** ERROR: Sending announcement failed, mbox is
/tmp/cygwin-announce-tzcode-2020d-1.oKxmkN'
*** ERROR: Sending announcement failed, mbox is
/tmp/cygwin-announce-tzcode-2020d-1.oKxmkN
+ exit 9
$ telnet smtp smtp |& tee -a cygport-announce-no-mailserver.log
Trying ...
Connected to smtp.
Escape character is '^]'.
220 mo22.dcs.int.inet ...ca ESMTP server ready
250-mo22.dcs.int.inet hello [...], pleased to meet you
250-HELP
250-SIZE 29360128
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-STARTTLS
250 OK
221 2.0.0 mo22.dcs.int.inet ...ca closing connection
Connection closed by foreign host.

--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

cygport-announce-no-mailserver.log (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: cygport announce fails unable to find mailserver

cygwin-apps mailing list
On 10/24/2020 4:53 PM, Brian Inglis wrote:
> Hi folks,
>
> Do any/some/many of you use cygport ...cygport announce to generate your update
> announcements, and does it work successfully?

I use it.  You have to set several SMTP_* variables in your ~/.cygport.conf.  If
you don't already have that file, copy /etc/cygport.conf to ~/.cygport.conf and
edit it.

Ken
Reply | Threaded
Open this post in threaded view
|

Re: cygport announce fails unable to find mailserver

Brian Inglis
On 2020-10-24 15:42, Ken Brown via Cygwin-apps wrote:
> On 10/24/2020 4:53 PM, Brian Inglis wrote:
>> Hi folks,
>>
>> Do any/some/many of you use cygport ...cygport announce to generate your update
>> announcements, and does it work successfully?
>
> I use it.  You have to set several SMTP_* variables in your ~/.cygport.conf.  If
> you don't already have that file, copy /etc/cygport.conf to ~/.cygport.conf and
> edit it.

Thanks, already set up with SMTP_SERVER=smtp which is all I need from my home
ISP connection for all SMTP clients (POP3, web, mobile needs user and password).
Nothing else is required (yet)!

--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]
Reply | Threaded
Open this post in threaded view
|

Re: cygport announce fails unable to find mailserver

Brian Inglis
On 2020-10-24 16:21, Brian Inglis wrote:

> On 2020-10-24 15:42, Ken Brown via Cygwin-apps wrote:
>> On 10/24/2020 4:53 PM, Brian Inglis wrote:
>>> Do any/some/many of you use cygport ...cygport announce to generate your update
>>> announcements, and does it work successfully?
>>
>> I use it.  You have to set several SMTP_* variables in your ~/.cygport.conf.  If
>> you don't already have that file, copy /etc/cygport.conf to ~/.cygport.conf and
>> edit it.
>
> Thanks, already set up with SMTP_SERVER=smtp which is all I need from my home
> ISP connection for all SMTP clients (POP3, web, mobile needs user and password).
> Nothing else is required (yet)!
Hacked out the perl code into a file and got it running and failing.
Added Net:SMTP() Debug parameter and set it.
Problem is ISP SMTP MX will not accept localhost.localdomain as EHLO/HELO
maildomain!

So added parameter with other value and it worked.

See Failure and Success logs below.

With a bit more work, we can get the default local host network domain name (ISP
or org), and update that from the sender email address if available.

+use Net::Domain qw(hostdomain);
+my $hello = hostdomain();
+$hello = $1 if ($entity->head->get('From') =~ m/<?[^@>]+@([^>]+)>?/);
+my $smtp = new Net::SMTP($smtp_server,
                          Port => 25,
+  Hello => $hello,
#  Debug => 1,
                          SSL => $smtp_encryption eq 'ssl')
+ or die "No mailserver at ".$smtp_server.":".$@;

A functional patch is attached, but someone who really knows what they're doing
with SMTP, Perl, embedding the latter in shell scripts, and getting them to work
needs to apply something like this, make it a conditional setting based on
another cygport config flag e.g. SMTP_HELLO=1, or some enumeration.

It should also be possible to handle the STARTTLS response and switch the
connection to be encrypted, but that is way over my head in Perl.

Failure log:

$ src/cygwin/cygport-pkg-announce-email.pl
Sending announcement of tzcode 2020d via smtp
Net::SMTP>>> Net::SMTP(3.11)
Net::SMTP>>>   Net::Cmd(3.11)
Net::SMTP>>>     Exporter(5.73)
Net::SMTP>>>   IO::Socket::IP(0.39)
Net::SMTP>>>     IO::Socket(1.40)
Net::SMTP>>>       IO::Handle(1.40)
Net::SMTP=GLOB(0x80112a000)<<< 220 mo22.dcs.int.inet ...ca ESMTP server ready
Net::SMTP=GLOB(0x80112a000)>>> EHLO localhost.localdomain
Net::SMTP=GLOB(0x80112a000)<<< 501 EHLO invalid ehlo (localhost.localdomain)
Net::SMTP=GLOB(0x80112a000)>>> HELO localhost.localdomain
Net::SMTP: Net::Cmd::getline(): unexpected EOF on command channel:  at
src/cygwin/cygport-pkg-announce-email.pl line 27.
No mailserver at smtp:Net::SMTP: 421 [Net::SMTP] Connection closed at
src/cygwin/cygport-pkg-announce-email.pl line 27.

[SMTP 421 means Try again later]

Success log:

$ src/cygwin/cygport-pkg-announce-email.pl
Sending announcement of tzcode 2020d via smtp
Net::SMTP>>> Net::SMTP(3.11)
Net::SMTP>>>   Net::Cmd(3.11)
Net::SMTP>>>     Exporter(5.73)
Net::SMTP>>>   IO::Socket::IP(0.39)
Net::SMTP>>>     IO::Socket(1.40)
Net::SMTP>>>       IO::Handle(1.40)
Net::SMTP=GLOB(0x80110cf10)<<< 220 mo24.dcs.int.inet ...ca ESMTP server ready
Net::SMTP=GLOB(0x80110cf10)>>> EHLO SystematicSW.ab.ca
Net::SMTP=GLOB(0x80110cf10)<<< 250-mo24.dcs.int.inet hello [...], pleased to
meet you
Net::SMTP=GLOB(0x80110cf10)<<< 250-HELP
Net::SMTP=GLOB(0x80110cf10)<<< 250-SIZE 29360128
Net::SMTP=GLOB(0x80110cf10)<<< 250-ENHANCEDSTATUSCODES
Net::SMTP=GLOB(0x80110cf10)<<< 250-8BITMIME
Net::SMTP=GLOB(0x80110cf10)<<< 250-STARTTLS
Net::SMTP=GLOB(0x80110cf10)<<< 250 OK
Net::SMTP=GLOB(0x80110cf10)>>> MAIL FROM:<[hidden email]>
Net::SMTP=GLOB(0x80110cf10)<<< 250 2.1.0 <[hidden email]> sender ok
Net::SMTP=GLOB(0x80110cf10)>>> RCPT TO:<[hidden email]>
Net::SMTP=GLOB(0x80110cf10)<<< 250 2.1.5 <[hidden email]> recipient ok
Net::SMTP=GLOB(0x80110cf10)>>> DATA
...
Net::SMTP=GLOB(0x80110cf10)>>> .
NNet::SMTP=GLOB(0x80110cf10)<<< 250 2.0.0 WSGzktx91RAWfWSH1kHFQt mail accepted
for delivery
Net::SMTP=GLOB(0x80110cf10)>>> QUIT
Net::SMTP=GLOB(0x80110cf10)<<< 221 2.0.0 mo24.dcs.int.inet ...ca closing connection
Announcement sent

--
--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

cygport-lib-pkg_upload.patch (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: cygport announce fails unable to find mailserver

Jon TURNEY
On 25/10/2020 00:19, Brian Inglis wrote:

> On 2020-10-24 16:21, Brian Inglis wrote:
>> On 2020-10-24 15:42, Ken Brown via Cygwin-apps wrote:
>>> On 10/24/2020 4:53 PM, Brian Inglis wrote:
>>>> Do any/some/many of you use cygport ...cygport announce to generate your update
>>>> announcements, and does it work successfully?
>>>
>>> I use it.  You have to set several SMTP_* variables in your ~/.cygport.conf.  If
>>> you don't already have that file, copy /etc/cygport.conf to ~/.cygport.conf and
>>> edit it.
>>
>> Thanks, already set up with SMTP_SERVER=smtp which is all I need from my home
>> ISP connection for all SMTP clients (POP3, web, mobile needs user and password).
>> Nothing else is required (yet)!
>
> Hacked out the perl code into a file and got it running and failing.
> Added Net:SMTP() Debug parameter and set it.
> Problem is ISP SMTP MX will not accept localhost.localdomain as EHLO/HELO
> maildomain!

Whatever you are doing it spamming cygwin-announce with messages which
are (fortunately) being held due to 'Message has implicit destination'.

I rejected all the held mails, but please stop.
Reply | Threaded
Open this post in threaded view
|

Re: cygport announce fails unable to find mailserver

Brian Inglis
On 2020-10-24 17:50, Jon Turney wrote:

> On 25/10/2020 00:19, Brian Inglis wrote:
>> On 2020-10-24 16:21, Brian Inglis wrote:
>>> On 2020-10-24 15:42, Ken Brown via Cygwin-apps wrote:
>>>> On 10/24/2020 4:53 PM, Brian Inglis wrote:
>>>>> Do any/some/many of you use cygport ...cygport announce to generate your
>>>>> update
>>>>> announcements, and does it work successfully?
>>>>
>>>> I use it.  You have to set several SMTP_* variables in your
>>>> ~/.cygport.conf.  If
>>>> you don't already have that file, copy /etc/cygport.conf to ~/.cygport.conf and
>>>> edit it.
>>>
>>> Thanks, already set up with SMTP_SERVER=smtp which is all I need from my home
>>> ISP connection for all SMTP clients (POP3, web, mobile needs user and password).
>>> Nothing else is required (yet)!
>>
>> Hacked out the perl code into a file and got it running and failing.
>> Added Net:SMTP() Debug parameter and set it.
>> Problem is ISP SMTP MX will not accept localhost.localdomain as EHLO/HELO
>> maildomain!
>
> Whatever you are doing it spamming cygwin-announce with messages which are
> (fortunately) being held due to 'Message has implicit destination'.
>
> I rejected all the held mails, but please stop.

Sorry about that; trying to diagnose, debug, and fix failures and content issues
with cygport ... announce; hacking without any real background knowledge of
SMTP, Perl, or cygport; still trying to track down issues with generated message
content: sorry about those that made it thru; I'll do my best to ensure future
tests are directed elsewhere.

--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]
Reply | Threaded
Open this post in threaded view
|

Re: cygport announce fails unable to find mailserver

Brian Inglis
On 2020-10-24 22:37, Brian Inglis wrote:

> On 2020-10-24 17:50, Jon Turney wrote:
>> On 25/10/2020 00:19, Brian Inglis wrote:
>>> On 2020-10-24 16:21, Brian Inglis wrote:
>>>> On 2020-10-24 15:42, Ken Brown via Cygwin-apps wrote:
>>>>> On 10/24/2020 4:53 PM, Brian Inglis wrote:
>>>>>> Do any/some/many of you use cygport ...cygport announce to generate your
>>>>>> update
>>>>>> announcements, and does it work successfully?
>>>>>
>>>>> I use it.  You have to set several SMTP_* variables in your
>>>>> ~/.cygport.conf.  If
>>>>> you don't already have that file, copy /etc/cygport.conf to ~/.cygport.conf and
>>>>> edit it.
>>>>
>>>> Thanks, already set up with SMTP_SERVER=smtp which is all I need from my home
>>>> ISP connection for all SMTP clients (POP3, web, mobile needs user and password).
>>>> Nothing else is required (yet)!
>>>
>>> Hacked out the perl code into a file and got it running and failing.
>>> Added Net:SMTP() Debug parameter and set it.
>>> Problem is ISP SMTP MX will not accept localhost.localdomain as EHLO/HELO
>>> maildomain!
>>
>> Whatever you are doing it spamming cygwin-announce with messages which are
>> (fortunately) being held due to 'Message has implicit destination'.
>>
>> I rejected all the held mails, but please stop.
>
> Sorry about that; trying to diagnose, debug, and fix failures and content issues
> with cygport ... announce; hacking without any real background knowledge of
> SMTP, Perl, or cygport; still trying to track down issues with generated message
> content: sorry about those that made it thru; I'll do my best to ensure future
> tests are directed elsewhere.
After hours of testing, nailed down cygport ... announce SMTP issues.

ISP requires non-default Net::SMTP Hello parameter - localhost.localdomain is
rejected - and does not allow or recognize first initial header "From " line!

So we need to drop the first initial header "From " line, and pass the Hello
parameter with a non-default mail domain value.
Suitable mail domain values available are provided by the Net::Domain
hostdomain, hostfqdn, domainname functions, or the From address domain:
the attached patch uses the first and overrides with the last if available.

--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]


cygport-lib-pkg_upload.patch (4K) Download Attachment