Skip to content
This repository was archived by the owner on Oct 12, 2026. It is now read-only.

Test presigned post - #543

Closed
tobias-urdin wants to merge 1 commit into
ceph:masterfrom
tobias-urdin:presigned-post
Closed

tobias-urdin wants to merge 1 commit into
ceph:masterfrom
tobias-urdin:presigned-post

Conversation

@tobias-urdin

Copy link
Copy Markdown
Contributor

This adds testing for presigned post

A bug here; this is not working for tenanted client and a tracker should be opened for that

This adds testing for presigned post

Signed-off-by: Tobias Urdin <[email protected]>
@tobias-urdin

Copy link
Copy Markdown
Contributor Author

Some more context, the reason it's not working with tenanted client is because we don't get the credentials for the request.

2024-02-05T16:25:42.396+0000 7fdd94b9c640  1 ====== starting new request req=0x7fdc82ef5660 =====
2024-02-05T16:25:42.396+0000 7fdd94b9c640  2 req 15546790978517646125 0.000000000s initializing for trans_id = tx00000d7c14c0647cabb2d-0065c10c06-114124-default
2024-02-05T16:25:42.396+0000 7fdd94b9c640 10 req 15546790978517646125 0.000000000s rgw api priority: s3=8 s3website=7
2024-02-05T16:25:42.396+0000 7fdd94b9c640 10 req 15546790978517646125 0.000000000s host=localhost
2024-02-05T16:25:42.396+0000 7fdd94b9c640 20 req 15546790978517646125 0.000000000s subdomain= domain= in_hosted_domain=0 in_hosted_domain_s3website=0
2024-02-05T16:25:42.396+0000 7fdd94b9c640 20 req 15546790978517646125 0.000000000s final domain/bucket subdomain= domain= in_hosted_domain=0 in_hosted_domain_s3website=0 s->info.domain= s->info.request_uri=/yournamehere-ii6n56xddr5jqkyi-1
2024-02-05T16:25:42.396+0000 7fdd94b9c640 20 req 15546790978517646125 0.000000000s get_handler handler=25RGWHandler_REST_Bucket_S3
2024-02-05T16:25:42.396+0000 7fdd94b9c640 10 req 15546790978517646125 0.000000000s handler=25RGWHandler_REST_Bucket_S3
2024-02-05T16:25:42.396+0000 7fdd94b9c640  2 req 15546790978517646125 0.000000000s getting op 4
2024-02-05T16:25:42.396+0000 7fdd94b9c640 10 req 15546790978517646125 0.000000000s cache get: name=default.rgw.log++script.prerequest. : hit (negative entry)
2024-02-05T16:25:42.396+0000 7fdd94b9c640 10 req 15546790978517646125 0.000000000s s3:post_obj scheduling with throttler client=2 cost=1
2024-02-05T16:25:42.396+0000 7fdd94b9c640 10 req 15546790978517646125 0.000000000s s3:post_obj op=22RGWPostObj_ObjStore_S3
2024-02-05T16:25:42.396+0000 7fdd94b9c640  2 req 15546790978517646125 0.000000000s s3:post_obj verifying requester
2024-02-05T16:25:42.396+0000 7fdd94b9c640 20 req 15546790978517646125 0.000000000s s3:post_obj rgw::auth::StrategyRegistry::s3_main_strategy_t: trying rgw::auth::s3::AWSAuthStrategy
2024-02-05T16:25:42.396+0000 7fdd94b9c640 20 req 15546790978517646125 0.000000000s s3:post_obj rgw::auth::s3::AWSAuthStrategy: trying rgw::auth::s3::S3AnonymousEngine
2024-02-05T16:25:42.396+0000 7fdd94b9c640 20 req 15546790978517646125 0.000000000s s3:post_obj rgw::auth::s3::S3AnonymousEngine granted access
2024-02-05T16:25:42.396+0000 7fdd94b9c640 20 req 15546790978517646125 0.000000000s s3:post_obj rgw::auth::s3::AWSAuthStrategy granted access
2024-02-05T16:25:42.396+0000 7fdd94b9c640  2 req 15546790978517646125 0.000000000s s3:post_obj normalizing buckets and tenants
2024-02-05T16:25:42.396+0000 7fdd94b9c640 10 req 15546790978517646125 0.000000000s s->object=<NULL> s->bucket=yournamehere-ii6n56xddr5jqkyi-1
2024-02-05T16:25:42.396+0000 7fdd94b9c640  2 req 15546790978517646125 0.000000000s s3:post_obj init permissions
2024-02-05T16:25:42.396+0000 7fdd94b9c640 10 req 15546790978517646125 0.000000000s s3:post_obj cache get: name=default.rgw.meta+root+yournamehere-ii6n56xddr5jqkyi-1 : miss
2024-02-05T16:25:42.396+0000 7fdd94b9c640 20 req 15546790978517646125 0.000000000s s3:post_obj rados->read ofs=0 len=0
2024-02-05T16:25:42.396+0000 7fdd94b9c640  1 -- 185.102.214.15:0/2533462145 --> [v2:185.102.214.15:6800/3854118963,v1:185.102.214.15:6801/3854118963] -- osd_op(unknown.0.0:10406 5.17 5:e8321e5d:root::yournamehere-ii6n56xddr5jqkyi-1:head [call version.read in=11b,read 0~0] snapc 0=[] ondisk+read+known_if_redirected+supports_pool_eio e223) v8 -- 0x563e0590c700 con 0x563dfcdd3600
2024-02-05T16:25:42.396+0000 7fddadbce640  1 -- 185.102.214.15:0/2533462145 <== osd.2 v2:185.102.214.15:6800/3854118963 2402 ==== osd_op_reply(10406 yournamehere-ii6n56xddr5jqkyi-1 [call,read 0~0] v0'0 uv0 ondisk = -2 ((2) No such file or directory)) v8 ==== 217+0+0 (crc 0 0 0) 0x563e044c0000 con 0x563dfcdd3600
2024-02-05T16:25:42.396+0000 7fdd8437b640 20 req 15546790978517646125 0.000000000s s3:post_obj rados_obj.operate() r=-2 bl.length=0
2024-02-05T16:25:42.396+0000 7fdd8437b640 10 req 15546790978517646125 0.000000000s s3:post_obj cache put: name=default.rgw.meta+root+yournamehere-ii6n56xddr5jqkyi-1 info.flags=0x0
2024-02-05T16:25:42.396+0000 7fdd8437b640 10 req 15546790978517646125 0.000000000s s3:post_obj adding default.rgw.meta+root+yournamehere-ii6n56xddr5jqkyi-1 to cache LRU end
2024-02-05T16:25:42.396+0000 7fdd8437b640 10 req 15546790978517646125 0.000000000s s3:post_obj init_permissions on :yournamehere-ii6n56xddr5jqkyi-1[]) failed, ret=-2002
2024-02-05T16:25:42.396+0000 7fdd8437b640  1 req 15546790978517646125 0.000000000s op->ERRORHANDLER: err_no=-2002 new_err_no=-2002
2024-02-05T16:25:42.396+0000 7fdd6e34f640 10 req 15546790978517646125 0.000000000s cache get: name=default.rgw.log++script.postrequest. : hit (negative entry)
2024-02-05T16:25:42.396+0000 7fdd6e34f640  2 req 15546790978517646125 0.000000000s s3:post_obj op status=0
2024-02-05T16:25:42.396+0000 7fdd6e34f640  2 req 15546790978517646125 0.000000000s s3:post_obj http status=404
2024-02-05T16:25:42.396+0000 7fdd6e34f640  1 ====== req done req=0x7fdc82ef5660 op status=0 http_status=404 latency=0.000000000s ======
2024-02-05T16:25:42.396+0000 7fdd6e34f640  1 beast: 0x7fdc82ef5660: 127.0.0.1 - anonymous [05/Feb/2024:16:25:42.396 +0000] "POST /yournamehere-ii6n56xddr5jqkyi-1 HTTP/1.1" 404 264 - "python-requests/2.31.0" - latency=0.000000000s

