Project

General

Profile

Actions

Bug #18965

closed

rgw: S3 v4 sign is not working with aws java sdk

Added by okwap okwap about 7 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
High
Assignee:
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

java sdk version: 1.11.91

The following code snippet returns 400 bad request (copy from http://docs.ceph.com/docs/master/radosgw/s3/java/)

package com.chttl.s3;

import com.amazonaws.ClientConfiguration;
import com.amazonaws.Protocol;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.Bucket;
import com.amazonaws.util.StringUtils;

import java.util.List;

public class S3Client {

    public static void main(String[] args) {

        AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);

        ClientConfiguration clientConfig = new ClientConfiguration();
        clientConfig.setProtocol(Protocol.HTTP);
        clientConfig.withSignerOverride("S3SignerType");
        AmazonS3 conn = new AmazonS3Client(credentials, clientConfig);
        conn.setEndpoint(endPoint);

        List<Bucket> buckets = conn.listBuckets();
        for (Bucket bucket : buckets) {
            System.out.println(bucket.getName() + "\t" +
                    StringUtils.fromDate(bucket.getCreationDate()));
        }
    }
}

error msg from packet sniffer

T 10.144.225.175:8080 -> 10.0.2.15:57450 [AP]
  HTTP/1.1 400 Bad Request..x-amz-request-id: tx000000000000000003c39-0058a66
  647-64d335-dev..Content-Length: 149..Accept-Ranges: bytes..Content-Type: ap
  plication/xml..Date: Fri, 17 Feb 2017 02:56:07 GMT..Connection: Keep-Alive.
  ...                                                                        
##
T 10.144.225.175:8080 -> 10.0.2.15:57450 [AP]
  <?xml version="1.0" encoding="UTF-8"?><Error><Code>InvalidArgument</Code><R
  equestId>tx000000000000000003c39-0058a66647-64d335-dev</RequestId></Error> 
###

Force the sdk using v2 sign is no problem.

Actions

Also available in: Atom PDF