Use install to setup permissions directly

This commit is contained in:
Timothée Ravier 2024-01-25 10:39:33 +01:00
parent c8094c553d
commit e3e7bad0ce

View File

@ -158,17 +158,15 @@ if [ "$files" -eq 0 ] ; then
echo "No rules detected, adding default" echo "No rules detected, adding default"
%if 0%{?rhel} %if 0%{?rhel}
if [ -e %{_datadir}/%{name}-rules/10-base-config.rules ] ; then if [ -e %{_datadir}/%{name}-rules/10-base-config.rules ] ; then
cp %{_datadir}/%{name}-rules/10-base-config.rules /etc/audit/rules.d/audit.rules install -m 0600 -u 0 -g 0 -p %{_datadir}/%{name}-rules/10-base-config.rules /etc/audit/rules.d/audit.rules
%else %else
# FESCO asked for audit to be off by default. #1117953 # FESCO asked for audit to be off by default. #1117953
if [ -e %{_datadir}/%{name}-rules/10-no-audit.rules ] ; then if [ -e %{_datadir}/%{name}-rules/10-no-audit.rules ] ; then
cp %{_datadir}/%{name}-rules/10-no-audit.rules /etc/audit/rules.d/audit.rules install -m 0600 -u 0 -g 0 -p %{_datadir}/%{name}-rules/10-no-audit.rules /etc/audit/rules.d/audit.rules
%endif %endif
else else
touch /etc/audit/rules.d/audit.rules install -m 0600 -u 0 -g 0 /dev/null /etc/audit/rules.d/audit.rules
fi fi
# Fix up permissions
chmod 0600 /etc/audit/rules.d/audit.rules
# Make the new rules active # Make the new rules active
augenrules --load || true augenrules --load || true
fi fi