Skip to content

Commit 0ce5c01

Browse files
authored
Merge pull request bottlerocket-os#711 from koooosh/add-dockerv29-pkgs
Add Docker v29 packages
2 parents 58f36b6 + 095ad8f commit 0ce5c01

33 files changed

+734
-12
lines changed

Cargo.lock

Lines changed: 23 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ members = [
2020
"packages/coreutils",
2121
"packages/libcryptsetup",
2222
"packages/dbus-broker",
23-
"packages/docker-cli",
24-
"packages/docker-engine",
23+
"packages/docker-cli-25",
24+
"packages/docker-cli-29",
25+
"packages/docker-engine-25",
26+
"packages/docker-engine-29",
2527
"packages/docker-init",
2628
"packages/e2fsprogs",
2729
"packages/early-boot-config",

kits/bottlerocket-core-kit/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ containerd-2_0 = { path = "../../packages/containerd-2.0" }
2929
containerd-2_1 = { path = "../../packages/containerd-2.1" }
3030
coreutils = { path = "../../packages/coreutils" }
3131
dbus-broker = { path = "../../packages/dbus-broker" }
32-
docker-cli = { path = "../../packages/docker-cli" }
33-
docker-engine = { path = "../../packages/docker-engine" }
32+
docker-cli-25 = { path = "../../packages/docker-cli-25" }
33+
docker-cli-29 = { path = "../../packages/docker-cli-29" }
34+
docker-engine-25 = { path = "../../packages/docker-engine-25" }
35+
docker-engine-29 = { path = "../../packages/docker-engine-29" }
3436
docker-init = { path = "../../packages/docker-init" }
3537
e2fsprogs = { path = "../../packages/e2fsprogs" }
3638
early-boot-config = { path = "../../packages/early-boot-config" }

packages/docker-cli/Cargo.toml renamed to packages/docker-cli-25/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "docker-cli"
2+
name = "docker-cli-25"
33
version = "0.1.0"
44
edition = "2021"
55
publish = false
File renamed without changes.

packages/docker-cli/docker-cli.spec renamed to packages/docker-cli-25/docker-cli-25.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
%global _dwz_low_mem_die_limit 0
1212

13-
Name: %{_cross_os}docker-%{gorepo}
13+
%global package_priority_epoch 1
14+
15+
Name: %{_cross_os}docker-%{gorepo}-25
1416
Version: %{rpmver}
1517
Release: 1%{?dist}
1618
Summary: Docker CLI
@@ -23,6 +25,9 @@ BuildRequires: git
2325
BuildRequires: %{_cross_os}glibc-devel
2426
Requires: %{name}(binaries)
2527

28+
Provides: %{_cross_os}docker-%{gorepo} = %{package_priority_epoch}:
29+
Conflicts: %{_cross_os}docker-%{gorepo}
30+
2631
%description
2732
%{summary}.
2833

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
From c85efebc0c9321fecc536485b47857dbcbe34ddf Mon Sep 17 00:00:00 2001
2+
From: Sebastiaan van Stijn <[email protected]>
3+
Date: Wed, 12 Jul 2023 15:07:59 +0200
4+
Subject: [PATCH 1/2] pkg/plugins: use a dummy hostname for local connections
5+
6+
For local communications (npipe://, unix://), the hostname is not used,
7+
but we need valid and meaningful hostname.
8+
9+
The current code used the socket path as hostname, which gets rejected by
10+
go1.20.6 and go1.19.11 because of a security fix for [CVE-2023-29406 ][1],
11+
which was implemented in https://go.dev/issue/60374.
12+
13+
Prior versions go Go would clean the host header, and strip slashes in the
14+
process, but go1.20.6 and go1.19.11 no longer do, and reject the host
15+
header.
16+
17+
Before this patch, tests would fail on go1.20.6:
18+
19+
=== FAIL: pkg/authorization TestAuthZRequestPlugin (15.01s)
20+
time="2023-07-12T12:53:45Z" level=warning msg="Unable to connect to plugin: //tmp/authz2422457390/authz-test-plugin.sock/AuthZPlugin.AuthZReq: Post \"http://%2F%2Ftmp%2Fauthz2422457390%2Fauthz-test-plugin.sock/AuthZPlugin.AuthZReq\": http: invalid Host header, retrying in 1s"
21+
time="2023-07-12T12:53:46Z" level=warning msg="Unable to connect to plugin: //tmp/authz2422457390/authz-test-plugin.sock/AuthZPlugin.AuthZReq: Post \"http://%2F%2Ftmp%2Fauthz2422457390%2Fauthz-test-plugin.sock/AuthZPlugin.AuthZReq\": http: invalid Host header, retrying in 2s"
22+
time="2023-07-12T12:53:48Z" level=warning msg="Unable to connect to plugin: //tmp/authz2422457390/authz-test-plugin.sock/AuthZPlugin.AuthZReq: Post \"http://%2F%2Ftmp%2Fauthz2422457390%2Fauthz-test-plugin.sock/AuthZPlugin.AuthZReq\": http: invalid Host header, retrying in 4s"
23+
time="2023-07-12T12:53:52Z" level=warning msg="Unable to connect to plugin: //tmp/authz2422457390/authz-test-plugin.sock/AuthZPlugin.AuthZReq: Post \"http://%2F%2Ftmp%2Fauthz2422457390%2Fauthz-test-plugin.sock/AuthZPlugin.AuthZReq\": http: invalid Host header, retrying in 8s"
24+
authz_unix_test.go:82: Failed to authorize request Post "http://%2F%2Ftmp%2Fauthz2422457390%2Fauthz-test-plugin.sock/AuthZPlugin.AuthZReq": http: invalid Host header
25+
26+
[1]: https://github.com/advisories/GHSA-f8f7-69v5-w4vx
27+
28+
Signed-off-by: Sebastiaan van Stijn <[email protected]>
29+
30+
---
31+
.../github.com/docker/docker/client/client.go | 30 +++++++++++++++++++
32+
.../github.com/docker/docker/client/hijack.go | 6 +++-
33+
.../docker/docker/client/request.go | 10 +++----
34+
3 files changed, 39 insertions(+), 7 deletions(-)
35+
36+
diff --git a/vendor/github.com/docker/docker/client/client.go b/vendor/github.com/docker/docker/client/client.go
37+
index 9b2b2eaeb8..5bf699d88d 100644
38+
--- a/vendor/github.com/docker/docker/client/client.go
39+
+++ b/vendor/github.com/docker/docker/client/client.go
40+
@@ -57,6 +57,36 @@ import (
41+
"github.com/pkg/errors"
42+
)
43+
44+
+// DummyHost is a hostname used for local communication.
45+
+//
46+
+// It acts as a valid formatted hostname for local connections (such as "unix://"
47+
+// or "npipe://") which do not require a hostname. It should never be resolved,
48+
+// but uses the special-purpose ".localhost" TLD (as defined in [RFC 2606, Section 2]
49+
+// and [RFC 6761, Section 6.3]).
50+
+//
51+
+// [RFC 7230, Section 5.4] defines that an empty header must be used for such
52+
+// cases:
53+
+//
54+
+// If the authority component is missing or undefined for the target URI,
55+
+// then a client MUST send a Host header field with an empty field-value.
56+
+//
57+
+// However, [Go stdlib] enforces the semantics of HTTP(S) over TCP, does not
58+
+// allow an empty header to be used, and requires req.URL.Scheme to be either
59+
+// "http" or "https".
60+
+//
61+
+// For further details, refer to:
62+
+//
63+
+// - https://github.com/docker/engine-api/issues/189
64+
+// - https://github.com/golang/go/issues/13624
65+
+// - https://github.com/golang/go/issues/61076
66+
+// - https://github.com/moby/moby/issues/45935
67+
+//
68+
+// [RFC 2606, Section 2]: https://www.rfc-editor.org/rfc/rfc2606.html#section-2
69+
+// [RFC 6761, Section 6.3]: https://www.rfc-editor.org/rfc/rfc6761#section-6.3
70+
+// [RFC 7230, Section 5.4]: https://datatracker.ietf.org/doc/html/rfc7230#section-5.4
71+
+// [Go stdlib]: https://github.com/golang/go/blob/6244b1946bc2101b01955468f1be502dbadd6807/src/net/http/transport.go#L558-L569
72+
+const DummyHost = "api.moby.localhost"
73+
+
74+
// ErrRedirect is the error returned by checkRedirect when the request is non-GET.
75+
var ErrRedirect = errors.New("unexpected redirect in response")
76+
77+
diff --git a/vendor/github.com/docker/docker/client/hijack.go b/vendor/github.com/docker/docker/client/hijack.go
78+
index e1dc49ef0f..b8fac0be7e 100644
79+
--- a/vendor/github.com/docker/docker/client/hijack.go
80+
+++ b/vendor/github.com/docker/docker/client/hijack.go
81+
@@ -62,7 +62,11 @@ func fallbackDial(proto, addr string, tlsConfig *tls.Config) (net.Conn, error) {
82+
}
83+
84+
func (cli *Client) setupHijackConn(ctx context.Context, req *http.Request, proto string) (net.Conn, error) {
85+
- req.Host = cli.addr
86+
+ req.URL.Host = cli.addr
87+
+ if cli.proto == "unix" || cli.proto == "npipe" {
88+
+ // Override host header for non-tcp connections.
89+
+ req.Host = DummyHost
90+
+ }
91+
req.Header.Set("Connection", "Upgrade")
92+
req.Header.Set("Upgrade", proto)
93+
94+
diff --git a/vendor/github.com/docker/docker/client/request.go b/vendor/github.com/docker/docker/client/request.go
95+
index 7f54b1dd80..3fc99056d0 100644
96+
--- a/vendor/github.com/docker/docker/client/request.go
97+
+++ b/vendor/github.com/docker/docker/client/request.go
98+
@@ -89,16 +89,14 @@ func (cli *Client) buildRequest(method, path string, body io.Reader, headers hea
99+
return nil, err
100+
}
101+
req = cli.addHeaders(req, headers)
102+
+ req.URL.Scheme = cli.scheme
103+
+ req.URL.Host = cli.addr
104+
105+
if cli.proto == "unix" || cli.proto == "npipe" {
106+
- // For local communications, it doesn't matter what the host is. We just
107+
- // need a valid and meaningful host name. (See #189)
108+
- req.Host = "docker"
109+
+ // Override host header for non-tcp connections.
110+
+ req.Host = DummyHost
111+
}
112+
113+
- req.URL.Host = cli.addr
114+
- req.URL.Scheme = cli.scheme
115+
-
116+
if expectedPayload && req.Header.Get("Content-Type") == "" {
117+
req.Header.Set("Content-Type", "text/plain")
118+
}
119+
--
120+
2.34.1
121+

packages/docker-cli-29/Cargo.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[package]
2+
name = "docker-cli-29"
3+
version = "0.1.0"
4+
edition = "2021"
5+
publish = false
6+
build = "../build.rs"
7+
8+
[lib]
9+
path = "../packages.rs"
10+
11+
[package.metadata.build-package]
12+
releases-url = "https://github.com/docker/cli/releases"
13+
14+
[[package.metadata.build-package.external-files]]
15+
url = "https://github.com/docker/cli/archive/v29.0.0-rc.2/cli-29.0.0-rc.2.tar.gz"
16+
sha512 = "4194a8916c65873d85af1917873bf642b2d03fa2ea4ec0dced2471e9d93ed7963d7efc786cc44bfeecc0c05233fc55839ed675ba777fa0a73d6964f8a4fa7f92"
17+
18+
[build-dependencies]
19+
glibc = { path = "../glibc" }
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[clarify."github.com/docker/licensing"]
2+
expression = "Apache-2.0"
3+
license-files = [
4+
{ path = "LICENSE", hash = 0xd2f64213 },
5+
]
6+
skip-files = ["license.go", "model/license.go"]
7+
8+
[clarify."sigs.k8s.io/yaml"]
9+
expression = "MIT AND BSD-3-Clause"
10+
license-files = [
11+
{ path = "LICENSE", hash = 0xcdf3ae00},
12+
]

0 commit comments

Comments
 (0)