From commits-return-206708-archive-asf-public=cust-asf.ponee.io@cassandra.apache.org Tue Feb 20 18:27:06 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 9348A18067E for ; Tue, 20 Feb 2018 18:27:05 +0100 (CET) Received: (qmail 23061 invoked by uid 500); 20 Feb 2018 17:27:04 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 23022 invoked by uid 99); 20 Feb 2018 17:27:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Feb 2018 17:27:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id EEF9218030B for ; Tue, 20 Feb 2018 17:27:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.511 X-Spam-Level: X-Spam-Status: No, score=-109.511 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id 6s0KtR-D_jFm for ; Tue, 20 Feb 2018 17:27:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 809B55F503 for ; Tue, 20 Feb 2018 17:27:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id A99E0E018A for ; Tue, 20 Feb 2018 17:27:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 66EDA21E5D for ; Tue, 20 Feb 2018 17:27:00 +0000 (UTC) Date: Tue, 20 Feb 2018 17:27:00 +0000 (UTC) From: "Ron Blechman (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (CASSANDRA-14223) Provide ability to do custom certificate validations (e.g. hostname validation, certificate revocation checks) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CASSANDRA-14223?page=3Dcom.atla= ssian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId= =3D16370257#comment-16370257 ]=20 Ron Blechman edited comment on CASSANDRA-14223 at 2/20/18 5:26 PM: ------------------------------------------------------------------- My=C2=A0request is=C2=A0to be able to apply=C2=A0ANY form of customized cer= tificate validation, which OCSP=C2=A0is just one example. For example, supp= orting an application=C2=A0that allows the user to administer what types of= validation one would like to apply (e.g. OCSP, CRLS, Host Name Validation,= etc.). In respect to OCSP, one could provide a customized Trust Manager that would= have the intelligence to know=C2=A0whether or not to apply OCSP checking a= nd=C2=A0to what degree (i.e. SOFT_FAIL=3Dtrue or false).=C2=A0 The benefit here is that the=C2=A0customized Trust Manager could=C2=A0do t= his without having to reconfigure and restart Cassandra. Additionally, the = custom=C2=A0Trust Manager could also determine whether or not to provide ad= ditional certificate validations such as CRL validation, hostname validatio= n, etc. I have found and tested that this capability can be=C2=A0added to Cassandra= =C2=A0today in a very general way=C2=A0through some minor code changes and = the use=C2=A0of customized SSLSocketFactory=C2=A0and SSLServerSocketFactory= : 1) The customized SSLSocketFactory=C2=A0and SSLServerSocketFactory=C2=A0ins= tantiate and initialize an SSLContext =C2=A0with=C2=A0a customized Trust Ma= nager and set's this customized=C2=A0SSLContext to be the default=C2=A0 (i.= e. sslContext.setDefault()). The customized socket factories=C2=A0are added to the java.security proper= ties file: ssl.SocketFactory.provider=3DCustomSSLSocketFactory ssl.ServerSocketFactory.provider=3DCustomSSLServerSocketFactory {{2) Cassandra=C2=A0makes use of=C2=A0the customized SSLContext by a minor = modification in SSLFactory::createSSLContext(). }} {{ For example:}} {{ SSLFactory::(createSSLContext():}} {{ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 try}} {{ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 {}} {{ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (Security.getPr= operty("ssl.SocketFactory.provider") !=3D null}} {{ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0|| Security.getProperty= ("ssl.ServerSocketFactory.provider") !=3D null)}}{{=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 {}} {{=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 // use default=C2=A0SSLContext created in=C2=A0the= =C2=A0socket factories}} {{ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 ctx =3D SSLContext.getDefault();}} {{=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } else {}} {{ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 //=C2=A0use=C2=A0Cassandra provided SSLContext (same as = before)}} {{ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 ctx =3D SSLContext.getInstance(options.protocol);}} was (Author: ronblechman): My=C2=A0request is=C2=A0to be able to apply=C2=A0ANY form of customized cer= tificate validation, which OCSP=C2=A0is just one example. For example, supp= orting an application=C2=A0that allows the user to administer what types of= validation one would like to apply (e.g. OCSP, CRLS, Host Name Validation,= etc.). In respect to OCSP, one could provide a customized Trust Manager that would= have the intelligence to know=C2=A0whether or not to apply OCSP checking a= nd=C2=A0to what degree (i.e. SOFT_FAIL=3Dtrue or false).=C2=A0 The benefit here is that the=C2=A0customized Trust Manager could=C2=A0do th= is without having to reconfigure and restart Cassandra. Additionally, the c= ustom=C2=A0Trust Manager could also determine whether or not to provide add= itional certificate validations such as CRL validation, hostname validation= , etc. I have found and tested that this capability can be=C2=A0added to Cassandra= =C2=A0today in a very general way=C2=A0through some minor code changes and = the use=C2=A0of customized SSLSocketFactory=C2=A0and SSLServerSocketFactory= : 1) The customized SSLSocketFactory=C2=A0and SSLServerSocketFactory=C2=A0ins= tantiate and initialize an SSLContext =C2=A0with=C2=A0a customized Trust Ma= nager and set's this customized=C2=A0SSLContext to be the default=C2=A0 (i.= e. sslContext.setDefault()). The customized socket factories=C2=A0are added to the java.security proper= ties file: ssl.SocketFactory.provider=3DCustomSSLSocketFactory ssl.ServerSocketFactory.provider=3DCustomSSLServerSocketFactory 2) Cassandra=C2=A0makes use of=C2=A0the customized SSLContext by a minor mo= dification in SSLFactory::createSSLContext().=20 For example: SSLFactory::(createSSLContext(): =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 try =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (Security.getProp= erty("ssl.SocketFactory.provider") !=3D null =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0|| Security.getProperty("= ssl.ServerSocketFactory.provider") !=3D null) {=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 // use default=C2=A0SSLContext c= reated in=C2=A0the=C2=A0socket factories =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ctx =3D SSLContex= t.getDefault();=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 } else { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 //=C2=A0use=C2=A0Cassandra provided SSLContext (same as = before) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 ctx =3D SSLContext.getInstance(options.protocol); > Provide ability to do custom certificate validations (e.g. hostname valid= ation, certificate revocation checks) > -------------------------------------------------------------------------= ------------------------------------- > > Key: CASSANDRA-14223 > URL: https://issues.apache.org/jira/browse/CASSANDRA-1422= 3 > Project: Cassandra > Issue Type: Improvement > Components: Configuration > Reporter: Ron Blechman > Priority: Major > Labels: security > Fix For: 4.x > > > Cassandra server should be to=C2=A0be able do additional certificate vali= dations, such as hostname validatation and certificate revocation checking = against CRLs and/or using OCSP.=C2=A0 > One approach=C2=A0couild be to have SSLFactory=C2=A0use SSLContext.getDef= ault() instead of forcing the creation of a new SSLContext using SSLContext= .getInstance().=C2=A0=C2=A0Using the default SSLContext=C2=A0would allow a = user to plug in their own custom SSLSocketFactory via the java.security pro= perties file. The custom SSLSocketFactory could create a default=C2=A0SSLCo= ntext=C2=A0 that was customized to do any extra validation such as certific= ate revocation, host name validation, etc. -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org For additional commands, e-mail: commits-help@cassandra.apache.org