Access Control List (ACL) Added

Control permit or deny with a list of subscriber IDs. Thanks to Peter
Martin for the idea.
This commit is contained in:
Cort Buffington 2016-05-03 20:15:55 -05:00
parent 1d51980281
commit 52afb05517
1 changed files with 6 additions and 1 deletions

View File

@ -116,6 +116,7 @@ try:
logger.info('Subscriber access control file found, subscriber ACL imported')
except ImportError:
logger.critical('\'sub_acl.py\' not found - all subscriber IDs are valid')
ACL_ACTION = 'NONE'
# Depending on which type of ACL is used (PERMIT, DENY... or there isn't one)
# define a differnet function to be used to check the ACL
@ -123,10 +124,14 @@ if ACL_ACTION == 'PERMIT':
def allow_sub(_sub):
if _sub in ACL:
return True
else:
return False
elif ACL_ACTION == 'DENY':
def allow_sub(_sub):
if _sub not in ACL:
return True
else:
return False
else:
def allow_sub(_sub):
return True
@ -187,7 +192,7 @@ class bridgeIPSC(IPSC):
# Check for ACL match, and return if the subscriber is not allowed
if allow_sub(_src_sub) == False:
logger.debug('(%s) Group Voice Packet ***REJECTED BY ACL*** From: %s, IPSC Peer %s, Destination %s', _network, int_id(_src_sub), int_id(_peerid), int_id(_dst_group))
logger.warning('(%s) Group Voice Packet ***REJECTED BY ACL*** From: %s, IPSC Peer %s, Destination %s', _network, int_id(_src_sub), int_id(_peerid), int_id(_dst_group))
return
# Process the packet