securing cassandra for compliance

90
Securing Cassandra for Compliance (or Paranoia)

Upload: datastax

Post on 16-Apr-2017

900 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Securing Cassandra for Compliance

Securing Cassandrafor Compliance (or Paranoia)

Page 2: Securing Cassandra for Compliance

Hi, I'm Nate. @zznate https://www.linkedin.com/in/zznate http://www.slideshare.net/zznate/

Co-Founder, CTO The Last Pickle

Cassandra user since 2009 (v0.4) Austin, Texas

Page 3: Securing Cassandra for Compliance

Security presentations can be scary. Here's a cat.

Page 4: Securing Cassandra for Compliance

First, how did we get here and why is securing Cassandra important?

Page 5: Securing Cassandra for Compliance

"Target CEO Gregg Steinhafel Resigns In Data Breach Fallout"

http://www.forbes.com/sites/clareoconnor/2014/05/05/target-ceo-gregg-steinhafel-resigns-in-wake-of-data-breach-fallout/

First, how did we get here and why is securing Cassandra important?

Page 6: Securing Cassandra for Compliance

I have

your personal

information

Customers place a lot of trust in technology companies

Page 7: Securing Cassandra for Compliance

LOL! Me too!

Sometimes too much.

Page 8: Securing Cassandra for Compliance

Ease of scalability comes with a price

Page 9: Securing Cassandra for Compliance

HA! A bin-packed message format with no source

verification!*

Ease of scalability comes with a price

* <currently reading o.a.c.net.MessageIn#read>

Page 10: Securing Cassandra for Compliance

nmap -Pn -p7000 \-oG logs/cass.gnmap 54.88.0.0/14

Page 11: Securing Cassandra for Compliance

I'm publicly discussing your

technical shortcomings

Then you end up in this situation.

Page 12: Securing Cassandra for Compliance

Meanwhile, at the FCC...

We have to require two factor, secure socket transport

encryption, something something...

ZZZzzzzzzzZZZzz

Page 13: Securing Cassandra for Compliance

We did a regulation!

My staffers still print out my email :)

Page 14: Securing Cassandra for Compliance

Why are we doing this again?

Sssshhhh. I'm AES'ing...

...even though the traffic never leaves a backplane.

Some industries will require node to node SSL

Page 15: Securing Cassandra for Compliance

1. Encrypting data at rest2. Encrypting data on the wire3. Authentication and authorization4. Management and tooling

Focusing our Discussion: Architecture

Page 16: Securing Cassandra for Compliance

1. Encryption at rest

Page 17: Securing Cassandra for Compliance

No matter what: understand the failure modes

Page 18: Securing Cassandra for Compliance

bit rot, entropy, etc. Horrible things can happen with on disk encryption.

Page 19: Securing Cassandra for Compliance

Don't mind me, I'm just your key server.

Page 20: Securing Cassandra for Compliance

Haha! Later!

xWhat's on this

disk again?

Shrug.

Page 21: Securing Cassandra for Compliance

...but you may not have a choice.

Because we said "at rest"

Page 22: Securing Cassandra for Compliance

dmcrypt, eCryptFS

Open source options:

Page 23: Securing Cassandra for Compliance

Vormetric, Gazzang

Commercial options:

Page 24: Securing Cassandra for Compliance

DSE Encryption

CREATE TABLE users ...WITH compression_parameters:sstable_compression = 'Encryptor' and compression_parameters:cipher_algorithm = 'AES/ECB/PKCS5Padding' and compression_parameters:secret_key_strength = 128;

Page 25: Securing Cassandra for Compliance

DSE Encryption

CREATE TABLE users ...WITH compression_parameters:sstable_compression = 'Encryptor' and compression_parameters:cipher_algorithm = 'AES/ECB/PKCS5Padding' and compression_parameters:secret_key_strength = 128;

WARNING:

commitlog not included*

*eCryptFS would work fine for this

Page 26: Securing Cassandra for Compliance

EBS Encryption (a.k.a "not my problem")

Page 27: Securing Cassandra for Compliance

(Looks like this)

EBS Encryption (a.k.a "not my problem")

http://www.slideshare.net/AmazonWebServices/bdt323-amazon-ebs-cassandra-1-million-writes-per-second

See Crowdstrike's presentation on Cassandra GP2 performance (with encryption):

Page 28: Securing Cassandra for Compliance

Maybe Client Side?

The Java Driver now has custom codecs which would make this easy to implement

https://github.com/datastax/java-driver/tree/3.0/manual/custom_codecs

Page 29: Securing Cassandra for Compliance

Maybe Client Side?

The Java Driver now has custom codecs which would make this easy to implement

https://github.com/datastax/java-driver/tree/3.0/manual/custom_codecs

Column-level encryption!

Page 30: Securing Cassandra for Compliance

New in Cassandra 3.4 (DSE 5.1?):

