Solved Issues compiling bdb support into postfix/postmap?

Greetings!

I've recently been working on a FreeBSD install from 12.0 to 12.2.. This OS/HW instance supports several jails, one is dedicated to my postfix/dovecot mailhost.

After futzing with various version changes to various settings.. (god, cant we just leave things alone for a bit?) Anyway, mail is floowing, logs are clear of errors, everything SEEMS to be happy here except for ONE LITTLE THING.. I can't expand my SASL password database using postmap..

I'm readying to flip DNS providers, thus upstream MX store and forward servers, so, new usernames and passwords for the SASL logins..

Can't get it to work - totally stumped..

Code:
[root@mailhost:/usr/local/etc/postfix/sasl]# postmap dbm:/usr/local/etc/postfix/sasl/sasl_passwd
postmap: fatal: unsupported dictionary type: dbm. Is the postfix-dbm package installed?
[root@mailhost:/usr/local/etc/postfix/sasl]#

The files suggest they are Berkely DB:

Code:
[root@mailhost:/usr/local/etc/postfix/sasl]# file *
sasl_passwd:     ASCII text
sasl_passwd.db:  Berkeley DB (Hash, version 9, native byte-order)
sasl_passwd.dir: empty
sasl_passwd.pag: data
[root@mailhost:/usr/local/etc/postfix/sasl]#

When I compile and install postfix, I DEFINITELY select the bdb support option checked..

Code:
[x] BDB         Berkeley DB support

I then compile and install without error, turn on, mail flows - we're VERY happy..

But then I try to update the SASL passwd file and again, no BDB support! Okay, why not, it was RIGHT THERE, VERY FIRST LINE. Checked YES. Let's see, okay, postconf -m will show us the supported map types:

Code:
[root@mailhost:/usr/local/etc/postfix/sasl]# postconf -m
btree
cidr
environ
fail
hash
inline
internal
memcache
mysql
pcre
pipemap
proxy
randmap
regexp
socketmap
static
tcp
texthash
unionmap
unix
[root@mailhost:/usr/local/etc/postfix/sasl]#

AND, oddly enough, bdb is installed?

Code:
[root@mailhost:/usr/ports/mail/postfix-sasl]% pkg info db5
db5-5.3.28_7
Name           : db5
Version        : 5.3.28_7
Installed on   : Wed Dec  9 18:06:19 2020 PST
Origin         : databases/db5
Architecture   : FreeBSD:12:amd64
Prefix         : /usr/local
Categories     : databases java
Licenses       : SLEEPYCAT
Maintainer     : mandree@FreeBSD.org
WWW            : https://www.oracle.com/database/berkeley-db/db.html
Comment        : Oracle Berkeley DB, revision 5.3
Options        :
    CRYPTO         : on
    DEBUG          : off
    DOCS           : on
    JAVA           : off
    L10N           : off
    SQL            : off
    TCL            : off
Shared Libs provided:
    libdb_stl-5.3.so.0
    libdb_cxx-5.3.so.0
    libdb-5.3.so.0
Annotations    :
    FreeBSD_version: 1201000
    repo_type      : binary
    repository     : FreeBSD
Flat size      : 49.2MiB
Description    :
Oracle Berkeley DB is a family of open source embeddable databases
that allows developers to incorporate within their applications a
fast, scalable, transactional database engine with industrial grade
reliability and availability. As a result, customers and end-users
will experience an application that simply works, reliably manages
data, can scale under extreme load, but requires no ongoing database
administration. As a developer, you can focus on your application and
be confident that Oracle Berkeley DB will manage your persistence
needs.

WWW: https://www.oracle.com/database/berkeley-db/db.html
[root@mailhost:/usr/ports/mail/postfix-sasl]% >....

I'm totally confused.. All I want to do is update a BDB password file, then gernate a BDB db,pag and dir file from it...

Thanks for any suggestions!

-ET-
 
Last edited by a moderator:
Bump. Any chance anyone has ANY idea here - I've wracked my brain and all my current search terms now lead me back to my own post, which leads me to believe I'm suffering stupidity and or RTFM.. I've looked and looked but I still can't seem to see what I am doing incorrectly here? Mostly, why, when I check the "Berkley DB" support option, compile and re-install, do I not actually GET bdb support installed as indicated by postconf -m output?

Thanks so much!!
 
Any chance anyone has ANY idea here

Not sure if its the problem but have you changed the options on security/cyrus-sasl2 too?
Code:
     BDB1=on: Berkeley DB 1.85 support
     BDB=off: Berkeley DB support
     GDBM=off: GNU dbm library support
     LMDB=off: OpenLDAP Lightning Memory-Mapped Database support

Looks as though security/cyrus-sasl2 uses BDB1 by default, you probably need to set this to BDB too.
 
Aha! SirDice, I haven't tested just yet, but your clue might be spot on!!

Code:
[username@mailhost:~]% pkg info cyrus-sasl-2.1.27_1 |grep BDB
    BDB            : off
    BDB1           : on
[username@mailhost:~]%

