mirror of https://gitlab.com/bashrc2/epicyon
Instance level allow list
parent
557ca1e787
commit
721ff8ddf5
12
blocking.py
12
blocking.py
|
@ -175,6 +175,9 @@ def isBlockedDomain(baseDir: str, domain: str) -> bool:
|
|||
if noOfSections > 2:
|
||||
shortDomain = domain[noOfSections-2] + '.' + domain[noOfSections-1]
|
||||
|
||||
allowFilename = baseDir + '/accounts/allowedinstances.txt'
|
||||
if not os.path.isfile(allowFilename):
|
||||
# instance block list
|
||||
globalBlockingFilename = baseDir + '/accounts/blocking.txt'
|
||||
if os.path.isfile(globalBlockingFilename):
|
||||
with open(globalBlockingFilename, 'r') as fpBlocked:
|
||||
|
@ -184,6 +187,15 @@ def isBlockedDomain(baseDir: str, domain: str) -> bool:
|
|||
if shortDomain:
|
||||
if '*@' + shortDomain in blockedStr:
|
||||
return True
|
||||
else:
|
||||
# instance allow list
|
||||
if not shortDomain:
|
||||
if domain not in open(allowFilename).read():
|
||||
return True
|
||||
else:
|
||||
if shortDomain not in open(allowFilename).read():
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue