daemon: separate daemon ID from trust-key, and disable generating#43555
daemon: separate daemon ID from trust-key, and disable generating#43555thaJeztah merged 2 commits intomoby:masterfrom
Conversation
| } else if err != nil { | ||
| return "", errors.Wrapf(err, "error loading ID file %s", idPath) | ||
| } else { | ||
| id = string(idb) | ||
| } |
There was a problem hiding this comment.
FWIW, here I was wondering if we should perhaps still return the ID, even if we were not able to store it in the engine_id file; we don't need the ID for anything ourselves, so failing to persist the UUID to a file is not necessarily a hard failure (it would just be re-generated on restart).
|
Motivation for this is that I wanted to prevent having these files generated on new installs (creating the key also has been somewhat troublesome in the past w.r.t. permissions of the created directories and files); having the trust-key already separate from the daemon "ID" on fresh installs also prepares us for removing everything. |
|
Ah, booh. Looks like these tests expect the key to be generated; will have to adjust for that. |
116f61a to
5b82b87
Compare
| func (s *DockerDaemonSuite) TestDaemonKeyGeneration(c *testing.T) { | ||
| // TODO: skip or update for Windows daemon | ||
| os.Remove("/etc/docker/key.json") | ||
| c.Setenv("DOCKER_ALLOW_SCHEMA1_PUSH_DONOTUSE", "1") |
There was a problem hiding this comment.
Guess this should fix those failures 🤞
tianon
left a comment
There was a problem hiding this comment.
(I'd love to bike-shed on /var/lib/docker/engine_id, but I don't think doing so really helps here so I'll try to refrain 🙈❤️)
You mean the name of the file (or the location where it's stored?) I'm impartial to the name of the file (picked this one from the original in #39384) As to location; there was some discussion on that; keep it in |
This change is in preparation of deprecating support for old manifests.
Currently the daemon's ID is based on the trust-key ID, which will be
removed once we fully deprecate support for old manifests (the trust
key is currently only used in tests).
This patch:
- looks if a trust-key is present; if so, it migrates the trust-key
ID to the new "engine-id" file within the daemon's root.
- if no trust-key is present (so in case it's a "fresh" install), we
generate a UUID instead and use that as ID.
The migration is to prevent engines from getting a new ID on upgrades;
while we don't provide any guarantees on the engine's ID, users may
expect the ID to be "stable" (not change) between upgrades.
A test has been added, which can be ran with;
make DOCKER_GRAPHDRIVER=vfs TEST_FILTER='TestConfigDaemonID' test-integration
Signed-off-by: Sebastiaan van Stijn <[email protected]>
…s set The libtrust trust-key is only used for pushing legacy image manifests; pushing these images has been deprecated, and we only need to be able to push them in our CI. This patch disables generating the trust-key (and related paths) unless the DOCKER_ALLOW_SCHEMA1_PUSH_DONOTUSE env-var is set (which we do in our CI). Signed-off-by: Sebastiaan van Stijn <[email protected]>
5b82b87 to
070da63
Compare
|
Finished tiny bike-shed; changed |
|
Failure is unrelated ( |
|
I'll do a quick test PR to see what happens if we don't set the key at all |
I had a look at where the trustkey is used, and use of it is all the way to the https://github.com/docker/distribution code, and I don't have a clear view on where it can be removed (and what to replace it with). I might still have a look in a follow-up, but don't consider it the highest priority, so I'll get this one in |
daemon: separate daemon ID from trust-key
This change is in preparation of deprecating support for old manifests.
Currently the daemon's ID is based on the trust-key ID, which will be
removed once we fully deprecate support for old manifests (the trust
key is currently only used in tests).
This patch:
ID to the new "engine-id" file within the daemon's root.
generate a UUID instead and use that as ID.
The migration is to prevent engines from getting a new ID on upgrades;
while we don't provide any guarantees on the engine's ID, users may
expect the ID to be "stable" (not change) between upgrades.
A test has been added, which can be ran with;
daemon: only create trust-key if DOCKER_ALLOW_SCHEMA1_PUSH_DONOTUSE is set
The libtrust trust-key is only used for pushing legacy image manifests;
pushing these images has been deprecated, and we only need to be able
to push them in our CI.
This patch disables generating the trust-key (and related paths) unless
the DOCKER_ALLOW_SCHEMA1_PUSH_DONOTUSE env-var is set (which we do in
our CI).
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)