As indicated by this line:

2024-02-05T16:25:42.396+0000 7fdd94b9c640 10 req 15546790978517646125 0.000000000s s->object=<NULL> s->bucket=yournamehere-ii6n56xddr5jqkyi-1

generate_presigned_post() return this:

{'url': 'http://localhost:8000/yournamehere-qoxlxj3cmmty85rv-1', 'fields': {'key': 'foo', 'x-amz-algorithm': 'AWS4-HMAC-SHA256', 'x-amz-credential': 'HIJKLMNOPQRSTUVWXYZA/20240205/us-east-1/s3/aws4_request', 'x-amz-date': '20240205T163042Z', 'policy': 'eyJleHBpcmF0aW9uIjogIjIwMjQtMDItMDVUMTc6MzA6NDJaIiwgImNvbmRpdGlvbnMiOiBbeyJidWNrZXQiOiAieW91cm5hbWVoZXJlLXFveGx4ajNjbW10eTg1cnYtMSJ9LCB7ImtleSI6ICJmb28ifSwgeyJ4LWFtei1hbGdvcml0aG0iOiAiQVdTNC1ITUFDLVNIQTI1NiJ9LCB7IngtYW16LWNyZWRlbnRpYWwiOiAiSElKS0xNTk9QUVJTVFVWV1hZWkEvMjAyNDAyMDUvdXMtZWFzdC0xL3MzL2F3czRfcmVxdWVzdCJ9LCB7IngtYW16LWRhdGUiOiAiMjAyNDAyMDVUMTYzMDQyWiJ9XX0=', 'x-amz-signature': '313c3a852aa1f95d2cc1589569158fc2c65c0ed33c54636a2bb1d284555874e3'}}

And we pass the data in fields as query strings to url with requests.post(r['url'], data=r['fields'], files=...) but we don't seem to parse that authentication data for a POST (post_obj) request.

@tobias-urdin

Copy link
Copy Markdown
Contributor Author

superceeded by #544

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant