Re: [Hampshire] Seeking Advice on Postfix/Dovecot/MariaDB C…

Top Page

Reply to this message
Author: Hants LUG via Hampshire
Date:  
To: Brad Macpherson via Hampshire
CC: Hants LUG
Subject: Re: [Hampshire] Seeking Advice on Postfix/Dovecot/MariaDB Configuration
Thanks, Brad, this is actually very helpful.

As I just noted to Nick, none of the guides I've tried to follow have
discussed versions - but on reading around I see that the differences
from DC 2.3 to 2.4 are very significant. I also notice a small number of
comments on e.g. Reddit that suggest this was deliberate and designed to
push people towards the company's professional services offerings...

I'm going to clean down my engineering machine and start over with your
recommended approach and see where that gets me...

Thank you for the guidance.

Clive


On 07/05/2026 06:30, Brad Macpherson via Hampshire wrote:
>
> On 05/05/2026 17:01, Hants LUG via Hampshire wrote:
>> Hello all…
>
> G'day :-)
>
>>
>> The TLDR; is - First time poster here, hoping that someone might be
>> able to direct me to a guide to help me install a
>> Postfix/Dovecot/MariaDB setup on a Raspberry Pi 4B running Trixie
>> please?
>>
>>
>> I appreciate that’s exceedingly brief, so in the hope that it will
>> help, here’s (quite a bit) more detail…
>>
>> In readiness for the (hopefully soon) arrival of FTTP, I’d like to
>> get some experience with a locally-hosted mail service and would like
>> to build out some Raspberry Pi infrastructure to that effect.
>>
>> Current setup:-
>>
>>   * Nominated Mail Server Host – Raspberry Pi 4B / running “Trixie”
>>   * Proposed MTA – Postfix (“Compatability Level 3.6”)
>>   * Proposed MDA/IMAP/POP3 – Dovecot 2.4.1-4
>>   * Proposed SQL Server – MariaDB 11.8.5 [hosted on primary QNAP NAS]
>>   * Existing DNS Infrastructure – Technitium DNS running on a Primary/
>>     Secondary pair of Pi4Bs...
>>
>> Current State of Play:-
>>
>>   * I have set up most of the requirements DNS – all but the DKIM
>> record…
>>
>>   * I have [I think!] successfully installed and configured Postfix,
>>     using this guide:-
>>
>> https://raw.org/tutorial/seting-up-email-server-with-postfix-
>>     dovecot-and-mysql/
>>
>>   * I’ve been able to get a MariaDB database configured and populated
>>     and to use the “postmap -q” command to ensure that PostFix has the
>>     ability to access the “Domain”, “User”, and “Alias” tables – all
>>     that test OK.
>>
>>   * I’ve followed the guide all the way through editing Dovecot – the
>>     section on the above-linked page that has the sub-title, “Update
>>     Dovecot Configuration Files” – and then in that part of the guide
>>     and depending on your viewpoint, I am getting stuck and either Step
>>     4 [Edit /etc/dovecot/conf.d/auth-sql.conf.ext] or Step 5 [Edit /etc/
>>     dovecot/dovecot-sql.conf.ext]… in that when I add the edits
>>     described in Step 4 I get errors reported within the “passdb”
>>     clause… or, if I comment that out, I find that the file /etc/
>>     dovecot/dovecot-sql/conf.ext simply doesn’t exist in the Raspberry
>>     Pi package.
>>
>> However, given that the file defined in Step 5, above, appears to be
>> explicitly named and linked from Step 4, I did try to simply create
>> an empty file and populate it as specified… but the error I get
>> suggests that I am missing some “syntactic wrapping” – headers, block
>> definitions, or similar. More specifically, I see this in syslog:
>>
>>     /“dovecot[20420]: doveconf: Fatal: Error in configuration file /etc/
>>     dovecot/conf.d/auth-sql.conf.ext line 186: passdb_args: Unknown
>>     setting: passdb_args (passdb_passdb_args or passdb_sql_passdb_args
>>     not found either.)”/
>>
>
> I recently upgraded my Bookworm hosted server to Trixie, and found the
> config file format has changed incompatibly between Dovecot 2.3 and
> 2.4. So a lot of the guides out there are now incorrect.
>
> For example, in /etc/dovecot/conf.d/10-auth.conf:
>
>   auth_default_realm = teched-creations.com
>
> becomes
>
>   auth_default_domain = teched-creations.com
>
>>
>> This is the relevant section of the auth-sql.conf.ext file:
>>
>> passdb sql {
>>      driver = sql
>>      args = /etc/dovecot/conf.d/dovecot-sql.conf.ext
>>      }
>
> So this changed too - instead of referencing yet another config file,
> my file has:
>
> sql_driver = pgsql
>
> pgsql localhost {
>   parameters {
>     dbname=dovecot
>     user=dovecot
>     password=THEPASSWORD
>   }
> }
>
> passdb sql {
>   default_password_scheme = SHA256
>
>   query = \
>     SELECT username AS user, domain, password
>     FROM users WHERE (username = '%{user|username}' AND domain =
> '%{user|domain}')
> }
>
>
>> userdb static {
>>      driver = static
>>      args = uid=vmail gid=vmail home=/var/mail/vhosts/%d/%n
>>      }
>>
>> The error I get in Step 4 – before commenting it out – is an error on
>> the line that begins “args =” in the sample code listed with that step.
>>
>> My sense is that a big part of my struggle [other than ignorance] is
>> the slight deviation in package layout between my Pi setup and the
>> worked examples.
>>
>
> Nope, it's the 2.3 vs 2.4 config layout. Both the format of the dict
> and the formatting used to interpolate strings changed ( '%u' is now
> '%{user|username}', for example):
>
> userdb static {
>   fields {
>     uid=vmail
>     gid=vmail
>     home=/var/mail/vhosts/%{user|domain}/%{user|username}
>   }
> }
>
>
>> I have looked at e.g. mail-in-a-box, Citadel, and others and I’m not
>> opposed to using a different software stack if someone can make a
>> good recommendation… this is just where I’ve got to so far.
>>
>> Any recommendations for a workable how-to guide for an Intranet Pi
>> running a local mail solution would be gratefully received.
>>
>> Thanks in advance.
>>
>>
>>
>
> Hope this helps!
>
> Cheers
> Brad
>


--
Please post to: Hampshire@???
Manage subscription: https://mailman.lug.org.uk/mailman/listinfo/hampshire
LUG website: http://www.hantslug.org.uk
--------------------------------------------------------------