Commitlog Encryption: CASSANDRA-6018 Hint File Encryption: CASSANDRA-11040

https://issues.apache.org/jira/browse/CASSANDRA-6018https://issues.apache.org/jira/browse/CASSANDRA-11040

Page 31: Securing Cassandra for Compliance

2. Encryption on the wire

Page 32: Securing Cassandra for Compliance

Because:It is really easy to attack an un-protected cluster

Page 33: Securing Cassandra for Compliance

It takes a single Message to insert an admin account

into the system table

Page 34: Securing Cassandra for Compliance

-Dcassandra.write_survey=true

How to steal writes in real time:

Page 35: Securing Cassandra for Compliance

The fix is straight forward:

node to node encryption and SSL client certificate authentication to cluster traffic

Page 36: Securing Cassandra for Compliance

Awwwwww.

The fix is straight forward:

node to node encryption and SSL client certificate authentication to cluster traffic

Page 37: Securing Cassandra for Compliance

Awwwwww.

The fix is straight forward:

node to node encryption and SSL client certificate authentication to cluster traffic

Bonus: can be done

with NO downtime!!!

Page 38: Securing Cassandra for Compliance

Awwwwww.

The fix is straight forward:

node to node encryption and SSL client certificate authentication to cluster traffic

Bonus: can be done

with NO downtime!!!

How-to guide: http://thelastpickle.com/blog/2015/09/30/hardening-cassandra-step-by-step-part-1-server-to-

server.html

Page 39: Securing Cassandra for Compliance

When you are done it should look like:

Page 40: Securing Cassandra for Compliance

Things to note:

Use "dc" or "rack" to limit encryption to connections between racks and data centers

Page 41: Securing Cassandra for Compliance

Thanks for that!!

Huzzah!

(But AES on modern hardware will not be a bottleneck)

Page 42: Securing Cassandra for Compliance

Things to note:

Keystore and key password must match (artifact of JDK X.509 Impl complexity)

Page 43: Securing Cassandra for Compliance

Things to note:

256 bit means export restrictions (requires JCE provider JAR)

http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html

http://docs.oracle.com/javase/8/docs/technotes/guides/security/SunProviders.html#importlimits

Page 44: Securing Cassandra for Compliance

Don't forget this part or else...

Things to note:

Page 45: Securing Cassandra for Compliance

Hahaha! Now I'm hacking you over SSL.

*Still* vulnerable AND you can't see what the attacker is doing.

Page 46: Securing Cassandra for Compliance

Client to Server SSL

Page 47: Securing Cassandra for Compliance

Client to Server SSL(see slides 30 to 35)

Page 48: Securing Cassandra for Compliance

Client to Server SSL(see slides 30 to 35)

Now with NO downtime!!!

https://issues.apache.org/jira/browse/CASSANDRA-10559Available in: 2.1.12, 2.2.4, 3.0.0

Page 49: Securing Cassandra for Compliance

Need to Debug SSL?

-Djavax.net.debug=ssl

http://docs.oracle.com/javase/7/docs/technotes/guides/security/jsse/ReadDebug.html

Page 50: Securing Cassandra for Compliance

