Does anyone have some Postfix brain cells to spare? Let me know your thinking on the following problem.
I have a Majordomo server with a large number of lists (like 10k) and a lot of them are automatically updated. I would like to get these off of Majordomo and just implement them using Postfix aliases. I can think of a few different ways to do this but I’m looking for the most elegant solution, minimal moving parts, etc.
The majority of these lists are “manager lists”, for example jdoe_direct (his direct reports) and jdoe_all (all reporting to him or below him).
Right now manager lists are built/refreshed once per day in the morning. This is probably sufficient for our needs as well.
There is one script that pulls the employee data to a flat file. Among other things the file contains “X reports to Y”. There is no easy way to query all direct reports of Y, you have to walk the list and collect all instances of “X reports to Y”. (there is already a script that does this and produces plain text files named *_direct and *_all which we can probably recycle.)
What I need is a nice way to combine this existing script with something that creates Postfix-usable aliases.
One option might be to create a directory full of files called “jdoe_all” and “jdoe_direct” and one more file that lists them all in format suitable for an aliases or virtual file. This has the advantage of being mostly invented already, and easy to understand for other maintainers.
What I might like instead is a sort of “instant aliases” system where Postfix runs a program when it needs to expand the alias, and the program gives some realtime results. In that case I would probably just need one flatfile (sort of the reverse of “X reports to Y” – the file would say “Y’s direct reports are X and Z”) That means fewer data files to manage, but it has downsides, mostly that its non-standard nature makes it difficult to troubleshoot if something goes wrong. It could be made to query the database directly, but I think the updates only appear in the database once a day anyway.
As a techie, it’s an interesting problem I’d like to learn how to solve, but as a manager I would probably reject the “real time query” aspect as being too complex for little gain. *Unless* it could be made totally real time (as in always querying the DB and not building a temp file) but in that case we run the risk of holding up mail if the connection to the DB is broken.
So… for the postfix geeks, is it possible to run a script that expands an alias and spits out the expanded value to stdout? (Sort of like “include” in an alias file but it runs the file instead of reading from it). If so, what are the drawbacks if any? Also, if I were to create a big huge file with all the relationships in it, is there any limit to the “right hand side” of an alias, or can I have a continuation of an alias that goes on for hundreds of lines (or even thousands)?