MAKEMAP(8)

πŸ“¦ version 7.9.0p0, in epel 10, epel 9, fedora 43, fedora 44

πŸ’– MAKEMAP πŸ’–

okay bestie, listen up β€” this one's a System Manager's Manual girly named makemap, and her whole job is making database maps for smtpd. she's serving, she's efficient, she's lowkey the backbone of your mail setup. let's get into it πŸŽ€


✨ NAME ✨

makemap β€” create database maps for smtpd


🌸 SYNOPSIS 🌸

makemap [-U] [-d dbtype] [-o dbfile] [-t type] file

πŸ¦‹ DESCRIPTION πŸ¦‹

so maps are like... the universal translator of the Unix world? πŸ’… they give you a generic interface for pairing a textual key with a value. that association can live in a plaintext file, a database, or DNS β€” all three, iconic behavior honestly. the format of each of those file types gets explained below, don't worry.

makemap herself is the one who actually creates the database maps used by the keyed map lookups you specify over in smtpd.conf(5). she's the plug. πŸ”₯

here's the tea: makemap reads input from file, then writes the data to a file named by slapping a .db suffix onto file. that's it, that's the naming scheme, no notes.

  • the current line can be extended over multiple lines using a backslash (\)
  • comments can go anywhere in the file using a hash mark (#), and they run to the end of the current line
  • > ⚠️ be careful when you comment out multi-line text bestie: the comment stays effective until the end of the entire block. she doesn't stop at one line. that's just how she is. 😭

in all cases, makemap reads lines made of words separated by whitespace. the first word of a line is the database key; everything left over is the mapped value. and optionally, the key and value can be separated by the colon character. cute, right?

the options are as follows:

πŸ’… OPTIONS πŸ’…

  • -d dbtype β€” specify the format of the database. the available formats are hash and btree. the default value is hash. (yes she has a favorite and yes it's hash, periodt.)
  • -o dbfile β€” write the generated database to dbfile.
  • -t type β€” specify the format of the resulting map file. the default map format is suitable for storing simple, unstructured, key-to-value string associations. however β€” and this is the important part β€” if the mapped value has special meaning, like in the case of a virtual domains file, you gotta provide a suitable type. the available output types are:
    • aliases β€” the mapped value is a comma-separated list of mail destinations. this format can be used for building user aliases and user mappings for virtual domain files.
    • set β€” there is no mapped value at all β€” a map of this type will only allow for the lookup of keys. this format can be used for building primary domain maps. (so it's giving keys-only, value-less, mysterious. we love a minimal queen. ✨)
  • -U β€” instead of generating a database map from text input, dump the contents of a database map as text, with the key and value separated with a tab. reverse uno card! πŸ”„

πŸ‘‘ PRIMARY DOMAINS πŸ‘‘

primary domains can be kept in tables. to create a primary domain table, add each primary domain on a single line by itself. one per line, no grouping, we're keeping it tidy bestie.

in addition to adding an entry to the primary domain map, you must also add a filter rule that accepts mail for the domain map. for example:

table domains db:/etc/opensmtpd/domains.db
action "local" mbox
match for domain <domains> action "local"

🌈 VIRTUAL DOMAINS 🌈

virtual domains may also be kept in tables. to create a virtual domain table, add each virtual domain on a single line by itself. same energy, different map. πŸ’œ

virtual domains expect a mapping of virtual users to real users, because that's how they figure out whether a recipient is accepted or not. the mapping format is an extension to aliases(5), which allows the use of:

  • user@domain.tld β€” to accept user only on the specified domain
  • user β€” to accept the user for any of the virtual domains
  • @domain.tld β€” to provide a catch-all for the specified domain
  • @ β€” to provide a global catch-all for all domains

and smtpd(8) will perform the lookups in that specific order. order matters, don't rearrange her. 🫢

to create a single virtual address, add user@example.com user to the users map. to handle all mail destined to any user at example.com, add @example.com user to the virtual map.

in addition to adding an entry to the virtual map, you must add a filter rule that accepts mail for virtual domains, for example:

table vdomains db:/etc/opensmtpd/vdomains.db
table vusers db:/etc/opensmtpd/users.db
action "local" mbox virtual <vusers>
match for domain <vdomains> action "local"
match for domain "example.org" action "local"

πŸ“ FILES πŸ“

  • /etc/opensmtpd/aliases β€” list of user mail aliases.
  • /etc/opensmtpd/secrets β€” list of remote host credentials. 🀫

⭐ EXIT STATUS ⭐

the makemap utility exits 0 on success, and >0 if an error occurs. makemap

(and yeah, the original page literally just says makemap again at the end there β€” she's a little quirky like that, no cap, we're keeping her exactly as she is πŸ’€)


πŸ”₯ SEE ALSO πŸ”₯

aliases(5), smtpd.conf(5), table(5), newaliases(8), smtpd(8)


🧚 HISTORY 🧚

the makemap command first appeared in OpenBSD 4.6 as a replacement for the equivalent command shipped with sendmail. glow-up of the century honestly, ate and left no crumbs. πŸ‘‘


and that's the whole page bestie!! πŸŽ€ this one's from the System Manager's Manual, dated $Mdocdate: February 13 2021 $, and the page itself is MAKEMAP(8). go build those maps, you absolute icon πŸ’–βœ¨

πŸ“¦ where this page comes from