Certs are hard :(

Netflix Lemur:x.509 Certificate Orchestration Framework

http://techblog.netflix.com/2015/09/introducing-lemur.htmlhttps://github.com/Netflix/lemur

Page 51: Securing Cassandra for Compliance

Certs are hard :(

Hashicorp Vault"secures, stores, and tightly controls access to tokens, passwords, certificates, API keys, and other secrets in modern computing. "

https://www.vaultproject.io/

Page 52: Securing Cassandra for Compliance

2. Encryption on the wire

But wait! There's more!

Page 53: Securing Cassandra for Compliance

The internode authentication API:BYO identity verification

Page 54: Securing Cassandra for Compliance

Looks like this:

Page 55: Securing Cassandra for Compliance

3. Authentication and Authorization

Page 56: Securing Cassandra for Compliance

Best practices should not be new to you.

user segmentation schema access limitation etc.

Page 57: Securing Cassandra for Compliance

(Everything we did with an RDBMS)

Best practices should not be new to you.

user segmentation schema access limitation etc.

Page 58: Securing Cassandra for Compliance

Best practices should not be new to you.

user segmentation schema access limitation etc.

(Everything we did with an RDBMS)

New in 2.2:

Role-based access control!

Page 59: Securing Cassandra for Compliance

An Example

Page 60: Securing Cassandra for Compliance

An Example

Page 61: Securing Cassandra for Compliance

An Example

Page 62: Securing Cassandra for Compliance

An Example

Page 63: Securing Cassandra for Compliance

An Example

buzzword compliant!

Page 64: Securing Cassandra for Compliance

An Example

Page 65: Securing Cassandra for Compliance

An Example

Page 66: Securing Cassandra for Compliance

Turning it all on

authenticator: PasswordAuthenticator

Tip: keep your read-only cqlsh credentials in $HOME/.cassandra/cqlshrc

of the system's admin account

Page 67: Securing Cassandra for Compliance

Turning it all on

authorizer: CassandraAuthorizer

Page 68: Securing Cassandra for Compliance

Turning it all on

role_manager: CassandraRoleManager

Page 69: Securing Cassandra for Compliance

Turning it all on

authorizer: CassandraAuthorizerauthenticator: PasswordAuthenticatorrole_manager: CassandraRoleManager

WARNING:

potential downtime!

Page 70: Securing Cassandra for Compliance

authorizer: CassandraAuthorizerauthenticator: PasswordAuthenticatorrole_manager: CassandraRoleManager

Turning it all on

WARNING:

potential downtime!WARNING:

stupid defaults

Page 71: Securing Cassandra for Compliance

authorizer: CassandraAuthorizerauthenticator: PasswordAuthenticatorrole_manager: CassandraRoleManager

Turning it all on

WARNING:

potential downtime!WARNING:

stupid defaults

TIP: turn these WAY UP: permissions_validity_in_ms roles_validity_in_ms

Also: use permissions_update_interval_in_ms for async refresh if needed

Page 72: Securing Cassandra for Compliance

authorizer: CassandraAuthorizerauthenticator: PasswordAuthenticatorrole_manager: CassandraRoleManager

Turning it all on

WARNING:

potential downtime!WARNING:

stupid defaults

NEW in 3.4:credentials_validity_in_ms*

* https://issues.apache.org/jira/browse/CASSANDRA-7715

Page 73: Securing Cassandra for Compliance

Turning it all on

authorizer: TransitionalAuthorizerauthenticator: TransitionalAuthenticator

DSE plugins to avoid downtime

Page 74: Securing Cassandra for Compliance

Turning it all on

system.schema_keyspace system.schema_columns system.schema_columnfamilies system.local system.peers

These tables have default read permissions for every authenticated user:

Page 75: Securing Cassandra for Compliance

Turning it all on

IMPORTANT cassandra.yaml line note:

"Please increase system_auth keyspace replication factor if you use this..."

Tip: replication factor for the system_auth keyspace should be the same as the number

of nodes in the data center

Page 76: Securing Cassandra for Compliance

Turning it all on

IMPORTANT cassandra.yaml line note:

"Please increase system_auth keyspace replication factor if you use this..."

Tip: replication factor for the system_auth keyspace should be the same as the number

of nodes in the data center

WARNING:

stupid defaults*

*https://issues.apache.org/jira/browse/CASSANDRA-11340

Page 77: Securing Cassandra for Compliance

4. Management and tooling

Page 78: Securing Cassandra for Compliance

4. Management and tooling

Page 79: Securing Cassandra for Compliance

Securing JMX

Page 80: Securing Cassandra for Compliance

nmap -Pn -p7199 \-oG logs/cass.gnmap 54.88.0.0/14

Always a few suckers that TL,DR'ed

Page 81: Securing Cassandra for Compliance

Why do I need to secure JMX?

Page 82: Securing Cassandra for Compliance
Page 83: Securing Cassandra for Compliance

Works as Advertised!

Page 84: Securing Cassandra for Compliance

also good for

some LOLs

Page 85: Securing Cassandra for Compliance

Securing JMX

SSL setup is like node to node and client to server

http://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html

Page 86: Securing Cassandra for Compliance

Securing JMX

JMX Authentication is straightforward and well documented

$JAVA_HOME/jre/lib/management/jmxremote.access$JAVA_HOME/jre/lib/management/jmxremote.password.template

http://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html

Page 87: Securing Cassandra for Compliance

Securing JMX

$JAVA_HOME/jre/lib/management/jmxremote.access$JAVA_HOME/jre/lib/management/jmxremote.password.template

Now you can:

nodetool -u admin -pw secret compactionstats

http://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html

JMX Authentication is straightforward and well documented

Page 88: Securing Cassandra for Compliance

Securing JMX

$JAVA_HOME/jre/lib/management/jmxremote.access$JAVA_HOME/jre/lib/management/jmxremote.password.template

Now you can:

nodetool -u admin -pw secret compactionstats

Tip: -pwf option will read the password from a file

http://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html

JMX Authentication is straightforward and well documented

Page 89: Securing Cassandra for Compliance

Securing JMX

$JAVA_HOME/jre/lib/management/jmxremote.access$JAVA_HOME/jre/lib/management/jmxremote.password.template

Now you can:

nodetool -u admin -pw secret compactionstats

JMX Authentication is straightforward and well documented

THIS JUST IN!!!

RBAC for JMX Authentication and Authorization

https://issues.apache.org/jira/browse/CASSANDRA-10091

Page 90: Securing Cassandra for Compliance

Thanks!@zznate