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:
parent
1d51980281
commit
52afb05517
@ -116,6 +116,7 @@ try:
|
|||||||
logger.info('Subscriber access control file found, subscriber ACL imported')
|
logger.info('Subscriber access control file found, subscriber ACL imported')
|
||||||
except ImportError:
|
except ImportError:
|
||||||
logger.critical('\'sub_acl.py\' not found - all subscriber IDs are valid')
|
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)
|
# 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
|
# define a differnet function to be used to check the ACL
|
||||||
@ -123,10 +124,14 @@ if ACL_ACTION == 'PERMIT':
|
|||||||
def allow_sub(_sub):
|
def allow_sub(_sub):
|
||||||
if _sub in ACL:
|
if _sub in ACL:
|
||||||
return True
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
elif ACL_ACTION == 'DENY':
|
elif ACL_ACTION == 'DENY':
|
||||||
def allow_sub(_sub):
|
def allow_sub(_sub):
|
||||||
if _sub not in ACL:
|
if _sub not in ACL:
|
||||||
return True
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
else:
|
else:
|
||||||
def allow_sub(_sub):
|
def allow_sub(_sub):
|
||||||
return True
|
return True
|
||||||
@ -187,7 +192,7 @@ class bridgeIPSC(IPSC):
|
|||||||
|
|
||||||
# Check for ACL match, and return if the subscriber is not allowed
|
# Check for ACL match, and return if the subscriber is not allowed
|
||||||
if allow_sub(_src_sub) == False:
|
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
|
return
|
||||||
|
|
||||||
# Process the packet
|
# Process the packet
|
||||||
|
Loading…
x
Reference in New Issue
Block a user