Skip to content

Commit ccd86d9

Browse files
ceph: fix SignatureDoesNotMatch by using correct secret key (#11115)
Ensure bucket.getSecretKey() is used when building the S3 client. Previously, only getAccessKey() was passed for both key and secret, causing V4 signature validation failures during operations such as bucket creation and policy updates. Co-authored-by: Jean Vetorello <[email protected]>
1 parent a84c4cb commit ccd86d9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

plugins/storage/object/ceph/src/main/java/org/apache/cloudstack/storage/datastore/driver/CephObjectStoreDriverImpl.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,19 +193,19 @@ public void setBucketPolicy(BucketTO bucket, String policy, long storeId) {
193193
policyConfig = "{\"Version\":\"2012-10-17\",\"Statement\":[]}";
194194
}
195195

196-
AmazonS3 client = getS3Client(getStoreURL(storeId), bucket.getAccessKey(), bucket.getAccessKey());
196+
AmazonS3 client = getS3Client(getStoreURL(storeId), bucket.getAccessKey(), bucket.getSecretKey());
197197
client.setBucketPolicy(new SetBucketPolicyRequest(bucket.getName(), policyConfig));
198198
}
199199

200200
@Override
201201
public BucketPolicy getBucketPolicy(BucketTO bucket, long storeId) {
202-
AmazonS3 client = getS3Client(getStoreURL(storeId), bucket.getAccessKey(), bucket.getAccessKey());
202+
AmazonS3 client = getS3Client(getStoreURL(storeId), bucket.getAccessKey(), bucket.getSecretKey());
203203
return client.getBucketPolicy(new GetBucketPolicyRequest(bucket.getName()));
204204
}
205205

206206
@Override
207207
public void deleteBucketPolicy(BucketTO bucket, long storeId) {
208-
AmazonS3 client = getS3Client(getStoreURL(storeId), bucket.getAccessKey(), bucket.getAccessKey());
208+
AmazonS3 client = getS3Client(getStoreURL(storeId), bucket.getAccessKey(), bucket.getSecretKey());
209209
client.deleteBucketPolicy(new DeleteBucketPolicyRequest(bucket.getName()));
210210
}
211211

@@ -255,7 +255,7 @@ public boolean deleteBucketEncryption(BucketTO bucket, long storeId) {
255255

256256
@Override
257257
public boolean setBucketVersioning(BucketTO bucket, long storeId) {
258-
AmazonS3 client = getS3Client(getStoreURL(storeId), bucket.getAccessKey(), bucket.getAccessKey());
258+
AmazonS3 client = getS3Client(getStoreURL(storeId), bucket.getAccessKey(), bucket.getSecretKey());
259259
try {
260260
BucketVersioningConfiguration configuration =
261261
new BucketVersioningConfiguration().withStatus("Enabled");
@@ -272,7 +272,7 @@ public boolean setBucketVersioning(BucketTO bucket, long storeId) {
272272

273273
@Override
274274
public boolean deleteBucketVersioning(BucketTO bucket, long storeId) {
275-
AmazonS3 client = getS3Client(getStoreURL(storeId), bucket.getAccessKey(), bucket.getAccessKey());
275+
AmazonS3 client = getS3Client(getStoreURL(storeId), bucket.getAccessKey(), bucket.getSecretKey());
276276
try {
277277
BucketVersioningConfiguration configuration =
278278
new BucketVersioningConfiguration().withStatus("Suspended");

0 commit comments

Comments
 (0)