TABLE_REDIS(5)
β¨ TABLE_REDIS(5) β¨
okay so this is the table_redis page from the File Formats Manual, and bestie, if you're setting up smtpd(8) tables backed by redis, this is literally your roman empire. let's get into it π
πΈ NAME πΈ
table_redis β the format description for smtpd redis tables. that's it, that's the name, she's iconic and she knows it β¨
π¦ DESCRIPTION π¦
This manual page documents the file format of redis tables used by the smtpd(8) mail daemon. no cap.
The format described here applies to tables as defined in smtpd.conf(5). iykyk.
π REDIS TABLE π
A Redis table lets you store usernames, passwords, aliases, and domains in a redis server. it's giving organized queen energy π
The table is used by smtpd(8) when:
- authenticating a user,
- when user information such as user-id and/or home directory is required for a delivery,
- when a domain lookup may be required,
- and/or when looking for an alias.
A Redis table consists of one Redis Databases with one or more keys. (yes, the original says "one Redis Databases" β we don't edit the source material, we respect the source material π«Ά)
π¨ important glow-up check: If the table is used for authentication, the password should be encrypted using thecrypt(3)function. Such passwords can be generated using theencrypt(1)utility orsmtpctl(8)encrypt command. do not be out here storing plaintext passwords, i am begging π
π REDIS TABLE CONFIG FILE π
these are the config keys, and every single one of them matters, so no skipping:
masterβ This is the IP of the master redis server. To connect via an unix socket useunix:/path/to/sock. The default is127.0.0.1.master_portβ This is the port used to connect to the master redis server. The default is6379.slaveβ This is the IP of the slave redis server, if any. To connect via an unix socket useunix:/path/to/sock.slave_portβ This is the port used to connect to the slave redis server if any.databaseβ The database number to use. The default is0.passwordβ The password to use to authenticate to the redis server if any.query_domainβ This is used to provide a query for a domain query call. All the'%s'are replaced with the appropriate data, in this case it would be the right hand side of the SMTP address. This expects one string to be returned with a matching domain name.query_userinfoβ This is used to provide a query for looking up user information. All the'%s'are replaced with the appropriate data, in this case it would be the left hand side of the SMTP address. This expects three fields to be returned an int containing a UID, an int containing a GID and a string containing the home directory for the user.query_credentialsβ This is used to provide a query for looking up credentials. All the'%s'are replaced with the appropriate data, in this case it would be the left hand side of the SMTP address. the query expects that there are two strings returned one with a user name one with a password in encrypted format.query_aliasβ This is used to provide a query to look up aliases. All the'%s'are replaced with the appropriate data, in this case it would be the left hand side of the SMTP address. This expects one string to be returned with the user name the alias resolves to. If the query returns an array, all the data will be concatenated into one string with','as a separator.query_mailaddrβ This is used to provide a query to check if a mail address exists. All the'%s'are replaced with the appropriate data, in this case it would be the SMTP address. This expects an integer as a reply,0= false and1= true.
π EXAMPLES π
Due to the nature of redis, multiple schemas can be used. Those provided here a known to work. (again β not our typo to fix, we're just the messenger π)
π domain
Using a set for the domains:
# redis-cli sadd domains example.net
in the redis table configuration file:
query_domain SISMEMBER domains %s
π§ userinfo
Hash works well for users:
# redis-cli HSET user:foo uid 1001
# redis-cli HSET user:foo gid 1001
# redis-cli HSET user:foo maildir /mail/foo
in the redis table configuration file :
query_userinfo HMGET user:%s uid gid maildir
π credentials
We can extend the hash for our user to put credential in it:
# redis-cli HSET user:foo login foo
# redis-cli HSET user:foo passwd encrypted_password
in the redis table configuration file:
query_credentials HMGET user:%s login passwd
β alias
Using redis sorted list:
# redis-cli LPUSH aliases:foo@example.net foo
# redis-cli LPUSH aliases:bar@example.net foo
in the redis table configuration file:
query_alias LRANGE aliases:%s 0 -1
π₯ mailaddr
Using a set for the addresses:
# redis-cli sadd mailaddr foo@example.net
in the redis table configuration file:
query_mailaddr SISMEMBER mailaddr %s
π SEE ALSO π
encrypt(1), smtpd.conf(5), smtpctl(8), smtpd(8)
go read them, bestie, they're all part of the lore π
π°οΈ HISTORY π°οΈ
The first version of table_redis was written in 2015. It was converted to the stdio protocol in 2024. glow-up of the decade, honestly β¨
π AUTHORS π
table_redis was initially written by Emmanuel Vadot <elbarto@bocal.org>. The conversion to the stdio table protocol was done by Omar Polo <op@openbsd.org>. legends, both of them π«Ά
and that's the whole page! this gem is from the Debian edition, dated April 21, 2024, and it's giving certified classic. now go forth and configure your redis tables, you absolute main character π π
π¦ where this page comes from
- alpine 3.24: opensmtpd-table-redis-doc 1.0.1-r0 Β· ISC
- debian trixie: opensmtpd-table-redis 1.0.1-1+b1 Β· ISC
- nixos 26.05: opensmtpd-table-redis 1.0.1
- nixpkgs unstable: opensmtpd-table-redis 1.0.1
- ubuntu questing: opensmtpd-table-redis 1.0.1-1
- ubuntu resolute: opensmtpd-table-redis 1.0.1-1build1 Β· ISC
- ubuntu stonking: opensmtpd-table-redis 1.0.1-1build1 Β· ISC
- Copyright (c) 2015 Emmanuel Vadot <elbarto@bocal.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms