mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-08 10:12:53 +01:00
Check for IP environment variable in so-allow and so-deny
This commit is contained in:
@@ -183,21 +183,25 @@ def main():
|
|||||||
return_code = e.errno
|
return_code = e.errno
|
||||||
sys.exit(return_code)
|
sys.exit(return_code)
|
||||||
elif args.roles is not None and args.ip is None:
|
elif args.roles is not None and args.ip is None:
|
||||||
main_parser.print_help()
|
if os.environ.get('IP') is None:
|
||||||
else:
|
main_parser.print_help()
|
||||||
if validate_ip_cidr(args.ip):
|
sys.exit(1)
|
||||||
try:
|
|
||||||
for role in args.roles:
|
|
||||||
return_code = apply(role, args.ip)
|
|
||||||
if return_code > 0:
|
|
||||||
break
|
|
||||||
except Exception as e:
|
|
||||||
print(f'Unexpected exception occurred: {e}', file=sys.stderr)
|
|
||||||
return_code = e.errno
|
|
||||||
else:
|
else:
|
||||||
print(f'Invalid IP address or CIDR block \'{args.ip}\', please try again.', file=sys.stderr)
|
args.ip = os.environ['IP']
|
||||||
return_code = 1
|
|
||||||
|
if validate_ip_cidr(args.ip):
|
||||||
|
try:
|
||||||
|
for role in args.roles:
|
||||||
|
return_code = apply(role, args.ip)
|
||||||
|
if return_code > 0:
|
||||||
|
break
|
||||||
|
except Exception as e:
|
||||||
|
print(f'Unexpected exception occurred: {e}', file=sys.stderr)
|
||||||
|
return_code = e.errno
|
||||||
|
else:
|
||||||
|
print(f'Invalid IP address or CIDR block \'{args.ip}\', please try again.', file=sys.stderr)
|
||||||
|
return_code = 1
|
||||||
|
|
||||||
sys.exit(return_code)
|
sys.exit(return_code)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -184,21 +184,25 @@ def main():
|
|||||||
return_code = e.errno
|
return_code = e.errno
|
||||||
sys.exit(return_code)
|
sys.exit(return_code)
|
||||||
elif args.roles is not None and args.ip is None:
|
elif args.roles is not None and args.ip is None:
|
||||||
main_parser.print_help()
|
if os.environ.get('IP') is None:
|
||||||
else:
|
main_parser.print_help()
|
||||||
if validate_ip_cidr(args.ip):
|
sys.exit(1)
|
||||||
try:
|
|
||||||
for role in args.roles:
|
|
||||||
return_code = apply(role, args.ip)
|
|
||||||
if return_code > 0:
|
|
||||||
break
|
|
||||||
except Exception as e:
|
|
||||||
print(f'Unexpected exception occurred: {e}', file=sys.stderr)
|
|
||||||
return_code = e.errno
|
|
||||||
else:
|
else:
|
||||||
print(f'Invalid IP address or CIDR block \'{args.ip}\', please try again.', file=sys.stderr)
|
args.ip = os.environ['IP']
|
||||||
return_code = 1
|
|
||||||
|
if validate_ip_cidr(args.ip):
|
||||||
|
try:
|
||||||
|
for role in args.roles:
|
||||||
|
return_code = apply(role, args.ip)
|
||||||
|
if return_code > 0:
|
||||||
|
break
|
||||||
|
except Exception as e:
|
||||||
|
print(f'Unexpected exception occurred: {e}', file=sys.stderr)
|
||||||
|
return_code = e.errno
|
||||||
|
else:
|
||||||
|
print(f'Invalid IP address or CIDR block \'{args.ip}\', please try again.', file=sys.stderr)
|
||||||
|
return_code = 1
|
||||||
|
|
||||||
sys.exit(return_code)
|
sys.exit(return_code)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user