You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/02/10 13:03:38 UTC

[GitHub] [iceberg] ggershinsky commented on a change in pull request #4080: Add VaultKmsClient as an example KMS client implementation

ggershinsky commented on a change in pull request #4080:
URL: https://github.com/apache/iceberg/pull/4080#discussion_r803649065



##########
File path: core/src/test/java/org/apache/iceberg/encryption/kms/VaultKmsClient.java
##########
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iceberg.encryption.kms;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import java.util.Base64;
+import java.util.HashMap;
+import java.util.Map;
+import okhttp3.ConnectionSpec;
+import okhttp3.MediaType;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.RequestBody;
+import okhttp3.Response;
+import org.apache.iceberg.encryption.KmsClient;
+
+
+/**
+ * Example of a KMS client for testing and demonstrations; not for use in production.
+ * An implementation of {@link KmsClient} that relies on Hashicorp Vault transit engine to
+ * manage encryption keys.
+ * On initialization it is manadatory to set the properties {@link VaultKmsClient#KMS_INSTANCE_URL_PROP}
+ * and {@link VaultKmsClient#ACCESS_TOKEN_PROP}.
+ * Authentication to Vault is done using an access token passed in {@link VaultKmsClient#ACCESS_TOKEN_PROP}.
+ * If token is changed - {@link VaultKmsClient#initialize(Map)} should be called again with the new
+ * token in property {@link VaultKmsClient#ACCESS_TOKEN_PROP}.
+ * Pre-requisite: install Hashicorp Vault and enable transit engine as per
+ * https://www.vaultproject.io/docs/secrets/transit
+ */
+public class VaultKmsClient implements KmsClient {
+  /**
+   * Property name for Vault access token.
+   */
+  public static final String ACCESS_TOKEN_PROP = "keystore.kms.client.access.token";
+
+  /**
+   * Property name for Vault instance URL
+   */
+  public static final String KMS_INSTANCE_URL_PROP = "keystore.kms.client.instance.url";

Review comment:
       "keystore" -> "vault" ? or even "kms.client.vault.instance.url"?

##########
File path: core/src/test/java/org/apache/iceberg/encryption/kms/VaultKmsClient.java
##########
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iceberg.encryption.kms;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import java.util.Base64;
+import java.util.HashMap;
+import java.util.Map;
+import okhttp3.ConnectionSpec;
+import okhttp3.MediaType;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.RequestBody;
+import okhttp3.Response;
+import org.apache.iceberg.encryption.KmsClient;
+
+
+/**
+ * Example of a KMS client for testing and demonstrations; not for use in production.
+ * An implementation of {@link KmsClient} that relies on Hashicorp Vault transit engine to
+ * manage encryption keys.
+ * On initialization it is manadatory to set the properties {@link VaultKmsClient#KMS_INSTANCE_URL_PROP}
+ * and {@link VaultKmsClient#ACCESS_TOKEN_PROP}.
+ * Authentication to Vault is done using an access token passed in {@link VaultKmsClient#ACCESS_TOKEN_PROP}.
+ * If token is changed - {@link VaultKmsClient#initialize(Map)} should be called again with the new
+ * token in property {@link VaultKmsClient#ACCESS_TOKEN_PROP}.
+ * Pre-requisite: install Hashicorp Vault and enable transit engine as per
+ * https://www.vaultproject.io/docs/secrets/transit
+ */
+public class VaultKmsClient implements KmsClient {
+  /**
+   * Property name for Vault access token.
+   */
+  public static final String ACCESS_TOKEN_PROP = "keystore.kms.client.access.token";

Review comment:
       "keystore" -> "vault" ?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org