rules[refactor] Updated check/fix for nfsd

This commit is contained in:
Bob Gendler
2025-05-07 13:49:04 -04:00
parent 16d0501b28
commit 368510e41c

View File

@@ -3,13 +3,19 @@ title: Disable Network File System Service
discussion: |
Support for Network File Systems (NFS) services is non-essential and, therefore, _MUST_ be disabled.
check: |
/bin/launchctl print-disabled system | /usr/bin/grep -c '"com.apple.nfsd" => disabled'
isDisabled=$(/sbin/nfsd status | /usr/bin/awk '/nfsd service/ {print $NF}')
if [[ "$isDisabled" == "disabled" ]] && [[ -z $(/usr/bin/pgrep nfsd) ]]; then
echo "pass"
else
echo "fail"
fi
result:
integer: 1
string: "pass"
fix: |
[source,bash]
----
/bin/launchctl disable system/com.apple.nfsd
/bin/rm -rf /etc/exports
----
The system may need to be restarted for the update to take effect.
references: