Skip to content

Commit

Permalink
Merge pull request #12230 from Security-Onion-Solutions/reyesj2-patch-sl
Browse files Browse the repository at this point in the history
Handle non-zero
  • Loading branch information
reyesj2 authored Jan 23, 2024
2 parents de6151f + 350b0df commit d25a2d4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions salt/common/tools/sbin/so-common-status-check
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ def check_needs_restarted():
def check_for_fips():
fips = 0
try:
result = subprocess.run(['fips-mode-setup', '--is-enabled'], check=True, stdout=subprocess.PIPE)
fips = int(result.returncode == 0)
result = subprocess.run(['fips-mode-setup', '--is-enabled'], stdout=subprocess.PIPE)
if result.returncode == 0:
fips = 1
except FileNotFoundError:
with open('/proc/sys/crypto/fips_enabled', 'r') as f:
contents = f.read()
if '1' in contents:
fips = 1
else:
fips = 0

with open('/opt/so/log/sostatus/fips_enabled', 'w') as f:
f.write(str(fips))

Expand All @@ -61,8 +61,9 @@ def check_for_luks():
for gc in device['children']:
if 'children' in gc:
try:
result = subprocess.run(['cryptsetup', 'isLuks', gc['name']], check=True, stdout=subprocess.PIPE)
luks = int(result.returncode == 0)
result = subprocess.run(['cryptsetup', 'isLuks', gc['name']], stdout=subprocess.PIPE)
if result.returncode == 0:
luks = 1
except FileNotFoundError:
for ggc in gc['children']:
if 'crypt' in ggc['type']:
Expand Down

0 comments on commit d25a2d4

Please sign in to comment.