Add a --yes
flag + checks to garage key import
#278
Labels
No labels
action
check-aws
action
discussion-needed
action
for-external-contributors
action
for-newcomers
action
more-info-needed
action
need-funding
action
triage-required
kind
correctness
kind
ideas
kind
improvement
kind
performance
kind
testing
kind
usability
kind
wrong-behavior
prio
critical
prio
low
scope
admin-api
scope
background-healing
scope
build
scope
documentation
scope
k8s
scope
layout
scope
metadata
scope
ops
scope
rpc
scope
s3-api
scope
security
scope
telemetry
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Deuxfleurs/garage#278
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?
We are thinking about deploying garage as our main S3 storage, we like idea about it a lot. we have found nice feature, which in most cases is good, but is a bit painfull in another.
Matching resources as
startsWith
is usually great, fe setting up cluster, where I can reference it by two characters. But when working with keys it comes with some problems.it would be nice if we can match the key ids
exact
, would make our lifes easier, something likegarage -c /etc/garage/spin.toml key info deb-prod-repo --exact-id-match
anyway guys, great work.
when using name instead keyId it works as expected, so we might stay with name now.
Thanks for your feedback, it is valuable to us!
I will rephrase your issue within our context and our assumptions, it will help you understand the current behavior of the CLI.
Early in Garage's development, we chose arbitrarily that access keys would be generated strings starting with
GK
followed by 12 random bytes encoded in hexadecimal. This is a choice similar to AWS but different from Minio that allow users to set the access key to whatever value they want.At this moment, we were also making some heavy refactors to the data model, one of them involved manually reimporting the keys, hence we introduced the
import
subcommand to reinject keys previously generated by Garage, but we did not expect that people would use it to create keys with a custom identifier.In the context of Garage, there is an advantage to use generated keys instead of user defined ones. As you may know, Garage tries to reduce synchronization in the cluster to avoid amplifying the existing latency between nodes. If 2 operators are creating a key with the same identifier from 2 different nodes more or less at the same time, the action will succeed from both sides, but later both identifiers will be merged and only one secret key will remain. However, if you rely on our randomly generated keys, and put names (aliases) on them, we overcome this problem: 2 different keys can have the same name on the cluster as long as their identifier is different.
As a conclusion, we never expected to match a key identifier that is not exactly 26 characters long, which is why we did not consider the case where one identifier is a substring of another one. In the end, we must know if we want to modify garage to officially supports custom key identifiers, and thus adapt our subcommands additionnaly to our matching logic, or we should disable it. Your issue raises multiple questions:
import
subcommand? Or hide it somewhere else?import
subcommand that key identifiers and secret keys follow a specific pattern (exactly 26 characters long, starting withGK
, etc.)I would recommend at least implementing the last point, checking the format of the identifier and secret. We might also discuss adding an hidden
--yes
or--force
flag displaying a message that this command is reserved for migrations and should not be used to add custom values.@kinovic: your second approach, by setting a
--name
, is the "correct" one. You can use these aliases on all other commands, for examplegarage bucket allow --read --key dupla my-bucket
. Please not that you also "leaked" the secret key ofdeb-prod-repo
. If you intend to use this cluster for production use, you should rotate this key.Improve way how to detect/select itemstogarage key import
is used to create custom key identifiers and lead to weird behaviorsthx for pointing out of leaked key, but this is pure development/testing (probably already wiped multiple of times).
for us/me import feature is nice and great in what we are doing, so having it would save us if we loose the cluster and need to rebuild, since read keys would be distributed on multiple places already.
in our flow, what we are doing right now we are OK only with new keys (randomly generated), because it is done only once and secrets are exported (future into some vault), they get distributed into our ci, developer machines etc. What would be a bit painfull is, if we loose cluster. In that case import would help us a lot, because we do not have to redistribute all the keys again.
IMHO:
yes, just document it. Like: it was designed to use GK(24chars) exactly and if you use something else there are some limitation. You cannot have key as substring of another otherwise it will lead to unexpected scenarios
please leave it somewhere
dude you are doing unsuported thing... It might and will lead into unexpected behavior
no, see above, just note that you are using this feature at own risk and might and will lead into unexpected behavior, even when you enforce some logic, you will hit problem with repeating keys, as I understand you cannot use deleted key anyway
After discussing with the other maintainers, we think the following changes would be the best tradeoff between guiding our users to the best practises while giving them some margin:
--yes
flag togarage key import
(here) similarly to the one ongarage migrate
(here)--yes
flag is not provided, similarly togarage migrate
command (here). Saying something in the error message like This command is intended to re-import keys that were previously generated by Garage. If you want to create a new key, use "garage key new" instead. Add the --yes flag if you really want to re-import a key.Let us know if you want to write a PR for this issue, otherwise we will put it in our backlog and write a patch in the coming weeks :-)
unfortunatelly I do not know about Rust a thing... So I cannot help :/ for me it would be totally new language to leard and right now I do have different priorities.
As I understand how it works now, I'm happy with current solution.
thx
to Add agarage key import
is used to create custom key identifiers and lead to weird behaviors--yes
flag + checks togarage key import
Added, will be merged in Garage v0.9