コード例 #1
0
 /// <exception cref="System.Exception"/>
 public virtual void TestNoDigestAuthMissingPass2()
 {
     zkClientConf.Set(KeyRegistryClientAuth, RegistryClientAuthDigest);
     zkClientConf.Set(KeyRegistryClientAuthenticationId, "id");
     zkClientConf.Set(KeyRegistryClientAuthenticationPassword, string.Empty);
     RegistryOperationsFactory.CreateInstance("DigestRegistryOperations", zkClientConf
                                              );
 }
コード例 #2
0
            /// <exception cref="System.Exception"/>
            public RegistryOperations Run()
            {
                RegistryOperations operations = RegistryOperationsFactory.CreateKerberosInstance(
                    this._enclosing.zkClientConf, AbstractSecureRegistryTest.ZookeeperClientContext);

                this._enclosing.AddToTeardown(operations);
                operations.Start();
                return(operations);
            }
コード例 #3
0
        public RegistryCli(TextWriter sysout, TextWriter syserr)
        {
            Configuration conf = new Configuration();

            base.SetConf(conf);
            registry = RegistryOperationsFactory.CreateInstance(conf);
            registry.Start();
            this.sysout = sysout;
            this.syserr = syserr;
        }
コード例 #4
0
        public virtual void TestAnonNoWriteAccessOffRoot()
        {
            RMRegistryOperationsService rmRegistryOperations = StartRMRegistryOperations();

            Describe(Log, "testAnonNoWriteAccessOffRoot");
            RegistryOperations operations = RegistryOperationsFactory.CreateAnonymousInstance
                                                (zkClientConf);

            AddToTeardown(operations);
            operations.Start();
            NUnit.Framework.Assert.IsFalse("mknode(/)", operations.Mknode("/", false));
            ExpectMkNodeFailure(operations, "/sub");
            ExpectDeleteFailure(operations, PathSystemServices, true);
        }
コード例 #5
0
        public virtual void TestAnonNoWriteAccess()
        {
            RMRegistryOperationsService rmRegistryOperations = StartRMRegistryOperations();

            Describe(Log, "testAnonNoWriteAccess");
            RegistryOperations operations = RegistryOperationsFactory.CreateAnonymousInstance
                                                (zkClientConf);

            AddToTeardown(operations);
            operations.Start();
            string servicePath = PathSystemServices + "hdfs";

            ExpectMkNodeFailure(operations, servicePath);
        }
コード例 #6
0
        public virtual void TestAnonReadAccess()
        {
            RMRegistryOperationsService rmRegistryOperations = StartRMRegistryOperations();

            Describe(Log, "testAnonReadAccess");
            RegistryOperations operations = RegistryOperationsFactory.CreateAnonymousInstance
                                                (zkClientConf);

            AddToTeardown(operations);
            operations.Start();
            NUnit.Framework.Assert.IsFalse("RegistrySecurity.isClientSASLEnabled()==true", RegistrySecurity
                                           .IsClientSASLEnabled());
            operations.List(PathSystemServices);
        }
コード例 #7
0
        public virtual void TestAlicePathRestrictedAnonAccess()
        {
            RMRegistryOperationsService rmRegistryOperations = StartRMRegistryOperations();
            string aliceHome = rmRegistryOperations.InitUserRegistry(Alice);

            Describe(Log, "Creating anonymous accessor");
            RegistryOperations anonOperations = RegistryOperationsFactory.CreateAnonymousInstance
                                                    (zkClientConf);

            AddToTeardown(anonOperations);
            anonOperations.Start();
            anonOperations.List(aliceHome);
            ExpectMkNodeFailure(anonOperations, aliceHome + "/anon");
            ExpectDeleteFailure(anonOperations, aliceHome, true);
        }
コード例 #8
0
        public virtual void TestDigestAccess()
        {
            RMRegistryOperationsService registryAdmin = StartRMRegistryOperations();
            string id   = "username";
            string pass = "******";

            registryAdmin.AddWriteAccessor(id, pass);
            IList <ACL> clientAcls = registryAdmin.GetClientAcls();

            Log.Info("Client ACLS=\n{}", RegistrySecurity.AclsToString(clientAcls));
            string @base = "/digested";

            registryAdmin.Mknode(@base, false);
            IList <ACL> baseACLs = registryAdmin.ZkGetACLS(@base);
            string      aclset   = RegistrySecurity.AclsToString(baseACLs);

            Log.Info("Base ACLs=\n{}", aclset);
            ACL found = null;

            foreach (ACL acl in baseACLs)
            {
                if (ZookeeperConfigOptions.SchemeDigest.Equals(acl.GetId().GetScheme()))
                {
                    found = acl;
                    break;
                }
            }
            NUnit.Framework.Assert.IsNotNull("Did not find digest entry in ACLs " + aclset, found
                                             );
            zkClientConf.Set(KeyRegistryUserAccounts, "sasl:[email protected], sasl:other"
                             );
            RegistryOperations operations = RegistryOperationsFactory.CreateAuthenticatedInstance
                                                (zkClientConf, id, pass);

            AddToTeardown(operations);
            operations.Start();
            RegistryOperationsClient operationsClient = (RegistryOperationsClient)operations;
            IList <ACL> digestClientACLs = operationsClient.GetClientAcls();

            Log.Info("digest client ACLs=\n{}", RegistrySecurity.AclsToString(digestClientACLs
                                                                              ));
            operations.Stat(@base);
            operations.Mknode(@base + "/subdir", false);
            ZKPathDumper pathDumper = registryAdmin.DumpPath(true);

            Log.Info(pathDumper.ToString());
        }
コード例 #9
0
 /// <exception cref="System.Exception"/>
 public virtual void TestNoDigestAuthMissingPass()
 {
     RegistryOperationsFactory.CreateAuthenticatedInstance(zkClientConf, "id", string.Empty
                                                           );
 }