MAKEMAP(8)

✨ MAKEMAP(8) ✨

okay bestie, so this is makemap from section 8 of the manual β€” the system manager's one πŸ’…. buckle up, we're making database maps for smtpd and it's gonna slay.


πŸŽ€ NAME πŸŽ€

makemap β€” create database maps for smtpd. that's literally it, that's the whole vibe 🫢

🌸 SYNOPSIS 🌸

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

πŸ’– DESCRIPTION πŸ’–

so maps are like this generic interface for associating a textual key to a value, right? like a little matching game for your data πŸ”₯. these associations can be accessed through a plaintext file, a database, or DNS β€” pick your fighter. the formats of these file types are described below, don't worry.

makemap itself creates the database maps that get used by keyed map lookups specified in smtpd.conf(5). it's giving behind-the-scenes main character energy honestly.

here's the tea β˜•: makemap reads input from file and writes data to a file which is named by adding a β€œ.db” suffix to file. the current line can be extended over multiple lines using a backslash (\). comments can be put anywhere in the file using a hash mark (#), and they extend to the end of the current line.

⚠️ care should be taken when commenting out multi-line text: the comment is effective until the end of the entire block. like it doesn't stop at the next line, bestie, it keeps going 😭. be careful!

in all cases, makemap reads lines consisting of words separated by whitespace. the first word of a line is the database key; the remainder represents the mapped value. the database key and value may optionally be separated by the colon character. iconic behavior fr fr πŸ’…

the options are as follows:

✨ OPTIONS ✨

  • -d dbtype β€” specify the format of the database. available formats are hash and btree. the default value is hash. slay, we love a default 🌈
  • -o dbfile β€” write the generated database to dbfile. simple as that, no cap πŸ’œ
  • -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, if the mapped value has special meaning, as in the case of a virtual domains file, a suitable type must be provided. 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. very demure, very mindful πŸŽ€
    • set β€” there is no mapped value – a map of this type will only allow for the lookup of keys. this format can be used for building primary domain maps. it's giving minimalist 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. it's the reverse uno card of this whole operation πŸ”„

πŸ‘‘ 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. easy peasy πŸ“

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

table domains db:/etc/smtpd/domains.db

action "local" mbox

match for domain <domains> action "local"

see? we love a complete example that actually works πŸ’–

πŸ¦‹ 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.

virtual domains expect a mapping of virtual users to real users in order to determine if 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

smtpd(8) will perform the lookups in that specific order. like it checks them in sequence, no skipping ahead bestie πŸ“‹

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. it's giving specificity, it's giving catch-all energy 🌟

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

table vdomains db:/etc/smtpd/vdomains.db
table vusers db:/etc/smtpd/users.db

action "local" mbox virtual <vusers>

match for domain <vdomains> action "local"
match for domain "example.org" action "local"

obsessed with how clean that looks ngl πŸ’…


πŸ“ FILES πŸ“

  • /etc/smtpd/aliases β€” list of user mail aliases. you know, the classic πŸŽ€
  • /etc/smtpd/secrets β€” list of remote host credentials. secrets are secrets, keep them safe 🫣

⭐ EXIT STATUS ⭐

the makemap utility exits 0 on success, and >0 if an error occurs. that's the whole thing, no surprises πŸ”₯

πŸ’€ SEE ALSO πŸ’€

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

go read those if you wanna understand the whole ecosystem, iykyk 🌈

🧚 HISTORY 🧚

the makemap command first appeared in OpenBSD 4.6 as a replacement for the equivalent command shipped with sendmail. it's giving glow-up era, we love an upgrade ✨


and that's the whole manual, bestie! this page is from the Debian crew, dated February 13, 2021 β€” shoutout to them for keeping the docs alive πŸ’œ. now go forth and make those maps, you've got this 🫢✨

πŸ“¦ where this page comes from