Project

General

Profile

Actions

Bug #48236

open

rgw: fix auth when date is RFC-822/ISO 8601 standard timezone specification

Added by joke lee over 3 years ago. Updated over 3 years ago.

Status:
Fix Under Review
Priority:
Normal
Assignee:
-
Target version:
-
% Done:

0%

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

Description

in amazon s3, it is support date format with timezone

PUT /yuliyangwebsite/1G-16 HTTP/1.1
Host: s3.amazonaws.com
User-Agent: curl/7.61.1
Accept: */*
Authorization: AWS AKIAICWCTUYIEGGYI3UA:+pnFKZGxaCnksvxYMx8kLy3JTVA=
Date: Sat, 14 Nov 2020 12:30:21 +0800
Content-Type: text/plain
Content-Length: 7
Expect: 100-continue

< HTTP/1.1 100 Continue
  • We are completely uploaded and fine
    < HTTP/1.1 200 OK
    < x-amz-id-2: QAkMhjsNBT6kOiD8hg4jdpW7bVRUPJwnXbSvK+W4lb08EUFPiel8ymUzydCnvauBiZejttEN7yY=
    < x-amz-request-id: 5B145A81FD6E99B5
    < Date: Sat, 14 Nov 2020 04:30:23 GMT
    < ETag: "093f419dbfa58013cf010b6988a1161e"
    < Content-Length: 0
    < Server: AmazonS3

#!/usr/bin/env bash
KEY_ACCESS=""
KEY_SECRET=""
file="/root/1M"
content_type=`file --mime-type $file | awk '{print $2}'`
BUCKET="mybucket"
OBJECT="1M"
relativePath="/${BUCKET}/${OBJECT}"
#current=`TZ=GMT LANG=en_US date "+%a, %d %b %Y %H:%M:%S GMT"`
current=`date -R`
stringToSign="PUT\n\n$content_type\n${current}\n${relativePath}"
signature=`echo -en ${stringToSign} | openssl sha1 -hmac ${KEY_SECRET} -binary | base64`
HOST="s3.amazonaws.com"
curl -v -X PUT -T "${file}" \
-H "Authorization: AWS ${KEY_ACCESS}:${signature}" \
-H "Date: ${current}" \
-H "Host: ${HOST}" \
-H "Content-Type: $content_type" \
"http://${HOST}${relativePath}"

but in rgw ,when we set date with `date -R`, the rgw response 403 time skew

Actions #1

Updated by Casey Bodley over 3 years ago

  • Status changed from New to Fix Under Review
  • Backport set to nautilus octopus
  • Pull request ID set to 38075
Actions

Also available in: Atom PDF