You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by "João M. S. Silva" <jo...@gmail.com> on 2016/12/09 02:47:26 UTC

post-commit hook

[I'm not subscribed to the list, please CC me.]

Hi,

I have been using subversion-tools to send post-commit e-mails. I use 
the mailer.py and mailer.conf.example to create my own configuration 
file. This has worked for years.

However, recently I get this error:

   smtplib.SMTPException: SMTP AUTH extension not supported by server

Searching for a solution, it seems we have to run "starttls" before 
"ehlo", but I don't think I can change that, the way I'm running it.

I'm simply calling mailer.py with the correct configuration file. I 
checked if my configuration file was up to date (comparing with the one 
from the subversion-tools package) and it is.

So, the problem should be inside subversion-tools, right?

I'm sending the post-commit e-mail through Gmail, so maybe some recent 
change in Gmail's server could also be the culprit?

Thanks.

-- 
Jo�o M. S. Silva

Re: post-commit hook

Posted by Greg Stein <gs...@gmail.com>.
I found the patch and moderated it through. Thanks for the patch!!

On Tue, Dec 27, 2016 at 6:09 PM, João M. S. Silva <
joao.m.santos.silva@gmail.com> wrote:

> On 12/26/2016 11:22 AM, Daniel Shahaf wrote:
>
>> The instructions say to send a patch to dev@subversion.apache.org, which
>> you say you did.  Under the hood, when a person (who isn't subscribed)
>> emails the list for the first time, that mail would not appear in the
>> archives until it's manually approved by a human moderator.  Your mail
>> hasn't yet appeared in the archives.
>>
>
> I've had problems in the past to post to a mailing list from Gmail. I had
> to post through another e-mail account.
>
> Should I use another account? Or did the e-mail reach the dev-owner
> mailbox?
>
> Thanks.
>
> João M. S. Silva
>

Re: post-commit hook

Posted by "João M. S. Silva" <jo...@gmail.com>.
On 12/26/2016 11:22 AM, Daniel Shahaf wrote:
> The instructions say to send a patch to dev@subversion.apache.org, which
> you say you did.  Under the hood, when a person (who isn't subscribed)
> emails the list for the first time, that mail would not appear in the
> archives until it's manually approved by a human moderator.  Your mail
> hasn't yet appeared in the archives.

I've had problems in the past to post to a mailing list from Gmail. I 
had to post through another e-mail account.

Should I use another account? Or did the e-mail reach the dev-owner mailbox?

Thanks.

Jo�o M. S. Silva

Re: post-commit hook

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Jo�o M. S. Silva wrote on Mon, Dec 26, 2016 at 10:02:24 +0000:
> On 12/24/2016 12:00 PM, Daniel Shahaf wrote:
> >Jo�o M. S. Silva wrote on Thu, Dec 22, 2016 at 23:54:59 +0000:
> >>Thanks. I have submitted a patch to the developers mailing list. (It's my
> >>first time.)
> >
> >\u2026 it doesn't seem to have been moderated through yet?
> 
> What do you mean, did I miss some step from the instructions you pointed to?

No.

The instructions say to send a patch to dev@subversion.apache.org, which
you say you did.  Under the hood, when a person (who isn't subscribed)
emails the list for the first time, that mail would not appear in the
archives until it's manually approved by a human moderator.  Your mail
hasn't yet appeared in the archives.

dev-owner@, have you seen Jo�o's patch?

Cheers,

Daniel

Re: post-commit hook

Posted by "João M. S. Silva" <jo...@gmail.com>.
Hi,

What do you mean, did I miss some step from the instructions you pointed to?

Thanks.

Best regards,
Jo�o M. S. Silva

On 12/24/2016 12:00 PM, Daniel Shahaf wrote:
> Jo�o M. S. Silva wrote on Thu, Dec 22, 2016 at 23:54:59 +0000:
>> Thanks. I have submitted a patch to the developers mailing list. (It's my
>> first time.)
>
> \u2026 it doesn't seem to have been moderated through yet?
>

Re: post-commit hook

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Jo�o M. S. Silva wrote on Thu, Dec 22, 2016 at 23:54:59 +0000:
> Thanks. I have submitted a patch to the developers mailing list. (It's my
> first time.)

\u2026 it doesn't seem to have been moderated through yet?

Re: post-commit hook

Posted by "João M. S. Silva" <jo...@gmail.com>.
On 12/21/2016 10:53 AM, Daniel Shahaf wrote:
> If it had become obsolete it wouldn't have been removed from the
> mailer.py code to maintain backwards compatibility.  More likely, that
> parameter never existed in mailer.py as distributed by us.  The comment
> in that blog suggests it's a local patch by "asadomov".

You're right, it comes together with a change (patch you mention) in 
mailer.py which I probably applied but recently lost with some OS 
upgrade/update.

> Make it possible for the configuration file to choose between SMTP_SSL()
> or SMTP().
>
> I won't be looking into that myself, but if you wish to do so, a patch
> would be welcome: https://subversion.apache.org/patches

Thanks. I have submitted a patch to the developers mailing list. (It's 
my first time.)

Best regards,
Jo�o M. S. Silva

Re: post-commit hook

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Jo�o M. S. Silva wrote on Tue, Dec 20, 2016 at 22:37:42 +0000:
> On 12/13/2016 06:09 AM, Daniel Shahaf wrote:
> >"smtp_use_ssl" is not a mailer.py configuration knob.
> 
> You are right. I took that setting from a site:
> 
> # added by jmss
> # http://sadomovalex.blogspot.pt/2009/12/use-gmail-smtp-server-for-post-commit.html
> smtp_use_ssl = true
> 
> Previously, I could only send mails with that setting I took from the above
> blog. It may have become obsolete?

If it had become obsolete it wouldn't have been removed from the
mailer.py code to maintain backwards compatibility.  More likely, that
parameter never existed in mailer.py as distributed by us.  The comment
in that blog suggests it's a local patch by "asadomov".

(By the way, Postfix's main.cf configuration file happens to also have
a parameter named "smtp_use_ssl"; that knob is, however, entirely
unrelated to mailer.conf.)

> So, what is the correct/official way to solve this?

Make it possible for the configuration file to choose between SMTP_SSL()
or SMTP().

I won't be looking into that myself, but if you wish to do so, a patch
would be welcome: https://subversion.apache.org/patches

Cheers,

Daniel

Re: post-commit hook

Posted by "João M. S. Silva" <jo...@gmail.com>.
On 12/13/2016 06:09 AM, Daniel Shahaf wrote:
> Yes, someone left a reply on the channel bot for you to see the next
> time you logged in.

Thanks, I didn't know/remember of such a feature. They said:

<wayita> jmss: on 2016-12-09 danielsh said: "SMTP AUTH" not supported 
*may* mean that STARTTLS is required, but there are other possible 
explanations
<wayita> jmss: on 2016-12-09 danielsh said: Double-check your smtp 
settings with your smtp vendor

> "smtp_use_ssl" is not a mailer.py configuration knob.

You are right. I took that setting from a site:

# added by jmss
# 
http://sadomovalex.blogspot.pt/2009/12/use-gmail-smtp-server-for-post-commit.html
smtp_use_ssl = true

Previously, I could only send mails with that setting I took from the 
above blog. It may have become obsolete?

> Try this patch, after configuring port 465 in the .conf file:
>
> Index: mailer.py
> ===================================================================
> --- mailer.py   (revision 1771121)
> +++ mailer.py   (working copy)
> @@ -291,7 +291,7 @@ class SMTPOutput(MailedOutput):
>      self.write(self.mail_headers(group, params))
>
>    def finish(self):
> -    server = smtplib.SMTP(self.cfg.general.smtp_hostname)
> +    server = smtplib.SMTP_SSL(self.cfg.general.smtp_hostname)
>      if self.cfg.is_set('general.smtp_username'):
>        server.login(self.cfg.general.smtp_username,
>                     self.cfg.general.smtp_password)
>
> It can't be committed as-is, but it might get your setup working.
> (Modulo certificate verification defaults...)
>
> https://docs.python.org/3/library/smtplib#smtplib.SMTP_SSL

mailer.py was a link to 
/usr/share/subversion/hook-scripts/mailer/mailer.py but I made a local 
copy and modified it according to your patch.

I was going to say it didn't work, but I forgot to change the port from 
587 to 465.

After changing the port to 465 it worked.

So, what is the correct/official way to solve this?

Thanks.

Joo M. S. Silva

Re: post-commit hook

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Joo M. S. Silva wrote on Tue, Dec 13, 2016 at 00:14:56 +0000:
> >Didn't you ask this on IRC not long ago?
> 
> Yes, but there was no answer. Now that you mention it, I suppose someone
> answered while my computer was sleeping/suspended and logged out from IRC?

Yes, someone left a reply on the channel bot for you to see the next
time you logged in.

> Here is my mailer.conf:
> 
> $ grep -v ^# mailer.conf|grep -v ^$
> [general]
> smtp_hostname = smtp.gmail.com:587
> smtp_username = joao.m.santos.silva@gmail.com
> smtp_password = ????????????????
> smtp_use_ssl = true

"smtp_use_ssl" is not a mailer.py configuration knob.

Try this patch, after configuring port 465 in the .conf file:

Index: mailer.py
===================================================================
--- mailer.py   (revision 1771121)
+++ mailer.py   (working copy)
@@ -291,7 +291,7 @@ class SMTPOutput(MailedOutput):
     self.write(self.mail_headers(group, params))
 
   def finish(self):
-    server = smtplib.SMTP(self.cfg.general.smtp_hostname)
+    server = smtplib.SMTP_SSL(self.cfg.general.smtp_hostname)
     if self.cfg.is_set('general.smtp_username'):
       server.login(self.cfg.general.smtp_username,
                    self.cfg.general.smtp_password)

It can't be committed as-is, but it might get your setup working.
(Modulo certificate verification defaults...)

https://docs.python.org/3/library/smtplib#smtplib.SMTP_SSL

Re: post-commit hook

Posted by "João M. S. Silva" <jo...@gmail.com>.
> Didn't you ask this on IRC not long ago?

Yes, but there was no answer. Now that you mention it, I suppose someone 
answered while my computer was sleeping/suspended and logged out from IRC?

> Whether the SMTP AUTH extension is offered on a plain connection before
> STARTTLS is not universal; that depends on the SMTP server.
>
> I would advise you to review your provider's SMTP setup documentation.
> If they have made a change, it should be reflected there.  Once you've
> determined what authentication your provider requires, we can see how to
> configure mailer.py for it.

I just checked Gmail's SMTP settings and they seem the same:

smtp.gmail.com
Requires SSL: Yes
Requires TLS: Yes (if available)
Requires Authentication: Yes
Port for SSL: 465
Port for TLS/STARTTLS: 587
Full Name or Display Name 	Your name
Account Name, User name, or Email address 	Your full email address

Here is my mailer.conf:

$ grep -v ^# mailer.conf|grep -v ^$
[general]
smtp_hostname = smtp.gmail.com:587
smtp_username = joao.m.santos.silva@gmail.com
smtp_password = ????????????????
smtp_use_ssl = true
[defaults]
diff = /usr/bin/diff -u -L %(label_from)s -L %(label_to)s %(from)s %(to)s
commit_subject_prefix =
propchange_subject_prefix =
lock_subject_prefix =
unlock_subject_prefix =
from_addr = joao.m.santos.silva@gmail.com
to_addr = joao.m.santos.silva@gmail.com
reply_to =
generate_diffs = add copy modify
show_nonmatching_paths = yes
[maps]

My mailer.py is equal to the one in 
/usr/share/subversion/hook-scripts/mailer/mailer.py.

Thanks.

Jo�o M. S. Silva

Re: post-commit hook

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Jo�o M. S. Silva wrote on Fri, Dec 09, 2016 at 02:47:26 +0000:
> This has worked for years.
> 
> However, recently I get this error:
> 
>   smtplib.SMTPException: SMTP AUTH extension not supported by server
> 
> Searching for a solution, it seems we have to run "starttls" before
> "ehlo", but I don't think I can change that, the way I'm running it.

Didn't you ask this on IRC not long ago?

Whether the SMTP AUTH extension is offered on a plain connection before
STARTTLS is not universal; that depends on the SMTP server.

I would advise you to review your provider's SMTP setup documentation.
If they have made a change, it should be reflected there.  Once you've
determined what authentication your provider requires, we can see how to
configure mailer.py for it.

Cheers,

Daniel