.TH MAKEMAP 8 "$Mdocdate: July 19 2013 $" "" .SH NAME .ad l \fB\%makemap\fP \- create database maps for smtpd .SH SYNOPSIS .ad l .br \fB\%makemap\fP [\fB\-o\fP \fIdbfile\fP] [\fB\-t\fP \fItype\fP] \fIfile\fP .SH DESCRIPTION .ad l Maps provide a generic interface for associating textual key to a value. Such associations may be accessed through a plaintext file, database, or DNS. The format of these file types is described below. \fB\%makemap\fP itself creates the database maps used by keyed map lookups specified in \fBsmtpd.conf\fP(5). .PP \fB\%makemap\fP reads input from \fIfile\fP and writes data to a file whose name is made by adding a ``.db'' suffix to \fIfile\fP. The current line can be extended over multiple lines using a backslash (Sq \e.) Comments can be put anywhere in the file using a hash mark (Sq #,) and 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. In all cases, \fB\%makemap\fP 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. .PP The options are as follows: .RS 5 .TP \fB\-o\fP \fIdbfile\fP Write the generated database to \fIdbfile\fP. .TP \fB\-t\fP \fItype\fP 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 the virtual domains file, a suitable \fItype\fP must be provided. The available output types are: .RS 5 .TP \fBaliases\fP 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. .TP \fBset\fP There is no mapped value \(en a map of this type will only allow for the lookup of keys. This format can be used for building primary domain maps. .RE .RE .SH PRIMARY DOMAINS .ad l Primary domains can be kept in tables. To create a primary domain table, add each primary domain on a single line by itself. .PP 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: .RS 4 .nf table domains "/etc/domains" accept for domain deliver to mbox .RE .SH VIRTUAL DOMAINS .ad l Virtual domains may also be kept in tables. To create a virtual domain table, add each virtual domain on a single line by itself. .PP 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 \fBaliases\fP(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 and ``@'' to provide a global catch-all for all domains. \fBsmtpd\fP(8) will perform the lookups in that specific order. .PP To create 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. .PP In addition to adding an entry to the virtual map, one must add a filter rule that accepts mail for virtual domains, for example: .RS 4 .nf table vdomains "/etc/vdomains" table vusers "/etc/users" accept for domain virtual deliver to mbox accept for domain example.org virtual deliver to mbox .RE .SH FILES .ad l .RS 5 .TP .B /etc/aliases List of user mail aliases. .TP .B /etc/secrets List of remote host credentials. .RE .SH EXIT STATUS .ad l The \fBmakemap\fP utility exits 0 on success, and >0 if an error occurs. makemap .SH SEE ALSO .ad l \fBaliases\fP(5), \fBsmtpd.conf\fP(5), \fBeditmap\fP(8), \fBnewaliases\fP(8), \fBsmtpd\fP(8) .SH HISTORY .ad l The \fB\%makemap\fP command first appeared in OpenBSD 4.6 as a replacement for the equivalent command shipped with sendmail.