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')
There are a few steps here, for each example:
cockroach cert tools generate other formats.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
From https://github.com/cockroachdb/docs/issues/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,
));
Ping on this: java is particularly tricky and could use an example. See https://github.com/cockroachdb/cockroach/issues/24487
Thanks, @mberhault. @awoods187, let's talk about prioritizing this as a docs/eng project for 2.1, perhaps focusing just on jdbc and hibernate.
For 2.1, part of https://github.com/cockroachdb/docs/issues/2943.
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.
@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 )