Files
cozystack/examples
Andrey Kolkov 35634080f4 fix(backups): sign Kafka S3 requests without curl --aws-sigv4
The Kafka topic-metadata strategy and the topic-data demo strategy move
their artifacts to and from S3 with the curl of the Strimzi image they
run in, signed by curl --aws-sigv4. The Strimzi 1.3.1-1 images carry
curl 7.76.1-43.el9, whose RHEL backport of the S3 payload handling
(0044-curl-7.76.1-aws-sigv4-s3-unsigned-payload.patch) adds
x-amz-content-sha256 to the canonical headers and to SignedHeaders but
never sends the header. SeaweedFS rejects every signed request, so both
backup Jobs fail with

    curl: (22) The requested URL returned error: 403

The 7.76.1-40.el9 curl of the Strimzi 1.2 images has a different
defect, a signed Host without the non-default port it sends, which the
--connect-to workaround covered.

Sign the request in the script with openssl and sha256sum, both in the
Strimzi image, and leave curl only the transport. Sending the missing
header from the script would not do: for an upload the -43 build signs
UNSIGNED-PAYLOAD and the -40 build the empty-body hash, so no single
value satisfies both, and a curl that is fixed to send the header would
then send it twice. With the Host signed as curl sends it, the
--connect-to workaround goes too.

The bats suites hold the signature to the one botocore 1.35.99
S3SigV4Auth computes for the same request at a fixed time. Against
SeaweedFS 4.45 on a non-default port, the metadata script's backup,
restore and cleanup and the demo strategy's upload and download pass
in both quay.io/strimzi/kafka:1.2.0-kafka-4.3.1 and
1.3.1-1-kafka-4.3.1, a key with a space and non-ASCII bytes included,
and a wrong secret still gets 403.

Assisted-by: LLM
Signed-off-by: Andrey Kolkov <androndo@gmail.com>
2026-11-20 20:18:32 +07:00
..