-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mapping features offered by the formula not sufficient to mirror postfix reqs #83
Comments
@aboe76 @javierbertoli @EvaSDK @davidkarlsen @0xf10e @alxwr This might be relevant for you as you've done commits in the last two years to this formula. |
It worked for my small setup, so it's a starter, right? ; )
No idea about that one.
This may get difficult with the database backends. You could try prefixing the filename in your version of
Don't try too hard to adjust data structures in jinja. Some things are just not possible
I'd say if you can use I wasn't too active lately, is there a formal way to handle breaking changes in formulas...? |
Pffft, it works for my regular nodes that only relay to a central machine as well.
I think backing them out is the right thing to do. They replicate existing functionality and are way too limited to have actually ever been used by anyone. Furthermore: Future postfix versions will not support the code anymore as written...
Ohh, I was looking at the filename of the map-file as it is written on disk, not the full string. That has the benefit of not needing any change if people move from e.g. proxy:mysql:/whatevs to mysql:/whatevs if we only key it off the /whatevs part.
I am all for that, but how do we wanna handle existing users at that point? A big note in the README that stuff is now different and you need to change your pillars?
Interesting. You suggest to just abort the formula in case we detect old data and notify the user? Interesting concept.
Nothing really official that I have found. There seems to be attempts like php.ng where they develop a new formula in parallel to the old formula and then let the old one languish full of bugs incentivizing people to move to the newer one. 😝 |
(Answering to parts of this separately, makes it easier to read - at leas for me ;))
We can add states causing warnings first and keep them around while working on the new version.
Somewhat like a service not starting with an invalid configuration, right?
Yeah... I really don't like those annoying "ng" formulas/states. |
This is not really the better place to discuss it but I really think this is a big problem in the way salt formulas are handled now: no versions (only git master), mandatory ascendent compatibility, etc. The 'ng' of handling it is a poor solution. |
@ixs I agree with with most of your mentioned shortcomings and proposed changes.
Well, what do you mean by "backing them out" exactly? I'm using To give a concrete example (an to avoid misunderstandings): would this Pillar data still be supported? mx.example.test:
----------
postfix:
----------
config:
----------
# [...]
virtual_alias_maps:
hash:/etc/postfix/virtual_alias_maps
virtual_mailbox_domains:
- example.test
- example2.test
virtual_mailbox_maps:
None
virtual_transport:
lmtp:unix:private/dovecot-lmtp
mapping:
----------
virtual_alias_maps:
|_
----------
[email protected]:
[email protected]
2¢:
My preferred approach would be to start the refactoring in an extra branch, put warnings into master, and merge when the code is ready and tested. If someone is still using conflicting pillar data, let the formula fail. |
@alxwr Thanks for your reply. Let's go through it step by step.
Ahhh. So you are the one user who is using that feature. Glad we found you. ;-) What I mean by backing out that change: Get rid of the whole code that sets up the virtual_* handling. It's a duplication of the more general code that configures tables/maps with the only difference that a few assumptions are hardcoded. In case backwards compatibility is not possible we can drop a note about that into the README and explain how to use the existing pillars to achieve the same results as the virtual_ special case.
I believe the example you gave is easy to support in the future as it is not using any mysql handling.
I agree. I think .ng is a terrible thing.
Agreed with that as well. I would have suggested using the branch more in the way of:
Right.
Has not been done before though.
True but I suspect reality will look a bit different.
Okay, that is something we could do... I think in this case, it might make sense to handle the branch within the repo and then do a PR against master later on. Or do we wanna keep doing PRs against said branch? |
I think too it's the best solution to make a backward-incompatible change
I suspect too it's false for a large part of salt users, which don't make a fork of the formula, and test it on themselves. |
@daks I didn't think of forks (as in GitHub forks), but of cloned repositories (i.e. submodules) on the salt master. Those should only change on |
@ixs Thanks for taking the time to answer my questions!
Yay, I'm special! :-) My objective are simple (no dependencies), tiny mailserver setups. I just don't know how to do that without virtual domains. If there's another (simpler) way, I'm all ears. :-)
Agreed. I prefer generalized, DRY code too. (In fact I found this peculiar aspect of the formula rather confusing.) I'm ok with your proposed changes as long as they still allow me to use a multi-domain setup without the need for a DB backend.
If the virtual_ special case is code nobody needs to use or wants to maintain, we should just drop it and add the explanation to the README.
\o/
I like that idea. This could work with other formulas too.
That's true. AFAIK most formulas don't use multiple branches either.
Well, it's in the official documentation:
IMO it's therefore reasonable to decline responsibility for unexpected changes in other people's infrastructure. (I mean it's clear that one must test upgraded software before putting it into production.)
This reminds me of an Email I received from @gtmanfred (I suppose):
Suggestion: Let's start with a dev branch in your GitHub repository. When you consider it to be stable enough, I'd be glad to test it in my setup. If needed, PRs can still be submitted to that dev branch. |
I have a comment on this formula not supporting lists for the maps. I was trying to figure out how to update the formula to support that, then realized that Postfix allows variables to be created on demand, so the following should work without any changes to the formula:
I came up with this because I was trying come up with a way to us two files for a virtual_alias_maps and have the mapping data also be in the pillar data. |
@ixs Would #83 (comment) in combination with #90 solve the discussed shortcomings for you? (If not I'd be happy to create a dev branch.) [1] If we do a refactoring we should adhere to the new approach outlined in the |
@roskens Thanks for your suggestion of using "The Postfix Way". :-) |
@alxwr Hmmm... This is certainly a clever way of solving the issue... But I am not sure how I feel about "vadalizing" the postfix config namespace as a workaround. It is certainly clever though. :-) Give me a few days, I just put the mailserver I installed using the formula (with my local mods) into production, so I need to spend a few days babysitting everything... Then I'll have a look at details but my first impression is: Go ahead with the dev branch. It's a good idea. |
Alright. Did tons of testing and found one missing feature but I believe I have something worth looking at now: https://github.com/bawuenet/postfix-formula/tree/local_changes Have a look and share what you think. |
@ixs Thanks for your work! https://github.com/bawuenet/postfix-formula/tree/local_changes looks good to me at first glance. (It's late where I live, so I'm not capable of a meaningful review right now. :-) |
Quick note, this would also fix the issue described in #89. |
@alxwr Thanks. Another thing I noticed the other day: The description of the formula parts and the action do not really match. It says the state "postfix" installs and starts the service while "postfix.config" configures main.cf and optionally master.cf. Turns out the basic postfix state will also configure stuff like aliases etc. Does that seem sensible to you? Or should those parts go into postfix.config? |
@ixs Config should go into |
Turns out, the mapping features offered by the formula are not sufficient to mirror real-life postfix deployments.
This issue serves as a discussion point to consider how to improve the current situation. It would probably also make a lot of sense to have a chat on IRC and discuss our options...
(NB: When I say mapping this can be read as lookup tables as well)
Postfix offers basically three ways of using mapping tables:
transport_maps = static:relay_example.com:25
sender_canonical_maps = tcp:127.0.0.1:10001
transport_maps = hash:/etc/postfix/transports
transport_maps = mysql:/etc/postfix/transports.cf
Detailed descriptions of the various types can be found at http://www.postfix.org/DATABASE_README.html.
The formula currently has a handful of different ways of configuring maps:
virtual_uid_maps: static:5000
This is handled as a regular parameter in main.cf
relay_recipient_maps: hash:/etc/postfix/relay_domains
There are multiple shortcomings of the current design.
Only a single parameter is supported per configuration item. Postfix has no trouble consulting multiple files per map item: e.g.
transport_maps = hash:/etc/postfix/transport, mysql:/etc/postfix/transports.cf
configured in main.cf would have postfix first try a lookup in the on-disk hashed file and if nothing found try a mysql query to a database. This is not supported by the formula.The VirtualUser related commits should probably never have been merged as is in the first place.
The first commit adding VirtualUser support is written in a very specific way that is probably only usable for a single site as it encodes too many assumptions about the SQL database layout in the formula. Furthermore, the transport pillar should not have been added at all but instead the regular mapping pillar should have been used.
The second commit repeats the mistake of the first commit by encoding site-specifics db schema assumptions in the SQL query and thus the formula.
Furthermore, creating a new pillar entry to replicate the same functionality as already exists is kinda useless as well.
A generic mapping configuration is not provided.
I am not sure however, how to do these changes without breaking backwards compatibility.
I am not really worried about the virtualuser changes to be honest as I consider them broken already: They are that limited that most likely nobody other than the original contributors are using them.
I am unclear however, how to best allow for multiple entries per lookup table without breaking existing configurations as shown in the pillar.example file:
Currently supported:
Future version, which might break backwards compatibility in case we cannot convert internally using jinja:
This would basically move the existing mapping entries one level down and add a dict keyed off the filename to separate these. Alternatively, instead of a dict we could use a list and key it off the position, mapping the main.cf entry with the mapping entry.
It might be possible to offer backwards compatibility for existing setups but I am not 100% sure.
Before I start off and actually do the work, I'd like some feedback about the viability. What do other committers think? Worth it? Not mergeable because it breaks backwards compat?
The text was updated successfully, but these errors were encountered: