newaliases(1)

✨ NAME ✨</p>

okay so hi bestie πŸ’– welcome to newaliases β€” it's the glow-up tool that creates a forwarding database from /etc/aliases. that's it. that's the job. she takes your messy little list of who-goes-where and turns it into something fast. iconic behaviour fr fr πŸŽ€


🌸 SYNOPSIS 🌸

newaliases

no flags, no arguments, no drama. she just does it πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea β˜• newaliases reads a table of sendmail-style forwarding instructions out of /etc/aliases and converts them into a forwarding database living at /etc/aliases.cdb. that database is what fastforward eats for breakfast. nom nom. πŸ“

ngl the safety situation here is lowkey genius: instead of writing straight over your live database, newaliases writes the forwarding database to /etc/aliases.tmp first, and then moves /etc/aliases.tmp to /etc/aliases.cdb. if something goes wrong while creating /etc/aliases.tmp, she complains and leaves /etc/aliases.cdb completely alone β€” untouched, unbothered, main character energy πŸ‘‘. in the meantime, deliveries can keep on going using /etc/aliases.cdb. no downtime, no panic, we love to see it 😌

one thing to know: newaliases always creates /etc/aliases.cdb world-readable. every time. no cap.

and bestie, listen β€” newaliases makes no attempt to protect against simultaneous updates of /etc/aliases.cdb. like, none. zero. two of them running at once is giving chaos πŸ’€


πŸŽ€ INSTRUCTION FORMAT πŸŽ€

newaliases imitates how sendmail handles /etc/aliases. for example:

root: alice, bill

that says mail for root should be forwarded to alice and bill. cute, right? ✨

COMPATIBILITY WARNING: newaliases does not support file deliveries. you can use the file delivery mechanism described in dot-qmail(5) instead. periodt.

πŸ’œ SIMPLE ALIASES πŸ’œ

the simplest kind of forwarding instruction is literally just:

alias: recip

any message sent to alias gets forwarded to the recipient address recip. and here's the cute part β€” addresses are compared to alias without regard to case. so ROOT and root are the same girl πŸ’…

forwarding instructions are cumulative. if recip is itself an alias, then messages to alias get forwarded the same way messages to recip do. chain reaction, slay πŸ”₯

for example, with these instructions:

postmaster@heaven.af.mil: bob@heaven.af.mil
root@heaven.af.mil: postmaster@heaven.af.mil

messages to postmaster@heaven.af.mil or root@heaven.af.mil will be delivered to Bob. hi Bob 🫢

COMPATIBILITY WARNING: with sendmail, entries in /etc/aliases can override usernames. with qmail, if you install fastforward in ~alias/.qmail-default, it will not see addresses that are controlled by other users. see qmail-getpw(8). to change this, see qmail-users(5).
COMPATIBILITY WARNING: various versions of sendmail do various strange things with circular alias definitions πŸŒ€ see setforward(1) for details on fastforward's behavior.
COMPATIBILITY WARNING: if there are several forwarding instructions for a single alias, sendmail will complain; fastforward will silently use the first instruction. sneakyyyy πŸ™ˆ

🌈 WILDCARDS 🌈

alias can have the form user@host.dom for one user at one host, @host.dom for all users at one host, or user for one user at all hosts.

COMPATIBILITY WARNING: sendmail supports only user; it does not support per-host aliases. it accepts user@host.dom if host.dom is a local host, but it then treats it the same way as user, applying to all local hosts and virtual domains. so basically it's giving "sure I'll take it" and then doing whatever it wants πŸ’€

⭐ ADDRESS FORMATS ⭐

addresses in /etc/aliases are parsed the same way as addresses in RFC 822 message headers. parenthesized comments and bracketed addresses are permitted:

root: bob (Bob, the postmaster)
joe: Joe Shmoe <shmoe@heaven.af.mil>

addresses with special characters must be quoted:

fred: "spaced out mailbox"@heaven.af.mil

