Antonio Yang 楊伯安
2019年11月2-11月3日 中国·上海
COSCon ’ 2019
我只是一个开源软体的支持者
[1]
"Four Objects in a Diagonal Row" by byzantiumbooks is licensed under CC BY 2.0
"Bir Paragliding & Hiking 2017" by fredibach is licensed under CC BY 2.0
[2]
"The right fit" by Ian D. Keating is licensed under CC BY 2.0
For example ACL
<?xml version="1.0" encoding="UTF-8"?>
<AccessControlPolicy
xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Owner>
<ID>54bbddd7c9c485b696f5b188467d4bec889b83d3862d0a6db526d9d17aadcee2</ID>
<DisplayName>yanganto</DisplayName>
</Owner>
<AccessControlList>
<Grant>
<Grantee
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser">
<ID>Canonical-user-id</ID>
<DisplayName>yanganto</DisplayName>
</Grantee>
<Permission>FULL_CONTROL</Permission>
</Grant>
</AccessControlList>
</AccessControlPolicy>
PERMISSION: FULL_CONTROL, WRITE, WRITE_ACP,READ, READ_ACP
ACL can on Bucket or Object
[3]
Confidentiality → HTTPS, Access key
Security
Availability →
Redundant、Redirect
Integrity →
Message authentication code (MAC)
"Signatures and wax seals" by aehdeschaine is licensed under CC BY-ND 2.0
Authorization: Algorithm Access-Key:Signature
Algorithm: OSS、AWS
Signature: Base64(HMAC-SHA1( Secret-Key, UTF-8-Encoding-Of( StringToSign ) ) )
CanonicalizedSpecialHeaders: X-OSS-、X-AMZ-
StringToSign =
HTTP-Verb + "\n" +
Content-MD5 + "\n" +
Content-Type + "\n" +
Date + "\n" +
CanonicalizedSpecialHeaders +
CanonicalizedResource;
PUT
c8fdb181845a4ca6b8fec737b3581d76
text/html
Thu, 17 Nov 2005 18:49:58 GMT
x-oss-magic:abracadabra
x-oss-meta-author:foo@bar.com
/oss-example/nelso
Example :
OSS: RFC 822
Authorization: AWS4-HMAC-SHA256
Credential=ACCESS_KEY/20150830/us-east-1/s3/aws4_request, SignedHeaders=content-type;host;x-amz-date,
Signature= Hex(HMAC-SHA256(SigningKey, StringToSign ))
StringToSign =
HTTP-Verb + "\n" +
Canonical URI + "\n" +
Canonical Query String + "\n" +
Canonical Headers + "\n" +
Signed Headers + "\n" +
Hex(SHA256Hash(payload))
DateKey = HMAC-SHA256("AWS4 SecreteKey", "yyyymmdd" )
RegionKey = HMAC-SHA256(DateKey, "region" )
ServiceKey = HMAC-SHA256(RegionKey, "service" )
SigningKey = HMAC-SHA256(ServiceKey, "aws4_request" )
[4]
Multiple cluster share the same bucket namespace
Cluster Mirror
"Prism trials" by byzantiumbooks is licensed under CC BY 2.0
https://bucket.s3.region1.tw/the/key/of/some/obj
https://bucket.s3.region2.tw/the/key/of/some/obj
301 Move Permanently
URL 变动 → StringToSign 變動
Region 变动 → SignKey 變動
要重新产生一次signature
[5]
"Project Dance République" by Christophe Becker is licensed under CC BY-ND 2.0
"Server Icon" by David Yim is licensed under CC BY-NC-ND 4.0
https://s3.region1.tw/bucket/the/key/of/some/obj
https://bucket.s3.region1.tw/the/key/of/some/obj
23.20.0.0
DNS query
DNS query
23.20.1.1
23.20.1.1
Get data from
[6]
"Ein Haus aus LEGO Steinen" by koelnblogging.com is licensed under CC BY 2.0
1. POST /{Bucket}/{Key}?uploads
→ UploadId
2. PUT /{Bucket}/{Key}?uploadId=UploadId&partNumber=Partnumber
→ etag
3. POST /{Bucket}/{Key}?uploadId=UploadId
每一个 part 5 MB to 5 GB,用户端定义
GET /Key HTTP/1.1 Host: bucket.s3.awsamazone.com Range: bytes=0-1023
HTTP Range Header
Request
Response
HTTP/1.1 206 Partial Content
Content-Range: bytes 0-1023/146515
Content-Length: 1024
...
[7]
"Two men talking on a bench in Glasgow by the River Clyde" by CherryTherapies.com is licensed under CC BY 2.0
Access Key, Secrete Key
ACL
?
"paycheck" by owaief89 is licensed under CC BY-NC 2.0
https://{bucket}.s3.amazonaws.com/{key}?
X-Amz-Algorithm=AWS4-HMAC-SHA256&
X-Amz-Expires={second}&
X-Amz-Credential={AccessKey}{region}%2Fs3%2Faws4_request&
X-Amz-SignedHeaders=host&
X-Amz-Date={iso 8601 time string}&
X-Amz-Signature=xxxxxxx
https://{bucket}.s3.amazonaws.com/{key}?
AWSAccessKeyId={AccessKey}&
Expires={utc time stampe}&
Signature=xxxxxxxxxxx
StringToSign =
HTTP-Verb + "\n" +
Host + "\n" +
URI + "\n" +
QueryString
PUT
{bucket}.s3.amazonaws.com
/{key}
AWSAccessKeyId={AccessKey}Expires={utc time stamps}
Example :
https://{bucket}.s3.amazonaws.com/{key}?
AWSAccessKeyId={AccessKey}&
Expires={utc time stampe}&
Signature=xxxxxxxxxxx
StringToSign =
HTTP-Verb + "\n" +
Host + "\n" +
URI + "\n" +
QueryString
DateKey = HMAC-SHA256("AWS4 SecreteKey", "yyyymmdd" )
RegionKey = HMAC-SHA256(DateKey, "region" )
ServiceKey = HMAC-SHA256(RegionKey, "service" )
SigningKey = HMAC-SHA256(ServiceKey, "aws4_request" )
https://{bucket}.s3.amazonaws.com/{key}?
X-Amz-Algorithm=AWS4-HMAC-SHA256&
X-Amz-Expires={second}&
X-Amz-Credential={AccessKey}{region}%2Fs3%2Faws4_request&
X-Amz-SignedHeaders=host&
X-Amz-Date={iso 8601 time string}&
X-Amz-Signature=xxxxxxx
[8]
[[credential]]
s3_type = "ceph"
host = "10.1.13.98"
user = "admin"
access_key = "XXXXX"
secret_key = "XXXXX"
region = "us-east-1"
[9]
... ...
下班时间週末,心情好就写一点
心情不好也写一点