os_httpd_disable Disable the Built-in Web Server
NIST macOS Security Compliance Project Sequoia Guidance, Revision 4.0 (be5491f)
All changes in this version
All changes in this version
Title
Disable the Built-in Web Server
Control
result="FAIL"
enabled=$(/bin/launchctl print-disabled system | /usr/bin/grep '"org.apache.httpd" => enabled')
running=$(/bin/launchctl print system/org.apache.httpd 2>/dev/null)
if [[ -z "$running" ]] && [[ -z "$enabled" ]]; then
result="PASS"
elif [[ -n "$running" ]]; then
result=result+" RUNNING"
elif [[ -n "$enabled" ]]; then
result=result+" ENABLED"
fi
echo $result
Discussion
The built-in web server is a non-essential service built into macOS and _MUST_ be disabled.
NOTE: The built in web server service is disabled at startup by default macOS.
Related controls
ac-17, ac-3
Fix
[source,bash]
----
/usr/sbin/apachectl stop 2>/dev/null
/bin/launchctl disable system/org.apache.httpd
----