address groups are not permitted, since colons have a different use in /etc/aliases. sorry bestie, no groups today 😭

any recipient address without a fully qualified domain name is fed through the defaulthost, defaultdomain, and plusdomain mechanisms described in qmail-header(5). so she'll fill in the blanks for you, queen behaviour πŸ‘‘

COMPATIBILITY WARNING: sendmail's handling of quotes and backslashes violates RFC 821 and RFC 822, and is not supported by newaliases. the qmail-local delivery mechanism lets each user manage several addresses, so there is no need for a special syntax to get around forwarding.

πŸ’– MULTIPLE RECIPIENTS πŸ’–

an instruction may list more than one recipient address:

alias: recip1, recip2, recip3

any message sent to alias will be forwarded to all of the addresses. everybody eats πŸ”₯

a forwarding instruction may also be split across several lines. each line past the first must either (1) begin with space or tab or (2) be empty:

hostmaster:
   fred,
   joe
COMPATIBILITY WARNING: sendmail requires the colon to be on the first line of a multi-line forwarding instruction. newaliases doesn't care whether the colon is present at all. she's chill like that 😌
COMPATIBILITY WARNING: sendmail does not permit blank lines in the middle of continuations. this has the undesirable effect that a blank line behaves differently from a line containing a single space. the way that's a footgun 😭

πŸ“ COMMENTS πŸ“

any line in /etc/aliases that begins with # is ignored:

# this is a comment

a comment may be split across several lines. each line past the first must either (1) begin with space or tab or (2) be empty.

COMPATIBILITY WARNING: sendmail does not permit continuations of comment lines. rude honestly.

πŸ¦‹ PROGRAMS πŸ¦‹

if a recipient address does not contain a domain name, and begins with a vertical bar, newaliases takes the rest of the address as a program to run:

weather: "|weather-server"

fastforward will run weather-server when a message arrives for weather. it's giving ✨ automation ✨

COMPATIBILITY WARNING: internet addresses can legitimately start with a slash or vertical bar. newaliases treats anything with an unquoted @ as an address. sendmail appears to have various problems coping with these addresses, and with commands that contain @ signs. not our problem πŸ’…
COMPATIBILITY WARNING: newaliases does not allow a vertical bar before double quotes.

🧚 INCLUDE FILES 🧚

a recipient address of the form :include:file means "every address listed in file." (actually fastforward reads file.bin; see newinclude(1) for further details.) the lore goes deep, iykyk 🀫

note that file is read by fastforward, not by newaliases, so the system administrator does not have to run newaliases every single time file changes. huge W for sysadmins everywhere 🫢 file must be world-readable and accessible to fastforward.

COMPATIBILITY WARNING: if an :include: file is unreadable or nonexistent, sendmail skips it; fastforward defers delivery of the message. very different vibes.
COMPATIBILITY WARNING: sendmail does not permit spaces inside the literal text :include:. newaliases does. we're flexible πŸ’…
COMPATIBILITY WARNING: versions of sendmail before V8 did not strip quotes from :include: filenames. ancient history bestie πŸ’€

πŸ‘‘ ALIAS OWNERS πŸ‘‘

if there is an alias for owner-list, any message forwarded through list will have its envelope sender set to owner-list, so that bounces go back to owner-list. she's responsible. she's got receipts. we stan 🌸

COMPATIBILITY WARNING: when an alias includes the same recipient both inside and outside a mailing list, fastforward sends the message twice, once with each envelope sender. sendmail sends the message only once; its choice of envelope sender for that recipient depends on the phase of the moon πŸŒ™πŸ˜­ literally. that's in the manual. we don't make the rules.

πŸ” SEE ALSO πŸ”


okay that's the whole page bestie πŸ’– go forth and forward your mail, you absolute legend. this was newaliases(1) from the General Commands Manual β€” mwah, love u, bye πŸŽ€βœ¨πŸ¦‹