Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

SDI-2730: Add TLS capability to snap-cli #6

Merged
merged 6 commits into from
Aug 23, 2017

Conversation

candysmurf
Copy link
Collaborator

Summary of Changes

  • Added loading GRPC plugin TLS
  • Fixed watch task https issue

Test Done

  • manual snaptel

@candysmurf candysmurf force-pushed the ssl branch 10 times, most recently from e76a351 to b35cfe0 Compare August 3, 2017 17:28
README.md Outdated
#### Sample Use Cases

Here is a list of good and bad command use cases.
Copy link
Contributor

@IzabellaRaulin IzabellaRaulin Aug 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@candysmurf, could we change this section. My proposition is:

  • renaming that to ### Usage or ### Examples
  • change the table below to be more clear which options are provided by snapteld, which of them by snaptel.
  • start with successful scenario
  • add notice 1 that only GRPC plugins are supported and what happens when non-grpc plugin is tried to be loaded, what error msg will be returned; the goal is to provide to users only such information which will be enough to point them why they receive the error, but no more
  • add notice 2 that HTTPS is required + what happens when snapteld was started without HTTPS.
  • add notice 3 that there is no trusted CA and what error will be returned. Also, you can mention there about possibility of using "--insecure" flag which is dedicated only for testing purpose (please highlight that usage of this flag is not recommended).

That's all. I think it is quite what you have at the moment, but the order is different and sections should help users find information which they are looking for, so try to keep clearance.

README.md Outdated
```

> :collision: Urgh! The server was not started using HTTPs

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea to explain error messages. However please remove icons - they're unnecessary.
Please use straightforward messages:
What happened: the server was not started using HTTPs.

README.md Outdated
```

> :white_check_mark: using this setting to start `snapteld` for a seured GRPC plugin communication.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include a message highlighting that snapteld started successfully.

Please avoid using icons, they're unnecessary.

README.md Outdated
```

> :collision: Urgh! HTTPS does not have a trusted CA. There is no way to specify a CA using a flag for HTTPS currently. Putting the trusted CA in your OS trust store in production. Using --insecure flag for your testing convenience.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid using icons, they're unnecessary. Please review further places in this PR.

@@ -142,6 +149,10 @@ func getErrorDetail(err error, ctx *cli.Context) error {
case *tasks.UpdateTaskStateUnauthorized:
return newUsageError(fmt.Sprintf("%v", err.(*tasks.UpdateTaskStateUnauthorized).Payload.Message), ctx)
default:
// this is a hack
if strings.Contains(err.Error(), "tls: oversized record") || strings.Contains(err.Error(), "malformed HTTP response") {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such hacks should be avoided. Can't this error situation be generalized?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcintao, a good question. I'm not sure where this error comes from. If you know the place, please let me know. I'll see if we can classify it.

Copy link
Collaborator Author

@candysmurf candysmurf Aug 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcintao, if it's from third party lib, if we can catch the error somewhere, we may still be able to classify it. Not knowing where it comes from, it's hard.

README.md Outdated
```

##### Error One
Copy link
Contributor

@IzabellaRaulin IzabellaRaulin Aug 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks much better! Thank You. I am just thinking about the "error" section title and how to improve it. What do you think about adding sth like below:

Notice that only GRPC plugins are supported. There is also a requirement to use trusted CA and providing both plugin-cert and plugin-key. Below common error messages are presented that you might receive if one of those requirements are not fulfilled.

Case 1: Missing plugin key
Case 2: Using utrasted CA
Case 3: Trying to set TLS GRPC communication for non-GRPC plugin

Let me know what do you think about that. Thank You.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IzabellaRaulin, I love your version. Thanks for your suggestions. I'll make these changes.

@candysmurf
Copy link
Collaborator Author

@IzabellaRaulin: incorporated feedback.
@marcintao: added the default error response in REST API to address the hacking error situation. Please check the code change and PR submitted at snap

Both of you, please review. thanks.

@IzabellaRaulin IzabellaRaulin changed the title SDI-2730: Add SSL/TLC capability to snap-cli SDI-2730: Add TLS capability to snap-cli Aug 17, 2017
main.go Outdated
@@ -66,13 +73,30 @@ func beforeAction(ctx *cli.Context) error {
glog.Fatal(err)
}

c := client.NewHTTPClientWithConfig(nil, &client.TransportConfig{Host: u.Host, BasePath: snaptel.FlAPIVer.Value, Schemes: []string{u.Scheme}})
tlcOpts := tlsClientOptions{insecureSkipVerify: ctx.Bool("insecure")}
Copy link

@marcintao marcintao Aug 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename TLS-related variables to follow pattern: tlsOpts, tlsClient.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcintao, would you please let me know which variables you like me to change?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's tlcOpts and tlcClient, as far as I can grep.

Copy link

@marcintao marcintao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@IzabellaRaulin
Copy link
Contributor

Hello @candysmurf, I noticed that PR #8 has been already merged and that is the reason why your PR has a conflict in file snaptel/plugin.go. Are you ok to resolve it? If you have any problem, please contact to @mkleina.

@IzabellaRaulin IzabellaRaulin merged commit c64c6fb into intelsdi-x:master Aug 23, 2017
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.

3 participants