|
@@ -1522,8 +1522,10 @@ public class TestKMS {
|
|
|
conf.set("hadoop.kms.authentication.kerberos.principal", "HTTP/localhost");
|
|
|
conf.set("hadoop.kms.authentication.kerberos.name.rules", "DEFAULT");
|
|
|
|
|
|
- conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kA.ALL", "*");
|
|
|
- conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kD.ALL", "*");
|
|
|
+ final String keyA = "key_a";
|
|
|
+ final String keyD = "key_d";
|
|
|
+ conf.set(KeyAuthorizationKeyProvider.KEY_ACL + keyA + ".ALL", "*");
|
|
|
+ conf.set(KeyAuthorizationKeyProvider.KEY_ACL + keyD + ".ALL", "*");
|
|
|
|
|
|
writeConf(testDir, conf);
|
|
|
|
|
@@ -1539,7 +1541,7 @@ public class TestKMS {
|
|
|
|
|
|
try {
|
|
|
KeyProvider kp = new KMSClientProvider(uri, conf);
|
|
|
- kp.createKey("kA", new KeyProvider.Options(conf));
|
|
|
+ kp.createKey(keyA, new KeyProvider.Options(conf));
|
|
|
} catch (IOException ex) {
|
|
|
System.out.println(ex.getMessage());
|
|
|
}
|
|
@@ -1560,7 +1562,7 @@ public class TestKMS {
|
|
|
|
|
|
try {
|
|
|
KeyProvider kp = new KMSClientProvider(uri, conf);
|
|
|
- kp.createKey("kA", new KeyProvider.Options(conf));
|
|
|
+ kp.createKey(keyA, new KeyProvider.Options(conf));
|
|
|
} catch (IOException ex) {
|
|
|
System.out.println(ex.getMessage());
|
|
|
}
|
|
@@ -1569,7 +1571,7 @@ public class TestKMS {
|
|
|
@Override
|
|
|
public Void run() throws Exception {
|
|
|
KeyProvider kp = new KMSClientProvider(uri, conf);
|
|
|
- kp.createKey("kD", new KeyProvider.Options(conf));
|
|
|
+ kp.createKey(keyD, new KeyProvider.Options(conf));
|
|
|
return null;
|
|
|
}
|
|
|
});
|
|
@@ -1704,10 +1706,10 @@ public class TestKMS {
|
|
|
conf.set("hadoop.kms.authentication.kerberos.name.rules", "DEFAULT");
|
|
|
conf.set("hadoop.kms.proxyuser.client.users", "foo,bar");
|
|
|
conf.set("hadoop.kms.proxyuser.client.hosts", "*");
|
|
|
- conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kAA.ALL", "client");
|
|
|
- conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kBB.ALL", "foo");
|
|
|
- conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kCC.ALL", "foo1");
|
|
|
- conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kDD.ALL", "bar");
|
|
|
+ conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kaa.ALL", "client");
|
|
|
+ conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kbb.ALL", "foo");
|
|
|
+ conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kcc.ALL", "foo1");
|
|
|
+ conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kdd.ALL", "bar");
|
|
|
|
|
|
writeConf(testDir, conf);
|
|
|
|
|
@@ -1732,7 +1734,7 @@ public class TestKMS {
|
|
|
@Override
|
|
|
public Void run() throws Exception {
|
|
|
final KeyProvider kp = new KMSClientProvider(uri, conf);
|
|
|
- kp.createKey("kAA", new KeyProvider.Options(conf));
|
|
|
+ kp.createKey("kaa", new KeyProvider.Options(conf));
|
|
|
|
|
|
// authorized proxyuser
|
|
|
UserGroupInformation fooUgi =
|
|
@@ -1740,7 +1742,7 @@ public class TestKMS {
|
|
|
fooUgi.doAs(new PrivilegedExceptionAction<Void>() {
|
|
|
@Override
|
|
|
public Void run() throws Exception {
|
|
|
- Assert.assertNotNull(kp.createKey("kBB",
|
|
|
+ Assert.assertNotNull(kp.createKey("kbb",
|
|
|
new KeyProvider.Options(conf)));
|
|
|
return null;
|
|
|
}
|
|
@@ -1753,7 +1755,7 @@ public class TestKMS {
|
|
|
@Override
|
|
|
public Void run() throws Exception {
|
|
|
try {
|
|
|
- kp.createKey("kCC", new KeyProvider.Options(conf));
|
|
|
+ kp.createKey("kcc", new KeyProvider.Options(conf));
|
|
|
Assert.fail();
|
|
|
} catch (AuthorizationException ex) {
|
|
|
// OK
|
|
@@ -1770,7 +1772,7 @@ public class TestKMS {
|
|
|
barUgi.doAs(new PrivilegedExceptionAction<Void>() {
|
|
|
@Override
|
|
|
public Void run() throws Exception {
|
|
|
- Assert.assertNotNull(kp.createKey("kDD",
|
|
|
+ Assert.assertNotNull(kp.createKey("kdd",
|
|
|
new KeyProvider.Options(conf)));
|
|
|
return null;
|
|
|
}
|
|
@@ -1810,9 +1812,9 @@ public class TestKMS {
|
|
|
conf.set("hadoop.security.kms.client.timeout", "300");
|
|
|
conf.set("hadoop.kms.proxyuser.client.users", "foo,bar");
|
|
|
conf.set("hadoop.kms.proxyuser.client.hosts", "*");
|
|
|
- conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kAA.ALL", "foo");
|
|
|
- conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kBB.ALL", "foo1");
|
|
|
- conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kCC.ALL", "bar");
|
|
|
+ conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kaa.ALL", "foo");
|
|
|
+ conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kbb.ALL", "foo1");
|
|
|
+ conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kcc.ALL", "bar");
|
|
|
|
|
|
writeConf(testDir, conf);
|
|
|
|
|
@@ -1844,7 +1846,7 @@ public class TestKMS {
|
|
|
@Override
|
|
|
public Void run() throws Exception {
|
|
|
KeyProvider kp = new KMSClientProvider(uri, conf);
|
|
|
- Assert.assertNotNull(kp.createKey("kAA",
|
|
|
+ Assert.assertNotNull(kp.createKey("kaa",
|
|
|
new KeyProvider.Options(conf)));
|
|
|
return null;
|
|
|
}
|
|
@@ -1858,7 +1860,7 @@ public class TestKMS {
|
|
|
public Void run() throws Exception {
|
|
|
try {
|
|
|
KeyProvider kp = new KMSClientProvider(uri, conf);
|
|
|
- kp.createKey("kBB", new KeyProvider.Options(conf));
|
|
|
+ kp.createKey("kbb", new KeyProvider.Options(conf));
|
|
|
Assert.fail();
|
|
|
} catch (Exception ex) {
|
|
|
Assert.assertTrue(ex.getMessage(), ex.getMessage().contains("Forbidden"));
|
|
@@ -1874,7 +1876,7 @@ public class TestKMS {
|
|
|
@Override
|
|
|
public Void run() throws Exception {
|
|
|
KeyProvider kp = new KMSClientProvider(uri, conf);
|
|
|
- Assert.assertNotNull(kp.createKey("kCC",
|
|
|
+ Assert.assertNotNull(kp.createKey("kcc",
|
|
|
new KeyProvider.Options(conf)));
|
|
|
return null;
|
|
|
}
|