TMAegis
apache için daha fazla kural

TMA-APACHE-5.2

Ensure Options for the Web Root Directory Are Restricted

DüşükDüzey 2Otomatikapache

Açıklama

The Apache Options directive allows for specific configuration of options, including: Execution of CGI Following symbolic links Server side includes Content negotiation Every <Directory> block for a DocumentRoot must contain a single Options directive set to None or MultiViews; a DocumentRoot without its own <Directory> block fails. Reads the main configuration (APACHE_CONF overrides; default /etc/apache2/apache2.conf, /etc/httpd/conf/httpd.conf or /usr/local/apache2/conf/httpd.conf) and every Include/IncludeOptional file.

Nasıl denetlenir

Denetim yöntemi: Kabuk komutu

shell
c=${APACHE_CONF:-}; if [ -z "$c" ]; then for f in /etc/apache2/apache2.conf /etc/httpd/conf/httpd.conf /usr/local/apache2/conf/httpd.conf /etc/apache2/httpd.conf; do [ -f "$f" ] && { c=$f; break; }; done; fi; [ -r "$c" ] || exit 1; R=$(awk 'tolower($1)=="serverroot"{v=$2; gsub(/"/,"",v); print v; exit}' "$c"); [ -n "$R" ] || R=$(dirname "$c"); shopt -s nocasematch; inc(){ local p g l; [ ${#FUNCNAME[@]} -lt 16 ] || return 0; p=$1; case $p in /*) ;; *) p=$R/$p;; esac; [ -d "$p" ] && p="$p/*"; for g in $p; do [ -f "$g" ] || continue; while IFS= read -r l || [ -n "$l" ]; do if [[ $l =~ ^[[:space:]]*include(optional)?[[:space:]]+\"?([^\"[:space:]]+) ]]; then inc "${BASH_REMATCH[2]}"; else printf '%s\n' "$l"; fi; done < "$g"; done; }; cfg=$(inc "$c" | sed -e 's/^[[:space:]]*//' -e '/^#/d' -e '/^$/d'); shopt -u nocasematch; dr=$(printf '%s\n' "$cfg" | awk 'tolower($1)=="documentroot"{v=$2; gsub(/"/,"",v); sub(/\/$/,"",v); printf "%s|", v}'); printf '%s\n' "$cfg" | awk -v D="$dr" 'BEGIN{n=split(D,t,"|"); for(i=1;i<=n;i++) if(t[i]!="") want[t[i]]=1} /^<[Dd]irectory[[:space:]]/{x=$2; gsub(/[">]/,"",x); sub(/\/$/,"",x); cur=(x in want)?x:""; next} /^<\/[Dd]irectory>/{cur=""; next} cur!="" && tolower($1)=="options"{c[cur]++; v=tolower($2); if(NF==2 && (v=="none"||v=="multiviews")) ok[cur]++} END{k=0; for(w in want){k++; if(c[w]!=1||ok[w]!=1) bad=1} print (k>0&&!bad)?"compliant":"noncompliant"}'
Beklenen çıktı
compliant

Nasıl düzeltilir

Düzeltme yöntemi: Kılavuz veya altyapı yaması

In each DocumentRoot <Directory> block set Options None (or Options MultiViews). Then run apachectl configtest and reload Apache.

Özellikler

İşletim sistemleri
Herhangi biri
Etiketler
apachefeatures
Referans
CIS Apache HTTP Server 2.4 Benchmark v2.4.0 - 5.2 Ensure Options for the Web Root Directory Are Restricted

Bu ana makineyi denetle

Bunu denetleme izniniz olan bir makinede çalıştırın. Tarama salt okunurdur.

shell
tmaegis scan --target apache --level 2