Skip to content
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

IPFS key rotate is tricky in docker environment #7714

Closed
markg85 opened this issue Oct 4, 2020 · 2 comments
Closed

IPFS key rotate is tricky in docker environment #7714

markg85 opened this issue Oct 4, 2020 · 2 comments

Comments

@markg85
Copy link
Contributor

markg85 commented Oct 4, 2020

Hi,

I'm now running ipfs 0.7.0 in a docker container to not be reliant on my distribution with regards to updates.
IPFS itself works really well in docker these days, hats of to all the awesome improvements in 0.7.0!

Next i wanted to rotate my key to the shiny new ed25519!
So i typed:
docker exec ipfs_host ipfs key rotate -o self -t ed25519

This gave the following error:

Error: ipfs daemon is running. please stop it to run this command
Use 'ipfs key rotate --help' for information about this command

What it asks there, execute a command without running ipfs, is really not easy to do in docker!
Yes, i can do it. Just starting a new container with a different entrypoint and making it interactive will give me a container where i can jump in do as the command asks.

This isn't very user friendly and requires a bit of hassle to get working.
It might be better for IPFS to "remember" that i want to execute that command and that IPFS runs it on it's own when IPFS restarts.
The error then should tell me something like: "Restart IPFS to apply these changes" or something alike. That would make it perfectly usable in docker environments.

Cheers,
Mark

@markg85 markg85 added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels Oct 4, 2020
@lidel lidel removed kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels Oct 9, 2020
@lidel
Copy link
Member

lidel commented Oct 9, 2020

Official docker images from https://hub.docker.com/r/ipfs/go-ipfs/tags/ supports passing arbitrary ipfs * subcomands, so you don't need to docker exec, you can stop the container and then do rotation in ephemeral container that is temporarily executing against volume that is mounted under /data/ipfs:

# given container named 'ipfs-test' persists repo at /path/to/persisted/.ipfs
$ docker run -d --name ipfs-test -v /path/to/persisted/.ipfs:/data/ipfs ipfs/go-ipfs:v0.7.0 
$ docker stop ipfs-test  

# key rotation works like this (old key saved under 'old-self')
$ docker run --rm -it -v /path/to/persisted/.ipfs:/data/ipfs ipfs/go-ipfs:v0.7.0 key rotate -o old-self -t ed25519
$ docker start ipfs-test # will start with new key

Hope this helps.

I'm closing this, as we discussed this during weekly triage, and introducing additional complexity to the codebase to support "pending config updates" is not worth it if the above viable solution exists.

@markg85
Copy link
Contributor Author

markg85 commented Oct 10, 2020

Well, that works indeed.
But it's cumbersome as you'd need to get the arguments right.

A "pending config updates" is more user friendly ;)

aschmahmann pushed a commit that referenced this issue Nov 10, 2020
* docs(readme): key rotation in docker
Adds notes from #7714 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants