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

roachtest: rudimentary support for secure clusters #68101

Merged
merged 5 commits into from
Jul 29, 2021

Conversation

tbg
Copy link
Member

@tbg tbg commented Jul 27, 2021

TL;DR: roachtest can now start a secure cluster and c.Conn will "just work".

  • roachprod: improve impl of pgurl
  • roachtest: support using Conn() against secure clusters
  • roachtest: remove unused method from Cluster interface
  • roachtest: remove ad-hoc methods for secure clusters

@tbg tbg requested a review from a team as a code owner July 27, 2021 10:03
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@tbg tbg requested review from a team and stevendanna and removed request for a team July 27, 2021 10:03
Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

the changes to the ORM tests lgtm!

there is one more test that maybe needs to get standardized: connectionlatency

err = c.StartE(ctx, option.StartArgs("--secure"))

cc @RichardJCai you might be interested in reviewing this

Copy link
Collaborator

@stevendanna stevendanna left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 3 files at r1, 3 of 3 files at r2, 1 of 1 files at r3, 21 of 21 files at r4.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @tbg)

a discussion (no related file):
:lgtm:



pkg/cmd/roachtest/cluster.go, line 1759 at r2 (raw file):

			return err
		}
		// Need to prevent world readable files or lib/pq will complain.

It looks like Get explicitly adds world-readable permission to files after the investigation over in #44843

One interesting follow-up might be to extend Get to take a particular target permission, which would also eliminate the race to "fix" the permission after download.

@RichardJCai RichardJCai self-requested a review July 28, 2021 16:10
tbg added 5 commits July 29, 2021 15:29
Rather than manually cobbling together an url, use `url.URL`.

Also, add a `--certs-dir` parameter to `pgurl` that allows customizing
the location of the certs represented in the returned string.

Release note: None
roachtest does not offer real support for secure clusters. In light of
cockroachdb#65830 this needs to
change.

It will be a larger project to make this truly seamless. This is just
a first important step: roachtest, when starting a secure cluster, will
download the certs so that it can generate the proper SQL connection
string for use by `c.Conn`. Importantly, the test (mostly) doesn't
have to care whether it's operating against a secure cluster, as
long as it doesn't do anything fancy.

Parts of roachtest's artifact collection assumes an insecure cluster,
so artifacts will be degraded when the cluster is secure. The logs
will still be collected, though.

Release note: None
The impl on clusterImpl is still used, so it isn't removed yet.

Release note: None
A number of ad-hoc mechanisms for handling secure clusters was added a
while back for the node-postgres roachtest. Now that roachprod and
roachtest have rudimentary support for dealing with secure clusters,
we get to remove all of that.

I verified that node-postgres passes with this commit.

Release note: None
Now that `testuser` certs are created by `roachprod start --secure`
we need to update this test to stop doing it itself.

Release note: None
@tbg tbg force-pushed the roachtest-secure branch from 06ef089 to f5885df Compare July 29, 2021 14:01
@tbg tbg requested a review from a team as a code owner July 29, 2021 14:01
@tbg tbg requested a review from stevendanna July 29, 2021 14:56
Copy link
Member Author

@tbg tbg 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! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @stevendanna)

a discussion (no related file):

Previously, stevendanna (Steven Danna) wrote…

:lgtm:

TFTRs! I fixed up the connection_latency test, I just needed to remove the certs creation for testuser to get it to pass.



pkg/cmd/roachtest/cluster.go, line 1759 at r2 (raw file):

Previously, stevendanna (Steven Danna) wrote…

It looks like Get explicitly adds world-readable permission to files after the investigation over in #44843

One interesting follow-up might be to extend Get to take a particular target permission, which would also eliminate the race to "fix" the permission after download.

Going to leave as is for now, but adding an option to change the perms seems reasonable.

@tbg
Copy link
Member Author

tbg commented Jul 29, 2021

bors r=stevendanna,richardjcai

@craig
Copy link
Contributor

craig bot commented Jul 29, 2021

Build succeeded:

@craig craig bot merged commit 3ea1633 into cockroachdb:master Jul 29, 2021
erikgrinaker added a commit to erikgrinaker/cockroach that referenced this pull request Jul 30, 2021
In cockroachdb#68101, `roachtest` gained rudimentary support for using secure
clusters, including setting up local TLS client certificates. However,
these local certificates were not removed when a cluster was wiped and
reused, causing the client to fail with an authentication error when
attempting to contact the new insecure cluster (as seen in e.g. cockroachdb#68261).

This patch makes sure the local certificates are removed whenever
`roachtest` wipes a cluster.

Release note: None
erikgrinaker added a commit to erikgrinaker/cockroach that referenced this pull request Aug 2, 2021
In cockroachdb#68101, `roachtest` gained rudimentary support for using secure
clusters, including setting up local TLS client certificates. However,
these local certificates were not removed when a cluster was wiped and
reused, causing the client to fail with an authentication error when
attempting to contact the new insecure cluster (as seen in e.g. cockroachdb#68261).

This patch makes sure the local certificates are removed whenever
`roachtest` wipes a cluster.

Release note: None
erikgrinaker added a commit to erikgrinaker/cockroach that referenced this pull request Aug 2, 2021
In cockroachdb#68101, `roachtest` gained rudimentary support for using secure
clusters, including setting up local TLS client certificates. However,
these local certificates were not removed when a cluster was wiped and
reused, causing the client to fail with an authentication error when
attempting to contact the new insecure cluster (as seen in e.g. cockroachdb#68261).

This patch makes sure the local certificates are removed whenever
`roachtest` wipes a cluster.

Release note: None
craig bot pushed a commit that referenced this pull request Aug 2, 2021
68272: roachtest: add repro link to roachtest stress CI build r=stevendanna a=erikgrinaker

Release note: None

---

Unfortunately, there doesn't appear to be a way to get a link to the actual "Custom Build" form in TeamCity, so we have to provide instructions for people to manually click and fill in stuff. 😕 We could instead provide a `curl` command that would trigger a build with appropriate parameters via a REST API call, but that would require the user to set up API authentication tokens, so it's not clear that it's any more convenient. Ideas for improvements are welcome.

68279: roachtest: remove local TLS certs during cluster wipe r=stevendanna a=erikgrinaker

In #68101, `roachtest` gained rudimentary support for using secure
clusters, including setting up local TLS client certificates. However,
these local certificates were not removed when a cluster was wiped and
reused, causing the client to fail with an authentication error when
attempting to contact the new insecure cluster (as seen in e.g. #68261).

This patch makes sure the local certificates are removed whenever
`roachtest` wipes a cluster.

Resolves #68261.
Resolves #68264.

Release note: None

Co-authored-by: Erik Grinaker <[email protected]>
@tbg tbg deleted the roachtest-secure branch August 16, 2021 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants