rclone: Support of additional S3 checksums
What is your current rclone version (output from rclone version)?
v1.64.2
What problem are you are trying to solve?
AWS S3 supports saving additional object checksums in the object metadata. It supports checksums like SHA-1, SHA-256, CRC-32, and CRC-32C, that should be calculated by client side and be passed in the request header.
However, rclone doesn’t support this S3 functionality, what limits rclone usage if there are some requirements for having S3 checksums in the storage.
How do you think rclone should be changed to solve that?
rclone should support configuration of S3 backend that enables additional checksums calculation. Example of configuration:
[some-name]
type = s3
provider = AWS
...
additional_checksum_algorithm = SHA256 # or CRC32 or CRC32C or SHA1
or cli argument like:
rclone sync --s3-additional-checksum-algorithm=SHA256 ...
Setting extra_checksum_algorithm should cause computing checksum on client side with further passing to S3 PUT request headers. This can be achieved by setting parameter ChecksumAlgorithm while uploading object via PutObjectRequest.
NOTE: using S3 checksums for syncing data purposes is out of scope of this proposal.
If community doesn’t have objections for the proposed changes I’m ready to start working on this and open a PR.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 1
- Comments: 20 (13 by maintainers)
Commits related to this issue
- s3: implement alternate hashes - fixes #7445 FIXME WIP — committed to rclone/rclone by ncw 2 years ago
- s3: implement alternate hashes - fixes #7445 FIXME WIP — committed to op/rclone by ncw 2 years ago
~Does using the
x-amz-optional-object-attributesheader not work? I would think adding one ofx-amz-checksum-crc32,x-amz-checksum-crc32c,x-amz-checksum-sha1,x-amz-checksum-sha256or some other header here would work to have it return additional checksums values without a more expensive lookup, but I haven’t tested it, so I could be mistaken.~ NVM, RestoreStatus is the only valid value apparently ;-; https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html#API_ListObjectsV2_RequestSyntax@msemadi I think this is unrelated to this issue. However
trailing checksum is not supportedindicates the s3 server does not support trailing checksums. Not sure exactly what s3 server you are using but you need to tell the s3 client (again not sure which one) not to use trailing checksums. In rclone you’d setprovider = Otherin the config file. If you need more help, I suggest posting on the rclone forum about thisIf anyone would like to try a prototype of this, here it is
v1.69.0-beta.8419.bdf177718.fix-s3-hash on branch fix-s3-hash (uploaded in 15-30 mins)
This supports one additional hash using the
--s3-hashparameter.I haven’t figured out exactly how to check the hashes for multipart uploads, but in a recent annoucement AWS announced support for “full object” hashes on multipart uploads for certain hashes: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html so we could just check the full object hash on multipart upload. This will only work with some s3 providers though.
They also introduced a new hash CRC-64NVME which has become the recommended one, so perhaps we should support that too.