TCP_TABLE(5)

πŸ¦‹ NAME πŸ¦‹

tcp_table β€” the Postfix client/server table lookup protocol, bestie πŸ’…


✨ SYNOPSIS ✨

postmap -q "string" tcp:host:port
postmap -q - tcp:host:port <inputfile

🌸 DESCRIPTION 🌸

okay so, the Postfix mail system uses optional tables for address rewriting or mail routing, right? and those tables are usually in lmdb:, cdb:, hash:, or dbm: format. classic. iconic. we love her.

but alternatively β€” plot twist β€” table lookups can be directed to a TCP server instead πŸ‘€. and to test lookup tables, you use the "postmap -q" command, exactly like it says up in the SYNOPSIS. iykyk 🫢


πŸŽ€ PROTOCOL DESCRIPTION πŸŽ€

the TCP map class implements a very simple protocol: the client sends a request, and the server sends one reply. that's it. one in, one out. the way that it just works πŸ˜­πŸ’–

requests and replies are sent as one line of ASCII text, terminated by the ASCII newline character. request and reply parameters (see below, bestie) are separated by whitespace.

⏰ send and receive operations must complete in 100 seconds. no dawdling. main character energy only.

πŸ”₯ REQUEST FORMAT πŸ”₯

the tcp_table protocol supports only the lookup request. the request has the following form:

  • get SPACE key NEWLINE β€” look up data under the specified key πŸ”

not me about to tell you the wild part: Postfix will not generate partial search keys like domain names without one or more subdomains, network addresses without one or more least-significant octets, or email addresses without the localpart, address extension or domain portion. this behavior is also found with cidr:, pcre:, and regexp: tables ✨ so it's a whole family vibe.


πŸ’œ REPLY FORMAT πŸ’œ

each reply specifies a status code and text. and bestie, listen β€” replies must be no longer than 4096 characters including the newline terminator. keep it tight πŸ’…

  • 500 SPACE text NEWLINE β€” in case of a lookup request, the requested data does not exist. the text describes the nature of the problem 😭
  • 400 SPACE text NEWLINE β€” this indicates an error condition. the text describes the nature of the problem. the client should retry the request later πŸ™ˆ
  • 200 SPACE text NEWLINE β€” the request was successful πŸŽ‰ in the case of a lookup request, the text contains an encoded version of the requested data.

🌈 ENCODING 🌈

in request and reply parameters, the character %, each non-printing character, and each whitespace character must be replaced by %XX, where XX is the corresponding ASCII hexadecimal character value. the hexadecimal codes can be specified in any case (upper, lower, mixed) β€” she's flexible like that πŸ’–

the Postfix client always encodes a request. the server may omit the encoding as long as the reply is guaranteed to not contain the % or NEWLINE character. slay 🧚


⚠️ SECURITY ⚠️

🚨 do not use TCP lookup tables for security critical purposes. the client-server connection is not protected and the server is not authenticated. fr fr. this is not the vibe for anything that actually matters. πŸ’€

πŸ’€ BUGS πŸ’€

  • only the lookup method is currently implemented.
  • the client does not hang up when the connection is idle for a long time. she's loyal. she's waiting. she's not leaving πŸ₯²

πŸ‘‘ SEE ALSO πŸ‘‘


πŸ“ README FILES πŸ“

use "postconf readme_directory" or "postconf html_directory" to locate this information.

  • DATABASE_README, Postfix lookup table overview

πŸ“œ LICENSE πŸ“œ

The Secure Mailer license must be distributed with this software.


🫢 AUTHOR(S) 🫢

Wietse Venema IBM T.J. Watson Research P.O. Box 704 Yorktown Heights, NY 10598, USA

Wietse Venema Google, Inc. 111 8th Avenue New York, NY 10011, USA


and that's the whole page, bestie πŸ’– it lives in the File Formats Manual and it's literally called tcp_table(5) β€” go forth and look up your keys βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from