Search in sources :

Example 6 with SimpleKdcServer

use of org.apache.kerby.kerberos.kerb.server.SimpleKdcServer in project testcases by coheigea.

the class HDFSKerberosTest method configureKerby.

private static void configureKerby(String baseDir) throws Exception {
    // System.setProperty("sun.security.krb5.debug", "true");
    System.setProperty("java.security.krb5.conf", baseDir + "/target/krb5.conf");
    kerbyServer = new SimpleKdcServer();
    kerbyServer.setKdcRealm("hadoop.apache.org");
    kerbyServer.setAllowUdp(false);
    kerbyServer.setWorkDir(new File(baseDir + "/target"));
    kerbyServer.init();
    // Create principals
    String alice = "alice@hadoop.apache.org";
    String bob = "bob@hadoop.apache.org";
    String hdfs = "hdfs/localhost@hadoop.apache.org";
    String http = "HTTP/localhost@hadoop.apache.org";
    kerbyServer.createPrincipal(alice, "alice");
    File keytabFile = new File(baseDir + "/target/alice.keytab");
    kerbyServer.exportPrincipal(alice, keytabFile);
    kerbyServer.createPrincipal(bob, "bob");
    keytabFile = new File(baseDir + "/target/bob.keytab");
    kerbyServer.exportPrincipal(bob, keytabFile);
    kerbyServer.createPrincipal(hdfs, "hdfs");
    kerbyServer.createPrincipal(http, "http");
    keytabFile = new File(baseDir + "/target/hdfs.keytab");
    kerbyServer.exportPrincipal(hdfs, keytabFile);
    kerbyServer.exportPrincipal(http, keytabFile);
    kerbyServer.start();
}
Also used : File(java.io.File) SimpleKdcServer(org.apache.kerby.kerberos.kerb.server.SimpleKdcServer)

Example 7 with SimpleKdcServer

use of org.apache.kerby.kerberos.kerb.server.SimpleKdcServer in project testcases by coheigea.

the class KafkaRangerGSSAuthorizerTest method configureKerby.

private static void configureKerby(String baseDir) throws Exception {
    // System.setProperty("sun.security.krb5.debug", "true");
    System.setProperty("java.security.krb5.conf", baseDir + "/target/krb5.conf");
    kerbyServer = new SimpleKdcServer();
    kerbyServer.setKdcRealm("kafka.apache.org");
    kerbyServer.setAllowUdp(false);
    kerbyServer.setWorkDir(new File(baseDir + "/target"));
    kerbyServer.init();
    // Create principals
    String zookeeper = "zookeeper/127.0.0.1@kafka.apache.org";
    String kafka = "kafka/localhost@kafka.apache.org";
    String client = "client@kafka.apache.org";
    kerbyServer.createPrincipal(zookeeper, "zookeeper");
    File keytabFile = new File(baseDir + "/target/zookeeper.keytab");
    kerbyServer.exportPrincipal(zookeeper, keytabFile);
    kerbyServer.createPrincipal(kafka, "kafka");
    keytabFile = new File(baseDir + "/target/kafka.keytab");
    kerbyServer.exportPrincipal(kafka, keytabFile);
    kerbyServer.createPrincipal(client, "client");
    keytabFile = new File(baseDir + "/target/client.keytab");
    kerbyServer.exportPrincipal(client, keytabFile);
    kerbyServer.start();
}
Also used : File(java.io.File) SimpleKdcServer(org.apache.kerby.kerberos.kerb.server.SimpleKdcServer)

Example 8 with SimpleKdcServer

use of org.apache.kerby.kerberos.kerb.server.SimpleKdcServer in project testcases by coheigea.

the class HadoopKerbyTest method setUp.

@BeforeClass
public static void setUp() throws Exception {
    String basedir = System.getProperty("basedir");
    if (basedir == null) {
        basedir = new File(".").getCanonicalPath();
    }
    System.setProperty("sun.security.krb5.debug", "true");
    // System.setProperty("java.security.auth.login.config", basedir + "/target/test-classes/kerberos/kerberos.jaas");
    kerbyServer = new SimpleKdcServer();
    kerbyServer.setKdcRealm("hadoop.apache.org");
    kerbyServer.setAllowUdp(false);
    kerbyServer.setWorkDir(new File(basedir + "/target"));
    // kerbyServer.setInnerKdcImpl(new NettyKdcServerImpl(kerbyServer.getKdcSetting()));
    kerbyServer.init();
    // Create principals
    String alice = "alice@hadoop.apache.org";
    String bob = "bob@hadoop.apache.org";
    String ranger = "ranger/localhost@hadoop.apache.org";
    String hdfs = "hdfs/localhost@hadoop.apache.org";
    String http = "HTTP/localhost@hadoop.apache.org";
    kerbyServer.createPrincipal(alice, "alice");
    File keytabFile = new File(basedir + "/target/alice.keytab");
    kerbyServer.exportPrincipal(alice, keytabFile);
    kerbyServer.createPrincipal(bob, "bob");
    keytabFile = new File(basedir + "/target/bob.keytab");
    kerbyServer.exportPrincipal(bob, keytabFile);
    kerbyServer.createPrincipal(hdfs, "hdfs");
    kerbyServer.createPrincipal(http, "http");
    keytabFile = new File(basedir + "/target/hdfs.keytab");
    kerbyServer.exportPrincipal(hdfs, keytabFile);
    kerbyServer.exportPrincipal(http, keytabFile);
    kerbyServer.createPrincipal(ranger, "ranger");
    keytabFile = new File(basedir + "/target/ranger.keytab");
    kerbyServer.exportPrincipal(ranger, keytabFile);
    kerbyServer.exportPrincipal(http, keytabFile);
    kerbyServer.start();
}
Also used : File(java.io.File) SimpleKdcServer(org.apache.kerby.kerberos.kerb.server.SimpleKdcServer) BeforeClass(org.junit.BeforeClass)

