Esempio n. 1
0
	def __init__(self, params, keyMgr, collector):
		''' Default constructor.
		'''	
		super(Logger, self).__init__()
		self._stop = threading.Event()
		self.params = params

		# Create the policy actor
		self.manager = PolicyManager.start(params, keyMgr)

		# Create the encryption module and Keccak instance
		self.keyMgr = keyMgr
		self.collector = collector
		self.encryptionModule = EncryptionModule(keyMgr)
		self.sha3 = Keccak.Keccak()
		self.aesMode = AES.MODE_CBC

		# The in-memory keys that are maintained (and discarded as needed)
		self.initialEpochKey = {}
		self.initialEntityKey = {}
		self.epochKey = {} # key is (user, session)
		self.entityKey = {} # key is (user, session)
		self.policyKeyMap = {} # key is (user, session, policy)

		# Create the log queue
		self.queue = Queue.Queue()

		# Set up the Python logger
		logFile = 'abls.log'
		logging.basicConfig(filename=logFile,level=logging.DEBUG)
Esempio n. 2
0
	def __init__(self, params, keyMgr, collector):
		''' Default constructor.
		'''	
		super(Logger, self).__init__()
		self._stop = threading.Event()
		self.params = params

		# Create the policy actor
		self.manager = PolicyManager.start(params, keyMgr)

		# Create the encryption module and Keccak instance
		self.keyMgr = keyMgr
		self.collector = collector
		self.encryptionModule = EncryptionModule(keyMgr)
		self.sha3 = Keccak.Keccak()
		self.aesMode = AES.MODE_CBC

		# The in-memory keys that are maintained (and discarded as needed)
		self.initialEpochKey = {}
		self.initialEntityKey = {}
		self.epochKey = {} # key is (user, session)
		self.entityKey = {} # key is (user, session)
		self.policyKeyMap = {} # key is (user, session, policy)

		# Create the log queue
		self.queue = Queue.Queue()

		# Create the RabbitMQ connection
		self.connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
		self.channel = self.connection.channel()
		self.channel.queue_declare(queue='log') # Ensure the log queue is there
		self.channel.basic_consume(self.logCallback,
             	        	queue='log',
                	     	no_ack=True)

		# Set up the Python logger
		logFile = 'abls.log'
		logging.basicConfig(filename=logFile,level=logging.DEBUG)
Esempio n. 3
0
# Maps for crypto data structures
initialLogEntityKey = {}
initialEventEntityKey = {}
logEntityKey = {}
eventEntityKey = {}
policyKeyMap = {}

# Crypto entities
keyMgr = KeyManager()
encryptionModule = EncryptionModule(keyMgr)
sha3 = Keccak()
aesMode = AES.MODE_CBC

# The policy manager
params = {"USER_DB" : "/Users/caw/Projects/SecureLoggingSystem/src/v2/user.db", "LOG_DB" : "/Users/caw/Projects/SecureLoggingSystem/src/v2/log.db", "KEY_DB" : "/Users/caw/Projects/SecureLoggingSystem/src/v2/key.db"}
manager = PolicyManager.start(params, keyMgr)

# Create the shims...
logShim = DBShim(params["LOG_DB"], keyMgr)
keyShim = DBShim(params["KEY_DB"], keyMgr)

def createSession(userId, sessionId):
	''' Initialize the authentication keys that are used when verifying the 
	entries in the log database.
	'''

	# Generate the epoch and entity keys (both are random 32-bytes strings) - used for verification (integrity) only
	epochKey = Random.new().read(32)
	logEntityKey = Random.new().read(32)
	eventEntityKey = Random.new().read(32)