Skip to content
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 TLS support to increment command #3257

Merged
merged 9 commits into from
Apr 9, 2019
Merged

Conversation

codexnull
Copy link
Contributor

@codexnull codexnull commented Apr 5, 2019

Change summary:

  • Change --addr option to --dgraph to match the other commands.
  • Support --tls_* options instead of ignoring them.
  • Use x.SetupConnection() instead of grpc.Dial() to add TLS support.

This change is Reviewable

@codexnull codexnull requested a review from a team April 5, 2019 00:52
Copy link
Contributor

@martinmr martinmr left a comment

Choose a reason for hiding this comment

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

Reviewed 6 of 6 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @codexnull)


x/tls_helper.go, line 60 at r1 (raw file):

	flag.Bool("tls_use_system_ca", true, "Include System CA into CA Certs.")
	flag.String("tls_server_name", "", "Used to verify the server hostname.")
	flag.String("tls_cert", "", "(optional) The Cert file provided by the client to the server.")

The documentation for these flags should probably state that they are required if tls_cacert is specified or something to similar effect.

Copy link
Contributor Author

@codexnull codexnull left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @martinmr)


x/tls_helper.go, line 60 at r1 (raw file):

Previously, martinmr (Martin Martinez Rivera) wrote…
	flag.Bool("tls_use_system_ca", true, "Include System CA into CA Certs.")
	flag.String("tls_server_name", "", "Used to verify the server hostname.")
	flag.String("tls_cert", "", "(optional) The Cert file provided by the client to the server.")

The documentation for these flags should probably state that they are required if tls_cacert is specified or something to similar effect.

Only --tls_cacert is required to enable TLS. The rest of the --tls_* options are optional. I'm planning on making this more clear for all dgraph commands in a separate PR.

Copy link
Contributor

@martinmr martinmr left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

Copy link
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

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

One comment, I strongly think we should keep the current addr flag. Will leave it to @martinmr for final approval.

Reviewed 6 of 6 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @codexnull)


dgraph/cmd/counter/increment.go, line 49 at r1 (raw file):

	flag := Increment.Cmd.Flags()
	flag.String("dgraph", "localhost:9080", "Address of Dgraph alpha.")

The command would be: dgraph increment --dgraph? I think --addr is a better argument.

Copy link
Contributor Author

@codexnull codexnull left a comment

Choose a reason for hiding this comment

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

Reviewable status: 5 of 6 files reviewed, 1 unresolved discussion (waiting on @manishrjain and @martinmr)


dgraph/cmd/counter/increment.go, line 49 at r1 (raw file):

Previously, manishrjain (Manish R Jain) wrote…

The command would be: dgraph increment --dgraph? I think --addr is a better argument.

Reverted back to --addr.

@codexnull
Copy link
Contributor Author

You're right, it doesn't look good, but I was trying to be consistent with other commands. We already have dgraph live --dgraph and dgraph acl --dgraph. Maybe we should change all of these to --alpha instead? It would also help distinguish which of the two types of dgraph services you're connecting to.

@manishrjain
Copy link
Contributor

--alpha would make sense. Forgot that dgraph live is using --dgraph as a flag. This might be coming from the time when live loader used to be a separate binary. Yeah, should be renamed.

@codexnull codexnull merged commit f0e1af5 into master Apr 9, 2019
@codexnull codexnull deleted the javier/tls_increment branch April 9, 2019 15:31
mangalaman93 pushed a commit that referenced this pull request Apr 10, 2019
* Fix dgraph increment options.

* Show error if TLS options are incomplete.

* Use TLS connection with dgraph increment if requested.

* Replace hard-coded alpha port in tests with z.SockAddr.

* Remove unnecessary comment.
dna2github pushed a commit to dna2fork/dgraph that referenced this pull request Jul 19, 2019
* Fix dgraph increment options.

* Show error if TLS options are incomplete.

* Use TLS connection with dgraph increment if requested.

* Replace hard-coded alpha port in tests with z.SockAddr.

* Remove unnecessary comment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants