mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-07 09:42:46 +01:00
Fix #6317 - Do not attempt to whitelist when wazuh isn't enabled
This commit is contained in:
@@ -79,10 +79,10 @@ def ip_prompt() -> str:
|
|||||||
|
|
||||||
|
|
||||||
def wazuh_enabled() -> bool:
|
def wazuh_enabled() -> bool:
|
||||||
for file in os.listdir(f'{LOCAL_SALT_DIR}/pillar'):
|
file = f'{LOCAL_SALT_DIR}/pillar/global.sls'
|
||||||
with open(file, 'r') as pillar:
|
with open(file, 'r') as pillar:
|
||||||
if 'wazuh: 1' in pillar.read():
|
if 'wazuh: 1' in pillar.read():
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ def apply(role: str, ip: str) -> int:
|
|||||||
else:
|
else:
|
||||||
return cmd.returncode
|
return cmd.returncode
|
||||||
if cmd.returncode == 0:
|
if cmd.returncode == 0:
|
||||||
if wazuh_enabled and role=='analyst':
|
if wazuh_enabled() and role=='analyst':
|
||||||
try:
|
try:
|
||||||
add_wl(ip)
|
add_wl(ip)
|
||||||
print(f'Added whitelist entry for {ip} from {WAZUH_CONF}', file=sys.stderr)
|
print(f'Added whitelist entry for {ip} from {WAZUH_CONF}', file=sys.stderr)
|
||||||
|
|||||||
Reference in New Issue
Block a user