Merge lp:~hloeung/langpack-o-matic/ssmtp-misconfigured into lp:langpack-o-matic

Proposed by Haw Loeung
Status: Rejected
Rejected by: Haw Loeung
Proposed branch: lp:~hloeung/langpack-o-matic/ssmtp-misconfigured
Merge into: lp:langpack-o-matic
Diff against target: 43 lines (+35/-0) (has conflicts)
1 file modified
charms/xenial/langpack-o-matic/hooks/install.OTHER (+35/-0)
Conflict adding files to charms.  Created directory.
Conflict because charms is not versioned, but has versioned children.  Versioned directory.
Conflict adding files to charms/xenial.  Created directory.
Conflict because charms/xenial is not versioned, but has versioned children.  Versioned directory.
Conflict adding files to charms/xenial/langpack-o-matic.  Created directory.
Conflict because charms/xenial/langpack-o-matic is not versioned, but has versioned children.  Versioned directory.
Conflict adding files to charms/xenial/langpack-o-matic/hooks.  Created directory.
Conflict because charms/xenial/langpack-o-matic/hooks is not versioned, but has versioned children.  Versioned directory.
Contents conflict in charms/xenial/langpack-o-matic/hooks/install
To merge this branch: bzr merge lp:~hloeung/langpack-o-matic/ssmtp-misconfigured
Reviewer Review Type Date Requested Status
Haw Loeung Disapprove
Sebastien Bacher Needs Information
Review via email: mp+408000@code.launchpad.net

Commit message

Reconfigure ssmtp configuration

It's wrong, it misconfigures ssmtp causing undeliverable mail and
adding to mail logs noise.

This fixes that to send all root emails to <email address hidden> rather than root@localhost. We also sent a proper domain and enforce that so we know these emails are from or related to Ubuntu's langpack-o-matic.

Description of the change

Luckily, I have access to inspect the unit and there's no mail successfully delivered:

ubuntu@juju-prod-ues-langpack-machine-1:~$ zgrep -v 'Recipient address rejected: User unknown in local recipient table' /var/log/mail.log /var/log/mail.log.1 /var/log/mail.log.2.gz
/var/log/mail.log:Sep 2 01:15:03 juju-prod-ues-langpack-machine-1 sSMTP[32719]: Sent mail for root@localhost (221 2.0.0 Bye) uid=0 username=root outbytes=667
/var/log/mail.log.1:Aug 25 08:17:08 juju-prod-ues-langpack-machine-1 sSMTP[20904]: Unable to connect to "mx.canonical.com" port 25.
/var/log/mail.log.1:Aug 25 08:17:08 juju-prod-ues-langpack-machine-1 sSMTP[20904]: Cannot open mx.canonical.com:25
ubuntu@juju-prod-ues-langpack-machine-1:~$

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks for the report

charms/xenial/langpack-o-matic/hooks/start

sets <email address hidden> in the crontab, shouldn't it lead to a valid email being used?

review: Needs Information
Revision history for this message
Haw Loeung (hloeung) wrote :

On Wed, Oct 20, 2021 at 03:37:43PM -0000, Sebastien Bacher wrote:
> charms/xenial/langpack-o-matic/hooks/start
>
> sets <email address hidden> in the crontab, shouldn't it lead to a valid email being used?

Nope, that's setting the recipient address. You can check your
mailbox, you're not receving these emails. They're bouncing and coming
to us.

An example of one that came just recently:

| https://pastebin.canonical.com/p/8hJ3FtdT6h/

Revision history for this message
Haw Loeung (hloeung) wrote :

I'll mark this as WIP, will have a play around with getting a working ssmtp config going.

Revision history for this message
Sebastien Bacher (seb128) wrote :

thanks!

Revision history for this message
Haw Loeung (hloeung) wrote :

Re-review please?

Revision history for this message
Haw Loeung (hloeung) wrote :
review: Disapprove

Unmerged revisions

597. By Haw Loeung

Don't allow overriding from domain

596. By Haw Loeung

Reconfigure ssmtp

All root destined emails to be sent to <email address hidden>. We
also try use langpack-o-matic.ubuntu.com as the sender's domain where
we can.

595. By Haw Loeung

Remove ssmtp configuration

It's wrong, it misconfigures ssmtp causing undeliverable mail and
adding to mail logs noise:

| Sep 2 01:15:02 seviper postfix/smtpd[6486]: NOQUEUE: reject_warning: RCPT from ...: 504 5.5.2 <localhost>: Helo command rejected: need fully-qualified hostname; from=<root@localhost> to=<ubuntu@localhost> proto=SMTP helo=<localhost>
| Sep 2 01:15:02 seviper postfix/smtpd[6486]: NOQUEUE: reject_warning: RCPT from ...: 504 5.5.2 <ubuntu@localhost>: Recipient address rejected: need fully-qualified address; from=<root@localhost> to=<ubuntu@localhost> proto=SMTP helo=<localhost>
| Sep 2 01:15:02 seviper postfix/smtpd[6486]: NOQUEUE: reject_warning: RCPT from ...: 504 5.5.2 <root@localhost>: Sender address rejected: need fully-qualified address; from=<root@localhost> to=<ubuntu@localhost> proto=SMTP helo=<localhost>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'charms'
=== added directory 'charms/xenial'
=== added directory 'charms/xenial/langpack-o-matic'
=== added directory 'charms/xenial/langpack-o-matic/hooks'
=== added file 'charms/xenial/langpack-o-matic/hooks/install.OTHER'
--- charms/xenial/langpack-o-matic/hooks/install.OTHER 1970-01-01 00:00:00 +0000
+++ charms/xenial/langpack-o-matic/hooks/install.OTHER 2022-10-29 21:28:16 +0000
@@ -0,0 +1,35 @@
1#!/bin/sh
2set -e
3
4juju-log "Make host name resolvable (https://launchpad.net/bugs/1475260)"
5H=$(hostname)
6getent hosts $H || echo "127.0.1.1 $H" >> /etc/hosts
7
8juju-log 'Invoking charm-pre-install hooks'
9[ -d exec.d ] && ( for f in exec.d/*/charm-pre-install; do [ -x $f ] && /bin/sh -c "$f"; done )
10
11juju-log "Installing dependencies"
12apt-get install -y build-essential libgettextpo-dev debhelper fakeroot bzr ssmtp python-launchpadlib python-apt dput
13apt-get install -y --no-install-recommends devscripts lintian
14
15juju-log "Checking out code"
16cat <<EOF | su - ubuntu
17set -e
18if [ ! -d langpack-o-matic ]; then
19 bzr branch lp:langpack-o-matic
20else
21 (cd langpack-o-matic; bzr pull)
22fi
23make -C langpack-o-matic/bin
24EOF
25
26# language-packs@ubuntu.com from charms/xenial/langpack-o-matic/hooks/start
27juju-log "Configuring ssmtp"
28mx="$(host -t MX ubuntu.com | sed 's/^.* //; s/\.$//')"
29cat <<EOF > /etc/ssmtp/ssmtp.conf
30root=language-packs@ubuntu.com
31mailhub=$mx
32hostname=langpack-o-matic.ubuntu.com
33rewriteDomain=langpack-o-matic.ubuntu.com
34FromLineOverride=no
35EOF

Subscribers

People subscribed via source and target branches

to all changes: