<div dir="ltr">Hi again,<div><br></div><div>Because was no answer to my questions then I have decided to choose and implement first scenario.</div><div><br></div><div>So now I need to review my patchsets by community:</div><div>1) <a href="https://review.openstack.org/#/c/211933/">https://review.openstack.org/#/c/211933/</a><br></div><div>This is patchset for swift3 with new unit tests. It implements checking of headers of signature v4 auth and preparation string to pass it to keystone.</div><div>2) <a href="https://review.openstack.org/#/c/215481/">https://review.openstack.org/#/c/215481/</a></div><div>This is patchset for keystone. It implements signature v4 calculation and comparison with provided one.</div><div>3) <a href="https://review.openstack.org/#/c/215325/">https://review.openstack.org/#/c/215325/</a></div><div>This is patchset for devstack. It implements setting of region for checking in swift3.</div><div><br></div><div>All new code is written in previous architecture style.</div><div>So please review these patchsets.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 17, 2015 at 3:52 PM, Andrey Pavlov <span dir="ltr"><<a href="mailto:andrey.mp@gmail.com" target="_blank">andrey.mp@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I'm trying to support AWS signature version 4 for S3 requests.</div><div>Related bugs:[1] for keystonemiddleware and [2] for swift3:</div><div><br></div><div>Also keystone doesn't have support for V4 signature verification for S3 (but it supports V4 for EC2 requests).</div><div><br></div><div>Differences between V1 and V4 can be found here - V1: [3] and V4: [4].</div><div><div>(Signature verification has several differences for EC2 and S3 requests) </div><div><br></div><div><div>My question is - how to implement V4 signature verification?</div><div>I have several scenarios:</div><div>1) Leave current architecture. Swift3 will parse authorization info, will calculate StringToSign, will place it in 'X-Auth-Token'</div><div>and place some additional header with signature version info. s3token will provide these values to keystone. keystone will</div><div>calculate signature with V4 algorithm and check it.</div><div>2) Same as first but without s3token - swift3 will send all info to keystone itself.</div><div>3) Same as first but most authorization headers will be parsed by s3token and s3token will send to keystone.</div><div><br></div><div>I prefer first scenario.</div></div><div><div>But what think keystone team?<br></div></div><div><br></div><div><br></div><div>Current implementation of S3 signature V1 verificatoin has several oddities for me:</div><div><br></div><div>First oddity for me is in implementation of EC2 and S3 verification in keystone -</div><div>ec2tokens (in keystone) takes all request parameters, calculates all that it needs, and checks</div><div>calculated signature with user provided (Because only keystone can securely access secret_key</div><div>by provided access_key). But signature calculation code is placed in keystoneclient...</div><div>But s3tokens takes strange 'token' attribute (that calculated outside of keystone), access_key and signature.</div><div>Then keystone hash token with secret_key (that was obtained from DB by access_key) and checks this result</div><div>with provided signature.</div><div>Oddity for me is in different algorithms for similar essences.</div><div><br></div><div>Next oddity is in swift pipeline for S3 requests -</div><div>at 'first' request with S3 params recognized by swift3 plugin. It checks authorization information,</div><div>validates S3 parameters, calculates StringToSign as it described in [3] and places it in 'X-Auth-Token' header.</div><div>at next step s3token from keystonemiddleware takes X-Auth-Token (that is a StringToSign) from header, </div><div>sends it to keystone to check authorization.</div><div>Oddity for me is in s3token that doesn't parse authorization information unlike ec2token from keystonemiddleware.</div><div><br></div><div><div>[1] <a href="https://bugs.launchpad.net/keystonemiddleware/+bug/1473042" target="_blank">https://bugs.launchpad.net/keystonemiddleware/+bug/1473042</a></div><div>[2] <a href="https://bugs.launchpad.net/swift3/+bug/1411078" target="_blank">https://bugs.launchpad.net/swift3/+bug/1411078</a></div></div><div>[3] <a href="http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html" target="_blank">http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html</a> </div><div>[4] <a href="http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html" target="_blank">http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html</a></div><span class="HOEnZb"><font color="#888888"><div><br></div><div>-- <br></div><div><div dir="ltr">Kind regards,<div>Andrey Pavlov.</div></div></div>
</font></span></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Kind regards,<div>Andrey Pavlov.</div></div></div>
</div>