Skip to content

Commit

Permalink
Merge pull request #2256 from wazuh/2197-fix-sca-wildcard
Browse files Browse the repository at this point in the history
Support empty ruleset/sca directories
  • Loading branch information
Dwordcito authored Jul 7, 2023
2 parents bbbc2f3 + 5e69a36 commit 87f4e7f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 6 additions & 4 deletions debs/SPECS/wazuh-agent/debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ case "$1" in
done
fi

# Set correct permissions, owner and group
chmod 640 ${DIR}/ruleset/sca/*
chown root:${GROUP} ${DIR}/ruleset/sca/*
# Set correct permissions, owner and group. ruleset directory may be empty.
if [ -z "$(ls -A ${DIR}/ruleset/sca/)" ]; then
chmod --recursive u=rwX,g=rX,o= ${DIR}/ruleset/sca/
chown --recursive root:${GROUP} ${DIR}/ruleset/sca/
fi
# Delete the temporary directory
rm -rf ${SCA_BASE_DIR}

Expand Down Expand Up @@ -205,4 +207,4 @@ case "$1" in

esac

exit 0
exit 0
8 changes: 5 additions & 3 deletions debs/SPECS/wazuh-manager/debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,11 @@ case "$1" in
done
fi

# Set correct permissions, owner and group
chmod 640 ${DIR}/ruleset/sca/*
chown root:${GROUP} ${DIR}/ruleset/sca/*
# Set correct permissions, owner and group. ruleset directory may be empty.
if [ -z "$(ls -A ${DIR}/ruleset/sca/)" ]; then
chmod --recursive u=rwX,g=rX,o= ${DIR}/ruleset/sca/
chown --recursive root:${GROUP} ${DIR}/ruleset/sca/
fi
# Delete the temporary directory
rm -rf ${SCA_BASE_DIR}

Expand Down

0 comments on commit 87f4e7f

Please sign in to comment.