-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add AK/SK Certification for uploading snapshot to cloud #972
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #972 +/- ##
==========================================
+ Coverage 34.32% 34.61% +0.29%
==========================================
Files 89 92 +3
Lines 16608 16858 +250
==========================================
+ Hits 5700 5835 +135
- Misses 10096 10197 +101
- Partials 812 826 +14
|
Can you please attach the test report for this PR? |
@liuqinguestc I don't think your solution is correct when considering the identification when hotpot uploads snapshot to cloud through multi-cloud. IMO, signature should be generated in hotpot which will be passed to multi-cloud and identified in multi-cloud. |
@wisererik I just do as you said , I will delete some codes that do not need. |
Please add a release note. |
@@ -0,0 +1,189 @@ | |||
// Copyright 2019 The OpenSDS Authors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
client.go has the same feature code, please use that one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry,I can not use that, because the code is not same, and function is not the same.
@@ -0,0 +1,37 @@ | |||
// Copyright 2019 The OpenSDS Authors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fileter is used for api-server client, please remove this code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry,this is used for keystone.go, I can not remove this code.
@@ -101,3 +101,7 @@ | |||
go-tests = true | |||
non-go = true | |||
unused-packages = true | |||
|
|||
[[constraint]] | |||
name = "github.com/emicklei/go-restful" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need go-restfull lib?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just for getting signature. the code uses go-restful lib.
@@ -0,0 +1,61 @@ | |||
// Copyright 2019 The OpenSDS Authors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file is used by auth.go
"strings" | ||
|
||
"github.com/opensds/opensds/contrib/backup/multicloud/auth" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove blank line
@@ -56,4 +56,10 @@ const ( | |||
Read = "Read" | |||
Write = "Write" | |||
Execute = "Execute" | |||
|
|||
//Signature parameter name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these constants is only used for upload to snapshot to cloud, please move to contrib/backup/multi-cloud directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but as erik said. we should use public lib
@@ -66,8 +66,8 @@ | |||
version = "2.0.0" | |||
|
|||
[[constraint]] | |||
branch = "master" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this PR is too huge for a single commit. 16K+ lines of code, please split it up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
@@ -0,0 +1,37 @@ | |||
// Copyright 2019 The OpenSDS Authors. | |||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenSDS copyright missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is these lines written newly by us?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenSDS copyright missing
Its there in the line 1
@@ -0,0 +1,189 @@ | |||
// Copyright 2019 The OpenSDS Authors. | |||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copyright
|
||
const ( | ||
ConfFile = "/etc/opensds/driver/multi-cloud.yaml" | ||
DefaultUploadTimeout = 30 // in Seconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add to conf
|
||
func (k *Keystone) loadConf(p string) (*MultiCloudConf, error) { | ||
conf := &MultiCloudConf{ | ||
Endpoint: "http://127.0.0.1:8088", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
??
return nil, nil, err | ||
} | ||
|
||
requestDate := time.Now().UTC().Format("20060102") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are the dates and times hard-coded ?
// and a termination string ("sign_request") in lowercase characters. | ||
sign.credentialString, | ||
//Step 4: Append the hash of the canonical request created in Task 1 | ||
hex.EncodeToString(makeSha256([]byte(sign.canonicalString))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it secure to store in String ? in JAVA it is recommended to store in char[], since due to GC not being done, the value of the String variable can be seen by a memory profiler
func (sign *Signature) buildSignature() { | ||
// Step 1: Create the signing key, use the secret access key to create a series of | ||
// hash-based message authentication codes (HMACs). | ||
kSecret := sign.credValues.SecretAccessKey |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error handling ? in case any makeHMAC fails ?
// hash-based message authentication codes (HMACs). | ||
kSecret := sign.credValues.SecretAccessKey | ||
kDate := makeHmac([]byte("OPENSDS"+kSecret), []byte(sign.requestDate)) | ||
kRegion := makeHmac(kDate, []byte(sign.Region)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key and value not matching here, please check all
} | ||
|
||
// stripExcessSpaces will trim multiple side-by-side spaces. | ||
func stripExcessSpaces(vals []string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use strings.TrimSpace(s) ?
var canonicalURI string | ||
|
||
if len(url.Opaque) > 0 { | ||
canonicalURI = "/" + strings.Join(strings.Split(url.Opaque, "/")[3:], "/") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
significance of [3:] ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why 142 file changes for this?! Kindly update the points in the PR description as well.
@@ -66,8 +66,8 @@ | |||
version = "2.0.0" | |||
|
|||
[[constraint]] | |||
branch = "master" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
@@ -0,0 +1,37 @@ | |||
// Copyright 2019 The OpenSDS Authors. | |||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is these lines written newly by us?
@@ -0,0 +1,37 @@ | |||
// Copyright 2019 The OpenSDS Authors. | |||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenSDS copyright missing
Its there in the line 1
|
||
func (k *Keystone) loadConf(p string) (*MultiCloudConf, error) { | ||
conf := &MultiCloudConf{ | ||
Endpoint: "http://127.0.0.1:8088", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why hard-coded?
var r tokens.GetResult | ||
// The service token may be expired or revoked, so retry to get new token. | ||
err := utils.Retry(2, "verify token", false, func(retryIdx int, lastErr error) error { | ||
if retryIdx > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are you trying to do here. I see some confusion here!
What this PR does / why we need it:
add AK/SK Certification for uploading snapshot to cloud
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #Special notes for your reviewer:
Release note: