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 secure option for "Build an App" #631

Closed
dianasaur323 opened this issue Sep 7, 2016 · 9 comments
Closed

Add secure option for "Build an App" #631

dianasaur323 opened this issue Sep 7, 2016 · 9 comments
Assignees
Labels
O-external Origin: Issue comes from external users. T-missing-info T-more-examples-needed
Milestone

Comments

@dianasaur323
Copy link
Contributor

dianasaur323 commented Sep 7, 2016

Current "Build a Test App" tutorial assumes insecure clusters. Add in an option for secure clusters.

conn = psycopg2.connect(database='bank',user='maxroach',host='localhost',port=26257, sslmode='require', sslrootcert='certs/ca.cert', sslcert='certs/maxroach.cert', sslkey='certs/maxroach.key')

@mberhault
Copy link
Contributor

There are a few steps here, for each example:

  • determine how the listed library accepts certs/keys. parameter names, file formats etc..
  • when file formats differ, document how to convert our certs/keys to the expected format
  • consider having the cockroach cert tools generate other formats.

@mberhault mberhault changed the title Add in secure option for "Build a Test App" Add secure option for "Build a Test App" Mar 22, 2017
@jseldess jseldess added this to the 1.0 milestone May 13, 2017
@jseldess jseldess added the O-external Origin: Issue comes from external users. label Jun 12, 2017
@jseldess jseldess modified the milestones: 1.1, 1.0 Jun 13, 2017
@jseldess jseldess modified the milestones: 1.1, 1.0 Jun 28, 2017
@jseldess jseldess modified the milestones: 1.1, 1.2 Nov 8, 2017
@jseldess jseldess modified the milestones: 2.0, 2.1 Feb 6, 2018
@knz
Copy link
Contributor

knz commented Feb 6, 2018

A user shared a working node.js example on the forum: https://forum.cockroachlabs.com/t/basic-example-in-secure-mode/1339/6?u=knz

@jseldess
Copy link
Contributor

From #2089:

Here is a quick secure example for PHP if needed.

Current insecure example:

$dbh = new PDO('pgsql:host=localhost;port=26257;dbname=bank;sslmode=disable',
    'maxroach', null, array(
      PDO::ATTR_ERRMODE          => PDO::ERRMODE_EXCEPTION,
      PDO::ATTR_EMULATE_PREPARES => true,
  ));

Secure example:

$dbh = new PDO('pgsql:localhost=host;port=26257;dbname=bank;sslmode=require;sslcert=[path]/client.maxroach.crt;sslkey=[path]/client.maxroach.key;sslrootcert=[path]/ca.crt;',
    'maxroach', null, array(
      PDO::ATTR_ERRMODE          => PDO::ERRMODE_EXCEPTION,
      PDO::ATTR_EMULATE_PREPARES => true,
  ));

@jseldess jseldess changed the title Add secure option for "Build a Test App" Add secure option for "Build an App" Feb 25, 2018
@jseldess
Copy link
Contributor

@mberhault
Copy link
Contributor

Ping on this: java is particularly tricky and could use an example. See cockroachdb/cockroach#24487

@jseldess
Copy link
Contributor

jseldess commented Apr 5, 2018

Thanks, @mberhault. @awoods187, let's talk about prioritizing this as a docs/eng project for 2.1, perhaps focusing just on jdbc and hibernate.

@jseldess
Copy link
Contributor

For 2.1, part of #2943.

@tim-o
Copy link
Contributor

tim-o commented May 17, 2018

As part of this document, suggest we provide a link to an overview of certificates & how SSL works. My sense is that this is in part a user education effort.

rmloveland added a commit that referenced this issue Jun 12, 2018
Addresses #631

Summary of changes:

- Update code samples for the following languages/ORMs to connect to
  secure local cluster using certs:

  - Java JDBC
  - Java Hibernate
  - Ruby pg
  - Ruby ActiveRecord
  - Python psycopg2
  - Python SQLAlchemy
  - Node.js pg

- Update cluster startup instructions for the above languages to use
  secure practices

- Create a new versioned include directory for 2.1 docs, which holds all
  secure code and cluster setup instructions
rmloveland added a commit that referenced this issue Jun 21, 2018
Addresses #631

Summary of changes:

- Update code samples for the following languages/ORMs to connect to
  secure local cluster using certs:

  - Java JDBC
  - Java Hibernate
  - Ruby pg
  - Ruby ActiveRecord
  - Python psycopg2
  - Python SQLAlchemy
  - Node.js pg

- Update cluster startup instructions for the above languages to use
  secure practices

- Create a new versioned include directory for 2.1 docs, which holds all
  secure code and cluster setup instructions

- Explain special private key format munging needed by Java
  applications (.key to .pk8 using `openssl` magic strings)
rmloveland added a commit that referenced this issue Jul 18, 2018
Addresses #631

Summary of changes:

- Update code samples for the following languages/ORMs to connect to
  secure local cluster using certs:

  - Java JDBC
  - Java Hibernate
  - Ruby pg
  - Ruby ActiveRecord
  - Python psycopg2
  - Python SQLAlchemy
  - Node.js pg

- Update cluster startup instructions for the above languages to use
  secure practices

- Create a new versioned include directory for 2.1 docs, which holds all
  secure code and cluster setup instructions

- Explain special private key format munging needed by Java
  applications (.key to .pk8 using `openssl` magic strings)
rmloveland added a commit that referenced this issue Jul 25, 2018
Addresses #631

Summary of changes:

- Update code samples for the following languages/ORMs to connect to
  secure and insecure local clusters:

  - Java JDBC
  - Java Hibernate
  - Ruby pg
  - Ruby ActiveRecord
  - Python psycopg2
  - Python SQLAlchemy
  - Node.js pg

- Link out to cluster startup instructions for secure/insecure local
  clusters

- Create a new versioned include directory for 2.1 docs, which holds all
  secure and insecure code samples

- Explain special private key format munging needed by Java
  applications (.key to .pk8 using `openssl` magic strings)
rmloveland added a commit that referenced this issue Jul 30, 2018
Addresses #631

Summary of changes:

- Update code samples for the following languages/ORMs to connect to
  secure and insecure local clusters:

  - Java JDBC
  - Java Hibernate
  - Ruby pg
  - Ruby ActiveRecord
  - Python psycopg2
  - Python SQLAlchemy
  - Node.js pg

- Link out to cluster startup instructions for secure/insecure local
  clusters

- Create a new versioned include directory for 2.1 docs, which holds all
  secure and insecure code samples

- Explain special private key format munging needed by Java
  applications (.key to .pk8 using `openssl` magic strings)
rmloveland added a commit that referenced this issue Aug 1, 2018
Addresses #631

Summary of changes:

- Update code samples for the following languages/ORMs to connect to
  secure and insecure local clusters:

  - Java JDBC
  - Java Hibernate
  - Ruby pg
  - Ruby ActiveRecord
  - Python psycopg2
  - Python SQLAlchemy
  - Node.js pg

- Link out to cluster startup instructions for secure/insecure local
  clusters

- Create a new versioned include directory for 2.1 docs, which holds all
  secure and insecure code samples

- Explain special private key format munging needed by Java
  applications (.key to .pk8 using `openssl` magic strings)
rmloveland added a commit that referenced this issue Aug 16, 2018
Addresses #631.

Summary of changes:

- Update Node Sequelize with secure cluster option

- Update Go pq example with secure cluster option

- Update Go GORM example with secure cluster option

- Update PHP example with secure cluster option
rmloveland added a commit that referenced this issue Aug 20, 2018
Addresses #631.

Summary of changes:

- Update Node Sequelize with secure cluster option

- Update Go pq example with secure cluster option

- Update Go GORM example with secure cluster option

- Update PHP example with secure cluster option
@rmloveland
Copy link
Contributor

@jseldess I'd like to close this since #2943 is closed. What do you think?

(As noted elsewhere, additional work on the last remaining languages will happen via #3700 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-external Origin: Issue comes from external users. T-missing-info T-more-examples-needed
Projects
None yet
Development

No branches or pull requests

6 participants