TMAegis
More rules for apache

TMA-APACHE-2.7

Ensure the User Directories Module Is Disabled

MediumLevel 1Automatedapache

Description

The UserDir directive must be disabled so that user home directories are not accessed via the web site with a tilde (~) preceding the username. The directive also sets the path name of the directory that will be accessed. For example: http://example.com/~ralph/ might access a public_html sub-directory of ralph user's home directory. The directive UserDir ./ might map /~root to the root directory (/). Counts loaded modules matching userdir_module; expects 0. Uses the module list from apachectl -M (apache2ctl/httpd; needs root).

How it is checked

Audit method: Shell command

shell
b=$(command -v apache2ctl || command -v apachectl || command -v httpd) || exit 1; m=$("$b" ${APACHE_CONF:+-f "$APACHE_CONF"} -M 2>/dev/null) || exit 1; printf '%s\n' "$m" | grep -Eic 'userdir_module' || true
Expected output
0

How it is fixed

Fix method: Guidance or infrastructure patch

Comment out LoadModule userdir_module or run a2dismod userdir. Then run apachectl configtest and reload Apache.

Properties

Operating systems
Any
Tags
apachemodules
Reference
CIS Apache HTTP Server 2.4 Benchmark v2.4.0 - 2.7 Ensure the User Directories Module Is Disabled

Check this host

Run this on a machine you are allowed to audit. The scan is read-only.

shell
tmaegis scan --target apache