Example 9 with SimpleKdcServer

use of org.apache.kerby.kerberos.kerb.server.SimpleKdcServer in project testcases by coheigea.

the class HiveKerbyTest method setUp.

@BeforeClass
public static void setUp() throws Exception {
    String basedir = System.getProperty("basedir");
    if (basedir == null) {
        basedir = new File(".").getCanonicalPath();
    }
    System.setProperty("sun.security.krb5.debug", "true");
    // System.setProperty("java.security.auth.login.config", basedir + "/target/test-classes/kerberos/kerberos.jaas");
    kerbyServer = new SimpleKdcServer();
    kerbyServer.setKdcRealm("hadoop.apache.org");
    kerbyServer.setAllowUdp(false);
    kerbyServer.setWorkDir(new File(basedir + "/target"));
    // kerbyServer.setInnerKdcImpl(new NettyKdcServerImpl(kerbyServer.getKdcSetting()));
    kerbyServer.init();
    // Create principals
    String hive = "hiveserver2/localhost@hadoop.apache.org";
    String hdfs = "hdfs/localhost@hadoop.apache.org";
    String http = "HTTP/localhost@hadoop.apache.org";
    String mapred = "mapred/localhost@hadoop.apache.org";
    String alice = "alice@hadoop.apache.org";
    kerbyServer.createPrincipal(hive, "hiveserver2");
    File keytabFile = new File(basedir + "/target/hiveserver2.keytab");
    kerbyServer.exportPrincipal(hive, keytabFile);
    kerbyServer.createPrincipal(hdfs, "hdfs");
    kerbyServer.createPrincipal(http, "http");
    keytabFile = new File(basedir + "/target/hdfs.keytab");
    kerbyServer.exportPrincipal(hdfs, keytabFile);
    kerbyServer.exportPrincipal(http, keytabFile);
    kerbyServer.createPrincipal(mapred, "mapred");
    keytabFile = new File(basedir + "/target/mapred.keytab");
    kerbyServer.exportPrincipal(mapred, keytabFile);
    kerbyServer.createPrincipal(alice, "alice");
    keytabFile = new File(basedir + "/target/alice.keytab");
    kerbyServer.exportPrincipal(alice, keytabFile);
    kerbyServer.start();
}
Also used : File(java.io.File) SimpleKdcServer(org.apache.kerby.kerberos.kerb.server.SimpleKdcServer) BeforeClass(org.junit.BeforeClass)

Example 10 with SimpleKdcServer

use of org.apache.kerby.kerberos.kerb.server.SimpleKdcServer in project testcases by coheigea.

the class KafkaKerbyTest method setUp.

@BeforeClass
public static void setUp() throws Exception {
    String basedir = System.getProperty("basedir");
    if (basedir == null) {
        basedir = new File(".").getCanonicalPath();
    }
    System.setProperty("sun.security.krb5.debug", "true");
    // System.setProperty("java.security.auth.login.config", basedir + "/target/test-classes/kerberos/kerberos.jaas");
    kerbyServer = new SimpleKdcServer();
    kerbyServer.setKdcRealm("kafka.apache.org");
    kerbyServer.setAllowUdp(false);
    kerbyServer.setWorkDir(new File(basedir + "/target"));
    // kerbyServer.setInnerKdcImpl(new NettyKdcServerImpl(kerbyServer.getKdcSetting()));
    kerbyServer.init();
    // Create principals
    String zookeeper = "zookeeper/localhost@kafka.apache.org";
    String kafka = "kafka/localhost@kafka.apache.org";
    String client = "client@kafka.apache.org";
    kerbyServer.createPrincipal(zookeeper, "zookeeper");
    File keytabFile = new File(basedir + "/target/zookeeper.keytab");
    kerbyServer.exportPrincipal(zookeeper, keytabFile);
    kerbyServer.createPrincipal(kafka, "kafka");
    keytabFile = new File(basedir + "/target/kafka.keytab");
    kerbyServer.exportPrincipal(kafka, keytabFile);
    kerbyServer.createPrincipal(client, "client");
    keytabFile = new File(basedir + "/target/client.keytab");
    kerbyServer.exportPrincipal(client, keytabFile);
    kerbyServer.start();
}
Also used : File(java.io.File) SimpleKdcServer(org.apache.kerby.kerberos.kerb.server.SimpleKdcServer) BeforeClass(org.junit.BeforeClass)

Aggregations

SimpleKdcServer (org.apache.kerby.kerberos.kerb.server.SimpleKdcServer)25 File (java.io.File)22 BeforeClass (org.junit.BeforeClass)14 NettyKdcServerImpl (org.apache.kerby.kerberos.kdc.impl.NettyKdcServerImpl)6 KrbConfig (org.apache.kerby.kerberos.kerb.client.KrbConfig)3 IOException (java.io.IOException)2 URL (java.net.URL)2 SpnegoTestUtil (org.apache.calcite.avatica.SpnegoTestUtil)2 KrbException (org.apache.kerby.kerberos.kerb.KrbException)2 JwtTokenProvider (org.apache.kerby.kerberos.provider.token.JwtTokenProvider)2 Provider (java.security.Provider)1 STSServer (org.apache.cxf.systest.kerberos.wssec.sts.STSServer)1 StaxSTSServer (org.apache.cxf.systest.kerberos.wssec.sts.StaxSTSServer)1 KerbyGssProvider (org.apache.kerby.kerberos.kerb.gss.KerbyGssProvider)1