[__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…
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
default
selector) 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}.private
Fixing this requires some type-backwards compatibility in order not to break existing deployments.
An idea is fixing #19 by adding a
key-state
explorer that returns the location and state of the key, and checks${DIRECTORY}${SELECTOR}.private
when${DIRECTORY}${__object_id}.private
does 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
--selector
to__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:
--selector
and--domain
independant--selector
optional--domain
optionalLooking 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
selector
toobject_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:
--selector
and--domain
are "optional" parameters for the type--selector
and--domain
are absent and__object_id
is in formDOMAIN/SELECTOR
, we use those values andNormalized__object_id.private
(*) for the key file name--selector
and--domain
are absent and__object_id
is not in formDOMAIN/SELECTOR
, that's an informative error--selector
or--domain
are absent, that's an informative error--selector
and--domain
are used, that's what we use andNormalized__object_id
(*) for the key file name(*) Where
Normalized__object_id
means something likes!/!_!g
on__object_id
So, I guess most of the time we could use
__opendkim_genkey DOMAIN/SELECTOR
and 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
cc2b1af653