I'll recompile, install and test momentarily and update.. THANK YOU for the lead!!!

-ET-
 
Okay, I found what I believe are all the pertinent /usr/ports/ packages, cleaned, config'd, fresh make, remove old packages and make install newly compiled versions..

Everything SAYS that BDB is supported, but STILL, when I attempt to run postmap, it says "unsupported dictionary type".. Just for the record, this DID actually work for me at one point long ago, perhaps Freebsd 11 or so. It's how I generated the current sasl creds for the ISP I want to dump... I kept a log in a wiki and can see where I did this exact command..

So... Still stumped..

Code:
[root@mailhost:/usr/ports/mail/postfix-sasl]# pkg info postfix-sasl | grep -E "(Version|bdb|BDB)"
Version        : 3.5.8,1
    BDB            : on
    libdb-5.3.so.0
[root@mailhost:/usr/ports/mail/postfix-sasl]# pkg info cyrus-sasl | grep -E "(Version|bdb|BDB)"
Version        : 2.1.27_1
    BDB            : on
    BDB1           : off
    libdb-5.3.so.0
[root@mailhost:/usr/ports/mail/postfix-sasl]# freebsd-version
12.2-RELEASE-p2
[root@mailhost:/usr/ports/mail/postfix-sasl]#
[root@mailhost:/usr/ports/mail/postfix-sasl]# postmap dbm:/usr/local/etc/postfix/sasl/sasl_passwd
postmap: fatal: unsupported dictionary type: dbm. Is the postfix-dbm package installed?
[root@mailhost:/usr/ports/mail/postfix-sasl]#

Still no INDICATED BDB support showing via postconf -m?

Code:
[root@mailhost:/usr/ports/mail/postfix-sasl]# postconf -m
btree
cidr
environ
fail
hash
inline
internal
memcache
mysql
pcre
pipemap
proxy
randmap
regexp
socketmap
static
tcp
texthash
unionmap
unix
[root@mailhost:/usr/ports/mail/postfix-sasl]#

SirDice, thank you so much for the pointer - I'm sure this is part of the overall solution, but perhaps not ALL of it somehow?

I USED to know things. Now? Not so much.. ;-)
 
OMG.. I AM stupid.. It appears my "notes" from long ago are INCORRECT!

Wracking my brains, I found this little tidbit:

Code:
[root@mailhost:/usr/local/etc/postfix/sasl]# postconf |grep smtp_sasl_password_maps
smtp_sasl_password_maps = hash:/usr/local/etc/postfix/sasl/sasl_passwd
[root@mailhost:/usr/local/etc/postfix/sasl]#

Wait.. That says HASH, not BDB!! What the eff? Okay, I wonder:

Code:
[root@mailhost:/usr/local/etc/postfix/sasl]# postmap hash:/usr/local/etc/postfix/sasl/sasl_passwd
[root@mailhost:/usr/local/etc/postfix/sasl]#

And, when I examine the files, I see:

Code:
[root@mailhost:/usr/local/etc/postfix/sasl]# ls -l
total 35
drwxr-xr-x  2 root  postfix      6 Dec 20 14:23 SAVE
-rw-------  1 root  postfix    177 Dec  8 18:13 sasl_passwd
-rw-------  1 root  postfix  49152 Dec 20 14:24 sasl_passwd.db
-rw-------  1 root  postfix      0 Jan  7  2017 sasl_passwd.dir
-rw-------  1 root  postfix   1024 Jan  7  2017 sasl_passwd.pag
[root@mailhost:/usr/local/etc/postfix/sasl]# file *
SAVE:            directory
sasl_passwd:     ASCII text
sasl_passwd.db:  Berkeley DB (Hash, version 9, native byte-order)
sasl_passwd.dir: empty
sasl_passwd.pag: data
[root@mailhost:/usr/local/etc/postfix/sasl]#

Hmn... So, if we're NOT using BDB, and the .dir/.pag files weren't updated perhaps we should remove them..

Code:
[root@mailhost:/usr/local/etc/postfix/sasl]# ls -l
total 34
drwxr-xr-x  2 root  postfix      6 Dec 20 14:23 SAVE
-rw-------  1 root  postfix    177 Dec 20 14:34 sasl_passwd
-rw-------  1 root  postfix  49152 Dec 20 14:34 sasl_passwd.db
[root@mailhost:/usr/local/etc/postfix/sasl]#

....and after a postfix restart, all appears to be working as it should be.. Which means it can still get correct credentials out of the file I just updated, AND the file now includes my new ISP credentials....

Sooooo... I appear to have switched from BDB to HASH sometime in 2017, and didn't log it properly... When I used "file" to see what kind of thing I needed to do, it aligned with my out of date notes, ie; file calls it out as a Berkely DB file (THEN the Hash notation, which I hadn't noticed.. DOH!!) All of which conspired to send me down the wrong path..

Sigh...

Consider this closed, I've self flagellated myself a bit for you.

Thanks all for reading and your support!

Sincerely,

-ET-
 
Back
Top