5

What is the syntax to replace a postfix hash-Database, for example

domain.tld PREPEND my-header: foobar

with a static map?

docs define it as Example: "inline:{ key=value, { key = text with whitespace or comma }}".

Several ways to replace it seemed not to work and its even unclear, how many fields the hash: db really has. is the domain the only key and the rest a string? Should there be some list-syntax for the three fields associated to the domain? And what about a key with multiple values (multiple lines starting with the same domain in the hash: db)?

1 Answer 1

8

First, I'll try to clear some confusions here about postfix lookup table based on official documentation. In short, postfix table must be consisted of key-value pair. Both of key-value has string datatype.

how many fields the hash: db really has. is the domain the only key and the rest a string?

YES. Just ONE key and ONE value. The value has several formats which address different purpose, such as alias, transport, access, etc. See postfix man pages, especially in Table-driven mechanisms section.

Should there be some list-syntax for the three fields associated to the domain?

Some table support that list-like string. For example alias table allows you to define multiple alias target for example.

root [email protected] [email protected]

In here, the value was separated by space or comma.

And what about a key with multiple values (multiple lines starting with the same domain in the hash: db)?

When table has duplicate key, then postfix will choose the value of the first match. In case of hash table, the top entry was chosen, the others value were ignored.


Now, I'll try to answer your question about static and/or inline maps. Please note that these two table types were different of each other.

The inline maps will be introduced in postfix version 3.0. Currently there are no postfix stable release that support that table type. You can read it in postfix 3.0 RC1 release notes.

Let say you want to convert hash table with entries like this

example.com DEFER come back later please
example.net REJECT
example.org PREPEND X-Foo: Bar

Then the equivalent inline maps is

inline:{{example.com=DEFER come back later please}, example.net=REJECT, {example.org=PREPEND X-Foo: Bar}}

For text without space, we can use key=value syntax. With spaces, you need bracket to surround it.

Now, the static maps was different. The table was like wildcard-key table. Postfix may lookup whatever key, but the answer would be static value. For postfix with version lower 3.0, the static table doesn't support value string with space. For postfix 3.0 and later, you may wrap the the value with bracket to add spaces in it. For example

static:REJECT

or

static:{REJECT get out from my postfix}
1
  • Thank you. Especially the docs about what the tables work like were not that clear to me. And then i guess you need to know, what the queries are (for example in a virtual_alias_maps table). But i want the inline table for some headers only, so it will be fine (if my postfix supports it).
    – allo
    Feb 6, 2015 at 17:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .