Search in sources :

Example 11 with KeyProviderCryptoExtension

use of org.apache.hadoop.crypto.key.KeyProviderCryptoExtension in project hadoop by apache.

the class TestEncryptionZonesWithHA method setupCluster.

@Before
public void setupCluster() throws Exception {
    conf = new Configuration();
    conf.setInt(DFSConfigKeys.DFS_HA_TAILEDITS_PERIOD_KEY, 1);
    HAUtil.setAllowStandbyReads(conf, true);
    fsHelper = new FileSystemTestHelper();
    String testRoot = fsHelper.getTestRootDir();
    testRootDir = new File(testRoot).getAbsoluteFile();
    conf.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_KEY_PROVIDER_PATH, JavaKeyStoreProvider.SCHEME_NAME + "://file" + new Path(testRootDir.toString(), "test.jks").toUri());
    cluster = new MiniDFSCluster.Builder(conf).nnTopology(MiniDFSNNTopology.simpleHATopology()).numDataNodes(1).build();
    cluster.waitActive();
    cluster.transitionToActive(0);
    fs = (DistributedFileSystem) HATestUtil.configureFailoverFs(cluster, conf);
    DFSTestUtil.createKey(TEST_KEY, cluster, 0, conf);
    DFSTestUtil.createKey(TEST_KEY, cluster, 1, conf);
    nn0 = cluster.getNameNode(0);
    nn1 = cluster.getNameNode(1);
    dfsAdmin0 = new HdfsAdmin(cluster.getURI(0), conf);
    dfsAdmin1 = new HdfsAdmin(cluster.getURI(1), conf);
    KeyProviderCryptoExtension nn0Provider = cluster.getNameNode(0).getNamesystem().getProvider();
    fs.getClient().setKeyProvider(nn0Provider);
}
Also used : FileSystemTestHelper(org.apache.hadoop.fs.FileSystemTestHelper) Path(org.apache.hadoop.fs.Path) Configuration(org.apache.hadoop.conf.Configuration) HdfsAdmin(org.apache.hadoop.hdfs.client.HdfsAdmin) KeyProviderCryptoExtension(org.apache.hadoop.crypto.key.KeyProviderCryptoExtension) File(java.io.File) Before(org.junit.Before)

Aggregations

KeyProviderCryptoExtension (org.apache.hadoop.crypto.key.KeyProviderCryptoExtension)11 IOException (java.io.IOException)9 KeyProvider (org.apache.hadoop.crypto.key.KeyProvider)9 Configuration (org.apache.hadoop.conf.Configuration)7 URI (java.net.URI)6 EncryptedKeyVersion (org.apache.hadoop.crypto.key.KeyProviderCryptoExtension.EncryptedKeyVersion)6 Test (org.junit.Test)6 KeyVersion (org.apache.hadoop.crypto.key.KeyProvider.KeyVersion)5 Options (org.apache.hadoop.crypto.key.KeyProvider.Options)5 File (java.io.File)4 HashMap (java.util.HashMap)4 SocketTimeoutException (java.net.SocketTimeoutException)3 Map (java.util.Map)3 UserProvider (org.apache.hadoop.crypto.key.UserProvider)3 KeyACLs (org.apache.hadoop.crypto.key.kms.server.KeyAuthorizationKeyProvider.KeyACLs)3 UserGroupInformation (org.apache.hadoop.security.UserGroupInformation)3 AuthorizationException (org.apache.hadoop.security.authorize.AuthorizationException)3 PrivilegedExceptionAction (java.security.PrivilegedExceptionAction)2 FileNotFoundException (java.io.FileNotFoundException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1