Exemplo n.º 1
0
 def test_guess_key_format(self):
     origprog = afsutil.cmd.ASETKEY
     afsutil.cmd.ASETKEY = asetkey_new
     k = Keytab()
     principal = "afs/xyzzy@LOCALREALM"
     k.add_fake_key(principal)
     self.assertEquals(k._guess_key_format(principal), 'extended')
     afsutil.cmd.ASETKEY = origprog
Exemplo n.º 2
0
 def test_create_fake_des_key(self):
     fd,filename = tempfile.mkstemp()
     try:
         k = Keytab()
         k.add_fake_key("afs/localcell@LOCALCELL", enctype='des-cbc-crc')
         k.write(filename)
         out = subprocess.check_output(["klist", "-e", "-k", "-t", filename]).splitlines()
         self.assertEquals(len(out), 4)
         self.assertTrue(out[0].startswith("Keytab name"))
         self.assertTrue(out[1].startswith("KVNO Timestamp"))
         self.assertTrue(out[2].startswith("----"))
         self.assertTrue("afs/localcell@LOCALCELL" in out[3])
         self.assertTrue("des-cbc-crc" in out[3])
     finally:
         os.close(fd)
         os.remove(filename)
Exemplo n.º 3
0
 def test_create_fake_aes_key(self):
     fd, filename = tempfile.mkstemp()
     try:
         k = Keytab()
         k.add_fake_key("afs/localcell@LOCALCELL")
         k.write(filename)
         out = subprocess.check_output(
             ["klist", "-e", "-k", "-t", filename]).splitlines()
         self.assertEquals(len(out), 4)
         self.assertTrue(out[0].startswith("Keytab name"))
         self.assertTrue(out[1].startswith("KVNO Timestamp"))
         self.assertTrue(out[2].startswith("----"))
         self.assertTrue("afs/localcell@LOCALCELL" in out[3])
         self.assertTrue("aes256-cts-hmac-sha1-96" in out[3])
     finally:
         os.close(fd)
         os.remove(filename)
Exemplo n.º 4
0
 def test_guess_key_format(self):
     k = Keytab()
     principal = "afs/xyzzy@LOCALREALM"
     k.add_fake_key(principal)
     self.assertEquals(k._guess_key_format(principal), 'extended')
Exemplo n.º 5
0
 def test_service_principals_1(self):
     k = Keytab()
     k.add_fake_key("afs/foobar@FOOBAR")
     self.assertEquals(len(k.service_principals()), 1)
Exemplo n.º 6
0
 def test_service_principals_1(self):
     k = Keytab()
     k.add_fake_key("afs/foobar@FOOBAR")
     self.assertEquals(len(k.service_principals()), 1)