You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2017/08/22 23:14:59 UTC

[1/2] incubator-impala git commit: KUDU-2087. Fix failure to map Kerberos principal to username with FreeIPA

Repository: incubator-impala
Updated Branches:
  refs/heads/master db60c1cd2 -> e71e359af


KUDU-2087. Fix failure to map Kerberos principal to username with FreeIPA

FreeIPA is a piece of software that automates and simplifies management
of MIT krb5, SSSD, some LDAP service, etc. FreeIPA configures a
localauth plugin[1] in krb5.conf to map Kerberos principals to local
usernames. In this configuration, Kudu daemons were failing to start up
due to failure to map their own service principals back to a username.
This is due to a number of issues:

1) FreeIPA distinguishes between service principals and user principals
and doesn't store a 'uid' field in LDAP for service principals. Thus,
when 'sssd' tries to map a service principal to a local unix user, it
determines that there is no such user (ie getpwnam() fails). This is by
design, best I can tell.

2) sssd's implementation of krb5_auth_to_localname[1] uses getpwnam to try
to map the kerberos principal to the local username. Because of the
above, it fails for service principals.

3) Prior to el7.3, ssd configures krb5 with 'enable_only = sssd' in the
localauth plugin section. This means that if sssd fails to perform the
mapping, it does not fall back to other mappings defined in krb5.conf
(eg explicitly defined auth_to_local rules). See [2]

4) Even after 7.3, there is an additional bug in sssd which I just
filed[3], which causes the fallback to still not work. Because of this,
we're getting the KRB5_PLUGIN_NO_HANDLE error code back up at the Kudu
layer.

We already have our own fallback case for KRB5_LNAME_NO_TRANS, and it
seems like we should just be handling PLUGIN_NO_HANDLE in the same way
to workaround the above behavior.

I tested this patch on a FreeIPA-configured system on el6.7. I was able
to successfully start a master with a FreeIPA-provided keytab and
authentication required, and use 'kudu table list' to authenticate to
it.

[1] https://github.com/SSSD/sssd/blob/master/src/krb5_plugin/sssd_krb5_localauth_plugin.c
[2] https://bugzilla.redhat.com/show_bug.cgi?id=1297462
[3] https://pagure.io/SSSD/sssd/issue/3459

Change-Id: I7bc13b33053a73784350c9d30a3796a96d318c04
Reviewed-on: http://gerrit.cloudera.org:8080/7551
Tested-by: Kudu Jenkins
Reviewed-by: Alexey Serbin <as...@cloudera.com>
Reviewed-on: http://gerrit.cloudera.org:8080/7745
Reviewed-by: Michael Ho <kw...@cloudera.com>
Tested-by: Impala Public Jenkins


Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/2f3e824a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/2f3e824a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/2f3e824a

Branch: refs/heads/master
Commit: 2f3e824af6b80becb4feeba23138ccfbe6c0602d
Parents: db60c1c
Author: Todd Lipcon <to...@apache.org>
Authored: Mon Jul 31 18:58:26 2017 -0700
Committer: Impala Public Jenkins <im...@gerrit.cloudera.org>
Committed: Tue Aug 22 21:35:24 2017 +0000

----------------------------------------------------------------------
 be/src/kudu/security/init.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/2f3e824a/be/src/kudu/security/init.cc
----------------------------------------------------------------------
diff --git a/be/src/kudu/security/init.cc b/be/src/kudu/security/init.cc
index c9baeb4..dfbb25c 100644
--- a/be/src/kudu/security/init.cc
+++ b/be/src/kudu/security/init.cc
@@ -436,9 +436,13 @@ Status MapPrincipalToLocalName(const std::string& principal, std::string* local_
   // first component of the principal.
   rc = KRB5_LNAME_NOTRANS;
 #endif
-  if (rc == KRB5_LNAME_NOTRANS) {
+  if (rc == KRB5_LNAME_NOTRANS || rc == KRB5_PLUGIN_NO_HANDLE) {
     // No name mapping specified. We fall back to simply taking the first component
     // of the principal, for compatibility with the default behavior of Hadoop.
+    //
+    // NOTE: KRB5_PLUGIN_NO_HANDLE isn't typically expected here, but works around
+    // a bug in SSSD's auth_to_local implementation: https://pagure.io/SSSD/sssd/issue/3459
+    //
     // TODO(todd): we should support custom configured auth-to-local mapping, since
     // most Hadoop ecosystem components do not load them from krb5.conf.
     if (princ->length > 0) {


[2/2] incubator-impala git commit: Cherry-pick constant renaming for be/src/kudu from Kudu commit e719b

Posted by ta...@apache.org.
Cherry-pick constant renaming for be/src/kudu from Kudu commit e719b

This change enforces the rule that constants under be/src/kudu directory
should be named kFooBar and fixes the cases where we didn't adhere to this.
This is needed to avoid conflicts when cherry-picking other changes.

Change-Id: I7971659ef3152580d44d6ddfb18be7ebf41052c7
Reviewed-on: http://gerrit.cloudera.org:8080/7158
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Tested-by: Kudu Jenkins
Reviewed-on: http://gerrit.cloudera.org:8080/7740
Reviewed-by: Henry Robinson <he...@cloudera.com>
Tested-by: Impala Public Jenkins


Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/e71e359a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/e71e359a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/e71e359a

Branch: refs/heads/master
Commit: e71e359affb21a699ab6b659170bea51bce86388
Parents: 2f3e824
Author: Todd Lipcon <to...@cloudera.com>
Authored: Mon Jun 12 15:03:49 2017 -0700
Committer: Impala Public Jenkins <im...@gerrit.cloudera.org>
Committed: Tue Aug 22 21:45:48 2017 +0000

----------------------------------------------------------------------
 be/src/kudu/rpc/protoc-gen-krpc.cc         |  8 +++----
 be/src/kudu/rpc/request_tracker-test.cc    |  4 ++--
 be/src/kudu/rpc/request_tracker.cc         |  4 ++--
 be/src/kudu/rpc/request_tracker.h          |  4 ++--
 be/src/kudu/rpc/retriable_rpc.h            | 10 ++++-----
 be/src/kudu/security/ca/cert_management.cc |  4 ++--
 be/src/kudu/security/cert.cc               |  2 +-
 be/src/kudu/security/crypto.cc             | 22 +++++++++----------
 be/src/kudu/security/openssl_util.h        | 28 ++++++++++++-------------
 be/src/kudu/security/openssl_util_bio.h    | 10 ++++-----
 be/src/kudu/security/tls_context.cc        |  4 ++--
 be/src/kudu/util/debug/trace_event_impl.cc | 20 +++++++++---------
 be/src/kudu/util/maintenance_manager.cc    |  2 +-
 be/src/kudu/util/maintenance_manager.h     |  2 +-
 be/src/kudu/util/mem_tracker-test.cc       |  4 ++--
 be/src/kudu/util/os-util.cc                | 26 +++++++++++------------
 be/src/kudu/util/process_memory.cc         |  4 ++--
 be/src/kudu/util/rle-test.cc               | 12 +++++------
 18 files changed, 85 insertions(+), 85 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/e71e359a/be/src/kudu/rpc/protoc-gen-krpc.cc
----------------------------------------------------------------------
diff --git a/be/src/kudu/rpc/protoc-gen-krpc.cc b/be/src/kudu/rpc/protoc-gen-krpc.cc
index de41aa9..e892897 100644
--- a/be/src/kudu/rpc/protoc-gen-krpc.cc
+++ b/be/src/kudu/rpc/protoc-gen-krpc.cc
@@ -91,7 +91,7 @@ class Substituter {
 // NameInfo contains information about the output names.
 class FileSubstitutions : public Substituter {
  public:
-  static const std::string PROTO_EXTENSION;
+  static const std::string kProtoExtension;
 
   Status Init(const FileDescriptor *file) {
     string path = file->name();
@@ -99,9 +99,9 @@ class FileSubstitutions : public Substituter {
 
     // Initialize path_
     // If path = /foo/bar/baz_stuff.proto, path_ = /foo/bar/baz_stuff
-    if (!TryStripSuffixString(path, PROTO_EXTENSION, &path_no_extension_)) {
+    if (!TryStripSuffixString(path, kProtoExtension, &path_no_extension_)) {
       return Status::InvalidArgument("file name " + path +
-                                     " did not end in " + PROTO_EXTENSION);
+                                     " did not end in " + kProtoExtension);
     }
     map_["path_no_extension"] = path_no_extension_;
 
@@ -183,7 +183,7 @@ class FileSubstitutions : public Substituter {
   map<string, string> map_;
 };
 
-const std::string FileSubstitutions::PROTO_EXTENSION(".proto");
+const std::string FileSubstitutions::kProtoExtension(".proto");
 
 class MethodSubstitutions : public Substituter {
  public:

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/e71e359a/be/src/kudu/rpc/request_tracker-test.cc
----------------------------------------------------------------------
diff --git a/be/src/kudu/rpc/request_tracker-test.cc b/be/src/kudu/rpc/request_tracker-test.cc
index 89ea8a2..f39e131 100644
--- a/be/src/kudu/rpc/request_tracker-test.cc
+++ b/be/src/kudu/rpc/request_tracker-test.cc
@@ -33,7 +33,7 @@ TEST(RequestTrackerTest, TestSequenceNumberGeneration) {
 
   // A new tracker should have no incomplete RPCs
   RequestTracker::SequenceNumber seq_no = tracker_->FirstIncomplete();
-  ASSERT_EQ(seq_no, RequestTracker::NO_SEQ_NO);
+  ASSERT_EQ(seq_no, RequestTracker::kNoSeqNo);
 
   vector<RequestTracker::SequenceNumber> generated_seq_nos;
 
@@ -75,7 +75,7 @@ TEST(RequestTrackerTest, TestSequenceNumberGeneration) {
     tracker_->RpcCompleted(seq_no);
   }
 
-  ASSERT_EQ(tracker_->FirstIncomplete(), RequestTracker::NO_SEQ_NO);
+  ASSERT_EQ(tracker_->FirstIncomplete(), RequestTracker::kNoSeqNo);
 }
 
 } // namespace rpc

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/e71e359a/be/src/kudu/rpc/request_tracker.cc
----------------------------------------------------------------------
diff --git a/be/src/kudu/rpc/request_tracker.cc b/be/src/kudu/rpc/request_tracker.cc
index 1958664..84a445e 100644
--- a/be/src/kudu/rpc/request_tracker.cc
+++ b/be/src/kudu/rpc/request_tracker.cc
@@ -24,7 +24,7 @@
 namespace kudu {
 namespace rpc {
 
-const RequestTracker::SequenceNumber RequestTracker::NO_SEQ_NO = -1;
+const RequestTracker::SequenceNumber RequestTracker::kNoSeqNo = -1;
 
 RequestTracker::RequestTracker(const string& client_id)
     : client_id_(client_id),
@@ -40,7 +40,7 @@ Status RequestTracker::NewSeqNo(SequenceNumber* seq_no) {
 
 RequestTracker::SequenceNumber RequestTracker::FirstIncomplete() {
   std::lock_guard<simple_spinlock> l(lock_);
-  if (incomplete_rpcs_.empty()) return NO_SEQ_NO;
+  if (incomplete_rpcs_.empty()) return kNoSeqNo;
   return *incomplete_rpcs_.begin();
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/e71e359a/be/src/kudu/rpc/request_tracker.h
----------------------------------------------------------------------
diff --git a/be/src/kudu/rpc/request_tracker.h b/be/src/kudu/rpc/request_tracker.h
index 99f8d6c..9698d58 100644
--- a/be/src/kudu/rpc/request_tracker.h
+++ b/be/src/kudu/rpc/request_tracker.h
@@ -48,7 +48,7 @@ namespace rpc {
 class RequestTracker : public RefCountedThreadSafe<RequestTracker> {
  public:
   typedef int64_t SequenceNumber;
-  static const RequestTracker::SequenceNumber NO_SEQ_NO;
+  static const RequestTracker::SequenceNumber kNoSeqNo;
   explicit RequestTracker(const std::string& client_id);
 
   // Creates a new, unique, sequence number.
@@ -59,7 +59,7 @@ class RequestTracker : public RefCountedThreadSafe<RequestTracker> {
   Status NewSeqNo(SequenceNumber* seq_no);
 
   // Returns the sequence number of the first incomplete RPC.
-  // If there is no incomplete RPC returns NO_SEQ_NO.
+  // If there is no incomplete RPC returns kNoSeqNo.
   SequenceNumber FirstIncomplete();
 
   // Marks the rpc with 'seq_no' as completed.

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/e71e359a/be/src/kudu/rpc/retriable_rpc.h
----------------------------------------------------------------------
diff --git a/be/src/kudu/rpc/retriable_rpc.h b/be/src/kudu/rpc/retriable_rpc.h
index c896027..897d7a7 100644
--- a/be/src/kudu/rpc/retriable_rpc.h
+++ b/be/src/kudu/rpc/retriable_rpc.h
@@ -56,11 +56,11 @@ class RetriableRpc : public Rpc {
       : Rpc(deadline, std::move(messenger)),
         server_picker_(server_picker),
         request_tracker_(request_tracker),
-        sequence_number_(RequestTracker::NO_SEQ_NO),
+        sequence_number_(RequestTracker::kNoSeqNo),
         num_attempts_(0) {}
 
   virtual ~RetriableRpc() {
-    DCHECK_EQ(sequence_number_, RequestTracker::NO_SEQ_NO);
+    DCHECK_EQ(sequence_number_, RequestTracker::kNoSeqNo);
   }
 
   // Performs server lookup/initialization.
@@ -138,7 +138,7 @@ class RetriableRpc : public Rpc {
 
 template <class Server, class RequestPB, class ResponsePB>
 void RetriableRpc<Server, RequestPB, ResponsePB>::SendRpc()  {
-  if (sequence_number_ == RequestTracker::NO_SEQ_NO) {
+  if (sequence_number_ == RequestTracker::kNoSeqNo) {
     CHECK_OK(request_tracker_->NewSeqNo(&sequence_number_));
   }
   server_picker_->PickLeader(Bind(&RetriableRpc::ReplicaFoundCb,
@@ -237,10 +237,10 @@ bool RetriableRpc<Server, RequestPB, ResponsePB>::RetryIfNeeded(
 
 template <class Server, class RequestPB, class ResponsePB>
 void RetriableRpc<Server, RequestPB, ResponsePB>::FinishInternal() {
-  // Mark the RPC as completed and set the sequence number to NO_SEQ_NO to make
+  // Mark the RPC as completed and set the sequence number to kNoSeqNo to make
   // sure we're in the appropriate state before destruction.
   request_tracker_->RpcCompleted(sequence_number_);
-  sequence_number_ = RequestTracker::NO_SEQ_NO;
+  sequence_number_ = RequestTracker::kNoSeqNo;
 }
 
 template <class Server, class RequestPB, class ResponsePB>

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/e71e359a/be/src/kudu/security/ca/cert_management.cc
----------------------------------------------------------------------
diff --git a/be/src/kudu/security/ca/cert_management.cc b/be/src/kudu/security/ca/cert_management.cc
index a6d7f7b..c63eb10 100644
--- a/be/src/kudu/security/ca/cert_management.cc
+++ b/be/src/kudu/security/ca/cert_management.cc
@@ -52,10 +52,10 @@ namespace kudu {
 namespace security {
 
 template<> struct SslTypeTraits<ASN1_INTEGER> {
-  static constexpr auto free = &ASN1_INTEGER_free;
+  static constexpr auto kFreeFunc = &ASN1_INTEGER_free;
 };
 template<> struct SslTypeTraits<BIGNUM> {
-  static constexpr auto free = &BN_free;
+  static constexpr auto kFreeFunc = &BN_free;
 };
 
 namespace ca {

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/e71e359a/be/src/kudu/security/cert.cc
----------------------------------------------------------------------
diff --git a/be/src/kudu/security/cert.cc b/be/src/kudu/security/cert.cc
index fa4c753..dabf2d3 100644
--- a/be/src/kudu/security/cert.cc
+++ b/be/src/kudu/security/cert.cc
@@ -39,7 +39,7 @@ namespace kudu {
 namespace security {
 
 template<> struct SslTypeTraits<GENERAL_NAMES> {
-  static constexpr auto free = &GENERAL_NAMES_free;
+  static constexpr auto kFreeFunc = &GENERAL_NAMES_free;
 };
 
 // This OID is generated via the UUID method.

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/e71e359a/be/src/kudu/security/crypto.cc
----------------------------------------------------------------------
diff --git a/be/src/kudu/security/crypto.cc b/be/src/kudu/security/crypto.cc
index 1aab6b1..cf4199e 100644
--- a/be/src/kudu/security/crypto.cc
+++ b/be/src/kudu/security/crypto.cc
@@ -64,25 +64,25 @@ int DerWritePublicKey(BIO* bio, EVP_PKEY* key) {
 } // anonymous namespace
 
 template<> struct SslTypeTraits<BIGNUM> {
-  static constexpr auto free = &BN_free;
+  static constexpr auto kFreeFunc = &BN_free;
 };
 struct RsaPrivateKeyTraits : public SslTypeTraits<EVP_PKEY> {
-  static constexpr auto read_pem = &PEM_read_bio_PrivateKey;
-  static constexpr auto read_der = &d2i_PrivateKey_bio;
-  static constexpr auto write_pem = &PemWritePrivateKey;
-  static constexpr auto write_der = &i2d_PrivateKey_bio;
+  static constexpr auto kReadPemFunc = &PEM_read_bio_PrivateKey;
+  static constexpr auto kReadDerFunc = &d2i_PrivateKey_bio;
+  static constexpr auto kWritePemFunc = &PemWritePrivateKey;
+  static constexpr auto kWriteDerFunc = &i2d_PrivateKey_bio;
 };
 struct RsaPublicKeyTraits : public SslTypeTraits<EVP_PKEY> {
-  static constexpr auto read_pem = &PEM_read_bio_PUBKEY;
-  static constexpr auto read_der = &d2i_PUBKEY_bio;
-  static constexpr auto write_pem = &PemWritePublicKey;
-  static constexpr auto write_der = &DerWritePublicKey;
+  static constexpr auto kReadPemFunc = &PEM_read_bio_PUBKEY;
+  static constexpr auto kReadDerFunc = &d2i_PUBKEY_bio;
+  static constexpr auto kWritePemFunc = &PemWritePublicKey;
+  static constexpr auto kWriteDerFunc = &DerWritePublicKey;
 };
 template<> struct SslTypeTraits<RSA> {
-  static constexpr auto free = &RSA_free;
+  static constexpr auto kFreeFunc = &RSA_free;
 };
 template<> struct SslTypeTraits<EVP_MD_CTX> {
-  static constexpr auto free = &EVP_MD_CTX_destroy;
+  static constexpr auto kFreeFunc = &EVP_MD_CTX_destroy;
 };
 
 namespace {

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/e71e359a/be/src/kudu/security/openssl_util.h
----------------------------------------------------------------------
diff --git a/be/src/kudu/security/openssl_util.h b/be/src/kudu/security/openssl_util.h
index db85a85..82392c1 100644
--- a/be/src/kudu/security/openssl_util.h
+++ b/be/src/kudu/security/openssl_util.h
@@ -106,32 +106,32 @@ template<typename SSL_TYPE>
 struct SslTypeTraits {};
 
 template<> struct SslTypeTraits<X509> {
-  static constexpr auto free = &X509_free;
-  static constexpr auto read_pem = &PEM_read_bio_X509;
-  static constexpr auto read_der = &d2i_X509_bio;
-  static constexpr auto write_pem = &PEM_write_bio_X509;
-  static constexpr auto write_der = &i2d_X509_bio;
+  static constexpr auto kFreeFunc = &X509_free;
+  static constexpr auto kReadPemFunc = &PEM_read_bio_X509;
+  static constexpr auto kReadDerFunc = &d2i_X509_bio;
+  static constexpr auto kWritePemFunc = &PEM_write_bio_X509;
+  static constexpr auto kWriteDerFunc = &i2d_X509_bio;
 };
 template<> struct SslTypeTraits<X509_EXTENSION> {
-  static constexpr auto free = &X509_EXTENSION_free;
+  static constexpr auto kFreeFunc = &X509_EXTENSION_free;
 };
 template<> struct SslTypeTraits<X509_REQ> {
-  static constexpr auto free = &X509_REQ_free;
-  static constexpr auto read_pem = &PEM_read_bio_X509_REQ;
-  static constexpr auto read_der = &d2i_X509_REQ_bio;
-  static constexpr auto write_pem = &PEM_write_bio_X509_REQ;
-  static constexpr auto write_der = &i2d_X509_REQ_bio;
+  static constexpr auto kFreeFunc = &X509_REQ_free;
+  static constexpr auto kReadPemFunc = &PEM_read_bio_X509_REQ;
+  static constexpr auto kReadDerFunc = &d2i_X509_REQ_bio;
+  static constexpr auto kWritePemFunc = &PEM_write_bio_X509_REQ;
+  static constexpr auto kWriteDerFunc = &i2d_X509_REQ_bio;
 };
 template<> struct SslTypeTraits<EVP_PKEY> {
-  static constexpr auto free = &EVP_PKEY_free;
+  static constexpr auto kFreeFunc = &EVP_PKEY_free;
 };
 template<> struct SslTypeTraits<SSL_CTX> {
-  static constexpr auto free = &SSL_CTX_free;
+  static constexpr auto kFreeFunc = &SSL_CTX_free;
 };
 
 template<typename SSL_TYPE, typename Traits = SslTypeTraits<SSL_TYPE>>
 c_unique_ptr<SSL_TYPE> ssl_make_unique(SSL_TYPE* d) {
-  return {d, Traits::free};
+  return {d, Traits::kFreeFunc};
 }
 
 // Acceptable formats for keys, X509 certificates and X509 CSRs.

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/e71e359a/be/src/kudu/security/openssl_util_bio.h
----------------------------------------------------------------------
diff --git a/be/src/kudu/security/openssl_util_bio.h b/be/src/kudu/security/openssl_util_bio.h
index 6ab6a55..d4dcc44 100644
--- a/be/src/kudu/security/openssl_util_bio.h
+++ b/be/src/kudu/security/openssl_util_bio.h
@@ -32,7 +32,7 @@ namespace kudu {
 namespace security {
 
 template<> struct SslTypeTraits<BIO> {
-  static constexpr auto free = &BIO_free;
+  static constexpr auto kFreeFunc = &BIO_free;
 };
 
 template<typename TYPE, typename Traits = SslTypeTraits<TYPE>>
@@ -41,11 +41,11 @@ Status ToBIO(BIO* bio, DataFormat format, TYPE* obj) {
   CHECK(obj);
   switch (format) {
     case DataFormat::DER:
-      OPENSSL_RET_NOT_OK(Traits::write_der(bio, obj),
+      OPENSSL_RET_NOT_OK(Traits::kWriteDerFunc(bio, obj),
           "error exporting data in DER format");
       break;
     case DataFormat::PEM:
-      OPENSSL_RET_NOT_OK(Traits::write_pem(bio, obj),
+      OPENSSL_RET_NOT_OK(Traits::kWritePemFunc(bio, obj),
           "error exporting data in PEM format");
       break;
   }
@@ -58,10 +58,10 @@ Status FromBIO(BIO* bio, DataFormat format, c_unique_ptr<TYPE>* ret) {
   CHECK(bio);
   switch (format) {
     case DataFormat::DER:
-      *ret = ssl_make_unique(Traits::read_der(bio, nullptr));
+      *ret = ssl_make_unique(Traits::kReadDerFunc(bio, nullptr));
       break;
     case DataFormat::PEM:
-      *ret = ssl_make_unique(Traits::read_pem(bio, nullptr, nullptr, nullptr));
+      *ret = ssl_make_unique(Traits::kReadPemFunc(bio, nullptr, nullptr, nullptr));
       break;
   }
   if (PREDICT_FALSE(!*ret)) {

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/e71e359a/be/src/kudu/security/tls_context.cc
----------------------------------------------------------------------
diff --git a/be/src/kudu/security/tls_context.cc b/be/src/kudu/security/tls_context.cc
index f28f31e..23b3d04 100644
--- a/be/src/kudu/security/tls_context.cc
+++ b/be/src/kudu/security/tls_context.cc
@@ -82,10 +82,10 @@ namespace security {
 using ca::CertRequestGenerator;
 
 template<> struct SslTypeTraits<SSL> {
-  static constexpr auto free = &SSL_free;
+  static constexpr auto kFreeFunc = &SSL_free;
 };
 template<> struct SslTypeTraits<X509_STORE_CTX> {
-  static constexpr auto free = &X509_STORE_CTX_free;
+  static constexpr auto kFreeFunc = &X509_STORE_CTX_free;
 };
 
 TlsContext::TlsContext()

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/e71e359a/be/src/kudu/util/debug/trace_event_impl.cc
----------------------------------------------------------------------
diff --git a/be/src/kudu/util/debug/trace_event_impl.cc b/be/src/kudu/util/debug/trace_event_impl.cc
index 122cad1..f976c87 100644
--- a/be/src/kudu/util/debug/trace_event_impl.cc
+++ b/be/src/kudu/util/debug/trace_event_impl.cc
@@ -80,12 +80,12 @@ const char* g_category_groups[MAX_CATEGORY_GROUPS] = {
 // The enabled flag is char instead of bool so that the API can be used from C.
 unsigned char g_category_group_enabled[MAX_CATEGORY_GROUPS] = { 0 };
 // Indexes here have to match the g_category_groups array indexes above.
-const int g_category_already_shutdown = 1;
-const int g_category_categories_exhausted = 2;
-const int g_category_metadata = 3;
-const int g_num_builtin_categories = 4;
+const int kCategoryAlreadyShutdown = 1;
+const int kCategoryCategoriesExhausted = 2;
+const int kCategoryMetadata = 3;
+const int kNumBuiltinCategories = 4;
 // Skip default categories.
-AtomicWord g_category_index = g_num_builtin_categories;
+AtomicWord g_category_index = kNumBuiltinCategories;
 
 // The name of the current thread. This is used to decide if the current
 // thread name has changed. We combine all the seen thread names into the
@@ -366,7 +366,7 @@ void InitializeMetadataEvent(TraceEvent* trace_event,
   ::trace_event_internal::SetTraceValue(value, &arg_type, &arg_value);
   trace_event->Initialize(thread_id,
                           MicrosecondsInt64(0), MicrosecondsInt64(0), TRACE_EVENT_PHASE_METADATA,
-                          &g_category_group_enabled[g_category_metadata],
+                          &g_category_group_enabled[kCategoryMetadata],
                           metadata_name, ::trace_event_internal::kNoEventId,
                           num_args, &arg_name, &arg_type, &arg_value, nullptr,
                           TRACE_EVENT_FLAG_NONE);
@@ -1147,8 +1147,8 @@ const unsigned char* TraceLog::GetCategoryGroupEnabled(
     const char* category_group) {
   TraceLog* tracelog = GetInstance();
   if (!tracelog) {
-    DCHECK(!g_category_group_enabled[g_category_already_shutdown]);
-    return &g_category_group_enabled[g_category_already_shutdown];
+    DCHECK(!g_category_group_enabled[kCategoryAlreadyShutdown]);
+    return &g_category_group_enabled[kCategoryAlreadyShutdown];
   }
   return tracelog->GetCategoryGroupEnabledInternal(category_group);
 }
@@ -1267,7 +1267,7 @@ const unsigned char* TraceLog::GetCategoryGroupEnabledInternal(
     base::subtle::Release_Store(&g_category_index, category_index + 1);
   } else {
     category_group_enabled =
-        &g_category_group_enabled[g_category_categories_exhausted];
+        &g_category_group_enabled[kCategoryCategoriesExhausted];
   }
   return category_group_enabled;
 }
@@ -1276,7 +1276,7 @@ void TraceLog::GetKnownCategoryGroups(
     std::vector<std::string>* category_groups) {
   SpinLockHolder lock(&lock_);
   int category_index = base::subtle::NoBarrier_Load(&g_category_index);
-  for (int i = g_num_builtin_categories; i < category_index; i++)
+  for (int i = kNumBuiltinCategories; i < category_index; i++)
     category_groups->push_back(g_category_groups[i]);
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/e71e359a/be/src/kudu/util/maintenance_manager.cc
----------------------------------------------------------------------
diff --git a/be/src/kudu/util/maintenance_manager.cc b/be/src/kudu/util/maintenance_manager.cc
index 18ed8b8..b410646 100644
--- a/be/src/kudu/util/maintenance_manager.cc
+++ b/be/src/kudu/util/maintenance_manager.cc
@@ -111,7 +111,7 @@ void MaintenanceOp::Unregister() {
   manager_->UnregisterOp(this);
 }
 
-const MaintenanceManager::Options MaintenanceManager::DEFAULT_OPTIONS = {
+const MaintenanceManager::Options MaintenanceManager::kDefaultOptions = {
   .num_threads = 0,
   .polling_interval_ms = 0,
   .history_size = 0,

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/e71e359a/be/src/kudu/util/maintenance_manager.h
----------------------------------------------------------------------
diff --git a/be/src/kudu/util/maintenance_manager.h b/be/src/kudu/util/maintenance_manager.h
index 6070e2d..1d2419a 100644
--- a/be/src/kudu/util/maintenance_manager.h
+++ b/be/src/kudu/util/maintenance_manager.h
@@ -282,7 +282,7 @@ class MaintenanceManager : public std::enable_shared_from_this<MaintenanceManage
     memory_pressure_func_ = std::move(f);
   }
 
-  static const Options DEFAULT_OPTIONS;
+  static const Options kDefaultOptions;
 
  private:
   FRIEND_TEST(MaintenanceManagerTest, TestLogRetentionPrioritization);

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/e71e359a/be/src/kudu/util/mem_tracker-test.cc
----------------------------------------------------------------------
diff --git a/be/src/kudu/util/mem_tracker-test.cc b/be/src/kudu/util/mem_tracker-test.cc
index 7e78cbe..075931a 100644
--- a/be/src/kudu/util/mem_tracker-test.cc
+++ b/be/src/kudu/util/mem_tracker-test.cc
@@ -112,11 +112,11 @@ TEST(MemTrackerTest, TrackerHierarchy) {
 
 class GcFunctionHelper {
  public:
-  static const int NUM_RELEASE_BYTES = 1;
+  static const int kNumReleaseBytes = 1;
 
   explicit GcFunctionHelper(MemTracker* tracker) : tracker_(tracker) { }
 
-  void GcFunc() { tracker_->Release(NUM_RELEASE_BYTES); }
+  void GcFunc() { tracker_->Release(kNumReleaseBytes); }
 
  private:
   MemTracker* tracker_;

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/e71e359a/be/src/kudu/util/os-util.cc
----------------------------------------------------------------------
diff --git a/be/src/kudu/util/os-util.cc b/be/src/kudu/util/os-util.cc
index 8874bd8..9ea7e08 100644
--- a/be/src/kudu/util/os-util.cc
+++ b/be/src/kudu/util/os-util.cc
@@ -51,18 +51,18 @@ namespace kudu {
 #define _SC_CLK_TCK 2
 #endif
 
-static const int64_t TICKS_PER_SEC = sysconf(_SC_CLK_TCK);
+static const int64_t kTicksPerSec = sysconf(_SC_CLK_TCK);
 
 // Offsets into the ../stat file array of per-thread statistics.
 //
 // They are themselves offset by two because the pid and comm fields of the
 // file are parsed separately.
-static const int64_t USER_TICKS = 13 - 2;
-static const int64_t KERNEL_TICKS = 14 - 2;
-static const int64_t IO_WAIT = 41 - 2;
+static const int64_t kUserTicks = 13 - 2;
+static const int64_t kKernelTicks = 14 - 2;
+static const int64_t kIoWait = 41 - 2;
 
 // Largest offset we are interested in, to check we get a well formed stat file.
-static const int64_t MAX_OFFSET = IO_WAIT;
+static const int64_t kMaxOffset = kIoWait;
 
 Status ParseStat(const std::string& buffer, std::string* name, ThreadStats* stats) {
   DCHECK(stats != nullptr);
@@ -80,19 +80,19 @@ Status ParseStat(const std::string& buffer, std::string* name, ThreadStats* stat
   string extracted_name = buffer.substr(open_paren + 1, close_paren - (open_paren + 1));
   string rest = buffer.substr(close_paren + 2);
   vector<string> splits = Split(rest, " ", strings::SkipEmpty());
-  if (splits.size() < MAX_OFFSET) {
+  if (splits.size() < kMaxOffset) {
     return Status::IOError("Unrecognised /proc format");
   }
 
   int64 tmp;
-  if (safe_strto64(splits[USER_TICKS], &tmp)) {
-    stats->user_ns = tmp * (1e9 / TICKS_PER_SEC);
+  if (safe_strto64(splits[kUserTicks], &tmp)) {
+    stats->user_ns = tmp * (1e9 / kTicksPerSec);
   }
-  if (safe_strto64(splits[KERNEL_TICKS], &tmp)) {
-    stats->kernel_ns = tmp * (1e9 / TICKS_PER_SEC);
+  if (safe_strto64(splits[kKernelTicks], &tmp)) {
+    stats->kernel_ns = tmp * (1e9 / kTicksPerSec);
   }
-  if (safe_strto64(splits[IO_WAIT], &tmp)) {
-    stats->iowait_ns = tmp * (1e9 / TICKS_PER_SEC);
+  if (safe_strto64(splits[kIoWait], &tmp)) {
+    stats->iowait_ns = tmp * (1e9 / kTicksPerSec);
   }
   if (name != nullptr) {
     *name = extracted_name;
@@ -103,7 +103,7 @@ Status ParseStat(const std::string& buffer, std::string* name, ThreadStats* stat
 
 Status GetThreadStats(int64_t tid, ThreadStats* stats) {
   DCHECK(stats != nullptr);
-  if (TICKS_PER_SEC <= 0) {
+  if (kTicksPerSec <= 0) {
     return Status::NotSupported("ThreadStats not supported");
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/e71e359a/be/src/kudu/util/process_memory.cc
----------------------------------------------------------------------
diff --git a/be/src/kudu/util/process_memory.cc b/be/src/kudu/util/process_memory.cc
index 986e15a..59fab51 100644
--- a/be/src/kudu/util/process_memory.cc
+++ b/be/src/kudu/util/process_memory.cc
@@ -84,7 +84,7 @@ Atomic64 g_released_memory_since_gc;
 // A higher value will make us call into tcmalloc less often (and therefore more
 // efficient). A lower value will mean our memory overhead is lower.
 // TODO(todd): this is a stopgap.
-const int64_t GC_RELEASE_SIZE = 128 * 1024L * 1024L;
+const int64_t kGcReleaseSize = 128 * 1024L * 1024L;
 
 #endif // TCMALLOC_ENABLED
 
@@ -264,7 +264,7 @@ void MaybeGCAfterRelease(int64_t released_bytes) {
 #ifdef TCMALLOC_ENABLED
   int64_t now_released = base::subtle::NoBarrier_AtomicIncrement(
       &g_released_memory_since_gc, -released_bytes);
-  if (PREDICT_FALSE(now_released > GC_RELEASE_SIZE)) {
+  if (PREDICT_FALSE(now_released > kGcReleaseSize)) {
     base::subtle::NoBarrier_Store(&g_released_memory_since_gc, 0);
     GcTcmalloc();
   }

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/e71e359a/be/src/kudu/util/rle-test.cc
----------------------------------------------------------------------
diff --git a/be/src/kudu/util/rle-test.cc b/be/src/kudu/util/rle-test.cc
index 185fed5..874bd71 100644
--- a/be/src/kudu/util/rle-test.cc
+++ b/be/src/kudu/util/rle-test.cc
@@ -35,7 +35,7 @@ using std::vector;
 
 namespace kudu {
 
-const int MAX_WIDTH = 64;
+const int kMaxWidth = 64;
 
 class TestRle : public KuduTest {};
 
@@ -123,7 +123,7 @@ void TestBitArrayValues(int bit_width, int num_vals) {
 }
 
 TEST(BitArray, TestValues) {
-  for (int width = 1; width <= MAX_WIDTH; ++width) {
+  for (int width = 1; width <= kMaxWidth; ++width) {
     TestBitArrayValues(width, 1);
     TestBitArrayValues(width, 2);
     // Don't write too many values
@@ -225,7 +225,7 @@ TEST(Rle, SpecificSequences) {
     ValidateRle(values, width, expected_buffer, 4);
   }
 
-  for (int width = 9; width <= MAX_WIDTH; ++width) {
+  for (int width = 9; width <= kMaxWidth; ++width) {
     ValidateRle(values, width, nullptr, 2 * (1 + BitUtil::Ceil(width, 8)));
   }
 
@@ -243,7 +243,7 @@ TEST(Rle, SpecificSequences) {
 
   // num_groups and expected_buffer only valid for bit width = 1
   ValidateRle(values, 1, expected_buffer, 1 + num_groups);
-  for (int width = 2; width <= MAX_WIDTH; ++width) {
+  for (int width = 2; width <= kMaxWidth; ++width) {
     ValidateRle(values, width, nullptr, 1 + BitUtil::Ceil(width * 100, 8));
   }
 }
@@ -260,7 +260,7 @@ void TestRleValues(int bit_width, int num_vals, int value = -1) {
 }
 
 TEST(Rle, TestValues) {
-  for (int width = 1; width <= MAX_WIDTH; ++width) {
+  for (int width = 1; width <= kMaxWidth; ++width) {
     TestRleValues(width, 1);
     TestRleValues(width, 1024);
     TestRleValues(width, 1024, 0);
@@ -320,7 +320,7 @@ TEST_F(BitRle, RandomBools) {
       }
       parity = !parity;
     }
-    ValidateRle(values, (iters % MAX_WIDTH) + 1, nullptr, -1);
+    ValidateRle(values, (iters % kMaxWidth) + 1, nullptr, -1);
   }
 }