-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKDC.py
More file actions
42 lines (33 loc) · 843 Bytes
/
KDC.py
File metadata and controls
42 lines (33 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
### Implements "Key Distriution Center" ###
from AuthServer import AuthServer
from TGS import TGS
from DBManager import DBManager
from config import *
class KDC:
def __init__(self, isTGS=0):
print "Key Distribution Center initiated"
self.db = DBManager(DB)
self.isTGS = isTGS
self._authServer = AuthServer(host='localhost',
port=AUTH_PORT,
key=AUTH_KEY,
crt=AUTH_CRT,
db=self.db)
self._TGS = TGS(host='localhost',
port=TGS_PORT,
key=TGS_KEY,
crt=TGS_CRT,
db=self.db)
def getServerPool(self):
try:
if self.isTGS:
return [self._authServer, self._TGS]
else:
return [self._authServer]
except Exception as e:
print str(e)
def getSocketPool(self):
try:
return [s.getSocket() for s in self.getServerPool()]
except Exception as e:
print str(e)