deliver broken because dovecot.conf uses !include_try

Bug #671065 reported by Gioele Barabucci
38
This bug affects 5 people
Affects Status Importance Assigned to Milestone
dovecot (Ubuntu)
Fix Released
Medium
James Page
Quantal
Won't Fix
Medium
Ante Karamatić
Raring
Fix Released
Medium
James Page

Bug Description

The `deliver` configuration (LDA) is stored in '/etc/dovecot/conf.d/01-mail-stack-delivery.conf'. This is fundamentally broken because dovecot's `deliver` ignores files included with !include_try and !include. This problem shows up with this error:

    Fatal: postmaster_address setting not given

This is part of the content of '/etc/dovecot/conf.d/01-mail-stack-delivery.conf':

    protocol lda {
            postmaster_address = postmaster
            mail_plugins = sieve
            quota_full_tempfail = yes
            deliver_log_format = msgid=%m: %$
           rejection_reason = Your message to <%t> was automatically rejected:%n%r
    }

Mathias Gug (mathiaz)
Changed in dovecot (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Ante Karamatić (ivoks) wrote :

File /etc/dovecot/conf.d/01-mail-stack-delivery.conf comes from special package that sets both postfix and dovecot. Knowing that deliver doesn't support include, postifx in Lucid is explicitly set as:

mailbox_command = /usr/lib/dovecot/deliver -c /etc/dovecot/conf.d/01-dovecot-postfix.conf -n -m "${EXTENSION}"

In Natty, that's:

mailbox_command = /usr/lib/dovecot/deliver -c /etc/dovecot/conf.d/01-mail-stack-delivery.conf -n -m "${EXTENSION}"

So, I'm not sure how would 'include' or 'include_try' create any problem?

Can you check your mailbox_command in /etc/postfix/main.cf?

Changed in dovecot (Ubuntu):
assignee: nobody → Ante Karamatić (ivoks)
status: New → Incomplete
Revision history for this message
Grondr (grondr) wrote :

This is problematic because it lays a trap. Just because the special package
sets up mailbox_command to do this doesn't mean the bug won't screw someone
who thinks that deliver will obey inclusions. It's -especially- bad if someone tries
to use virtual domains and hence removes that mailbox_command and thinks
that their virtual-domain solution will work if they don't use -c in the line in Postfix's
master.cf. It also screws anyone who happens to install Postfix, and then much
later installs just the Dovecot package instead of the postfix-dovecot superpackage.
Basically, it's totally fragile---if they don't install Dovecot in exactly the way you
anticipate, or if they make what looks like a change that -should- work, it doesn't.

I very nearly fell into this trap just now by rearranging some files; I only noticed
the bug because I was trying to find a definitive syntax definition for how include_try
was supposed to work and noticed this bug in Google. That one obscure comment
in dovecot.conf is easy to overlook (I did, even though I've been making changes in
that file for a week or two now), -and-, if you start from Postfix's main.cf entry, there
is -no- comment warning you that you can't simply eliminate what looks like a totally
wasteful "-c /etc..." and rely on the normal conf-file-parsing logic to include what you
thought was the configuration for deliver. It looks like someone put it in there in a
misguided attempt at efficiency ("hey, why have deliver have to parse the whole file
when it can parse just this piece?") and not because it's papering over a bug.

So even though I didn't get zapped by this, it was only by chance, and I'd have spent
a long time trying to figure out what happened if I had.

There are fundamentally two bugs here:
o The upstream deliver bug (doesn't notice include{_try}) needs to be fixed.
o In -every single place- that Postfix's configuration file is explicitly rewritten to point
   to the included file directly, a very clear comment should be left explaining why it
   does that, probably pointing to this bug URL, so people know why and when it might
   have been fixed.

Even that latter part doesn't help people who install Dovecot as its own package,
unless there's some post-inst that tells them about it; I haven't checked. I don't
have a good solution for that, except to make the "deliver doesn't read includes"
comment in dovecot.conf -much- more noticeable, such as by putting it in uppercase
and at both the beginning and the end of that file. (I was going to also say, "and in
deliver's manpage", but it doesn't appear to have one.)

Revision history for this message
Jeff Waugh (jdub) wrote :

This bug has been described well, and I have confirmed it on lucid. It's a serious bug for anyone intending to use the dovecot local delivery agent (which is very useful in virtual mail configurations, and provides an easy way to use sieve filtering).

Changed in dovecot (Ubuntu):
status: Incomplete → Confirmed
Ante Karamatić (ivoks)
Changed in dovecot (Ubuntu):
status: Confirmed → In Progress
Revision history for this message
Ante Karamatić (ivoks) wrote :
Revision history for this message
Ante Karamatić (ivoks) wrote :

To make it clear. When one installs postifx and dovecot, mailbox_command is not set. It's up to the administrator to set it to whatever it wants. This bug (actually, it's a feature request) impacts only those that install mail-stack-delivery and then go to customize it, it does not impact everybody that installs dovecot.

Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Hi Ante. This patch doesn't apply cleanly to the latest package:

clint@clint-MacBookPro:~/pkg/dovecot/bzr/dovecot$ patch -p1 < lp-671065.patch
patching file debian/changelog
patching file debian/mail-stack-delivery.postinst
Hunk #1 FAILED at 45.
Hunk #2 FAILED at 58.
2 out of 2 hunks FAILED -- saving rejects to file debian/mail-stack-delivery.postinst.rej

Can you look into why that is?

Revision history for this message
Bryce Harrington (bryce) wrote :

Unsubscribing sponsors for now; re-subscribe when clint's questions are addressed.

Revision history for this message
James Page (james-page) wrote :

To late for quantal now; bumping to R-Series

Changed in dovecot (Ubuntu Quantal):
status: In Progress → Won't Fix
James Page (james-page)
Changed in dovecot (Ubuntu Raring):
assignee: nobody → James Page (james-page)
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (6.4 KiB)

This bug was fixed in the package dovecot - 1:2.1.7-7ubuntu1

---------------
dovecot (1:2.1.7-7ubuntu1) raring; urgency=low

  [ James Page ]
  * Merge from Debian unstable (LP: #1117613, #1075456), remaining changes:
    + Add mail-stack-delivery package:
      - Update d/rules
      - d/control: convert existing dovecot-postfix package to a dummy
        package and add new mail-stack-delivery package.
      - Update maintainer scripts.
      - Rename d/dovecot-postfix.* to debian/mail-stack-delivery.*
      - d/mail-stack-delivery.preinst: Move previously installed backups and
        config files to a new package namespace.
      - d/mail-stack-delivery.prerm: Added to handle downgrades.
    + Use Snakeoil SSL certificates by default:
      - d/control: Depend on ssl-cert.
      - d/dovecot-core.postinst: Relax grep for SSL_* a bit.
    + Add autopkgtest to debian/tests/*.
    + Add ufw integration:
      - d/dovecot-core.ufw.profile: new ufw profile.
      - d/rules: install profile in dovecot-core.
      - d/control: dovecot-core - suggest ufw.
    + d/dovecot-core.dirs: Added usr/share/doc/dovecot-core
    + Add apport hook:
      - d/rules, d/source_dovecot.py
    + Add upstart job:
      - d/rules, d/dovecot-core.dovecot.upstart, d/control,
        d/dovecot-core.dirs, dovecot-imapd.{postrm, postinst, prerm},
        d/dovecot-pop3d.{postinst, postrm, prerm}.
        d/mail-stack-deliver.postinst: Convert init script to upstart.
    + d/control: Added Pre-Depends: dpkg (>= 1.15.6) to dovecot-dbg to support
      xz compression in Ubuntu.
    + d/control: Demote dovecot-common Recommends: to Suggests: to prevent
      install of extra packages on upgrade.
    + d/patches/dovecot-drac.patch: Updated with version for dovecot >= 2.0.0.
  * Dropped changes, included in Debian:
    + d/{control,rules}: enable PIE hardening.
    + d/control: Drop B-D on systemd.
  * d/p/mail-stack-delivery.postinst: Updated to ensure that configured SSL
    cert and key locations are used when configuring postfix, sorted out
    formatting.
  * d/p/dovecot-core.postinst: Create compat links to old style, existing
    SSL cert and key if found.
  * d/rules: Don't pass hardening flags for DRAC plugin.
  * d/dovecot-{pop3d,imapd}.prerm: Re-sync with Debian.
  * d/dovecot-core.lintian-overrides: Drop override for DRAC plugin as not
    required in Ubuntu.
  * d/01-mail-stack-delivery: Renamed 99-mail-stack-delivery to ensure that
    the mail-stack-delivery configuration overrides configuration options
    set elsewhere, updated with new cert/key file locations.

  [ Ante Karamatic ]
  * Change configuration file for LDA on new installs and upgrades
    (LP: #671065).

dovecot (1:2.1.7-7) unstable; urgency=high

  * If you are upgrading from stable or earlier versions of this package
    from testing/unstable please carefully read
    /usr/share/doc/dovecot-core/README.Debian.gz for important information
    about changes.
  * [0d74b31] Move Breaks/Replaces mailavenger from dovecot-common to
    dovecot-core (Closes: #694376)
  * [a8030a1] Revamped dovecot-cores README.Debian by adding any info I could
    think of in order to ease upgrade problems. (Closes: #...

Read more...

Changed in dovecot (Ubuntu Raring):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.