[__opendkim_genkey] key's selector is the de-facto object id #20
Labels
No labels
bug
confirmed
critical
discussion
documentation
enhancement
feedback-required
good-first-issue
ready
reviewed
suggestion
support
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ungleich-public/cdist-contrib#20
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This is an issue because it makes common scenarios like using a different default key (with the
defaultselector) for different domains impossible.The selector becomes the de-facto object id because the key file path is defined as:
${DIRECTORY}${SELECTOR}.private(it's a tad worse because calls to the same object_id with different params are an error in cdist, while this situation wouldn't catch those, and instead each call will treat that file as if it were theirs)
A more sensible location would be:
${DIRECTORY}${__object_id}.privateFixing this requires some type-backwards compatibility in order not to break existing deployments.
An idea is fixing #19 by adding a
key-stateexplorer that returns the location and state of the key, and checks${DIRECTORY}${SELECTOR}.privatewhen${DIRECTORY}${__object_id}.privatedoes not exist.As a result, old deployments should keep working while new deployments should never be affected by this.
Cc: @sparrowhawk
@evilham that seems like a nice fix, I completely agree with your idea. I don't really have the time to fix this rn (unless the fix is needed for $work soon, which I don't think it will), but feel free to go ahead if you do :)
Also, pintsize \o/
@sparrowhawk have a fix for this and #19 mostly ready; got a bit of a doubt: do you think it's a terrible-idea-tm (and why? :-D) to default
--selectorto__object_id?It feels to me like the reason we have this inconsistency is because... Well, they usually match :-p.
It'd be a good time to simplify the type by making that parameter optional; what do you think?
Hmmm... Thing is, the unique identity of a key is the combination of domain/selector. So in effect, we can:
--selectorand--domainindependant--selectoroptional--domainoptionalLooking at our cdist infrastructure, I have a case of each of the latter x) I can't find an argument for one or the other, so I'd just say look at how you use it, and if in your usage you almost always default
selectortoobject_id, then go for making it optional with a default.TL;DR: I don't think it's a Terrible Idea (TM) ;)
I think you are totally right and both things make sense, so this seems like the most sensible thing to me:
--selectorand--domainare "optional" parameters for the type--selectorand--domainare absent and__object_idis in formDOMAIN/SELECTOR, we use those values andNormalized__object_id.private(*) for the key file name--selectorand--domainare absent and__object_idis not in formDOMAIN/SELECTOR, that's an informative error--selectoror--domainare absent, that's an informative error--selectorand--domainare used, that's what we use andNormalized__object_id(*) for the key file name(*) Where
Normalized__object_idmeans something likes!/!_!gon__object_idSo, I guess most of the time we could use
__opendkim_genkey DOMAIN/SELECTORand still consistently support other use-cases.Thoughts? :-)
Yep, awesome. If you have the time to implement this, I'll happily review and test it :)
Fixed by
ungleich-public/cdist-contrib@cc2b1af653