A security administrator is hardening an Apache HTTP Server 2.4 configuration on Ubuntu to protect web applications against Cross-Site Scripting (XSS) and clickjacking. Which directives should be added to the httpd.conf file to enforce a Content Security Policy (CSP) and prevent framing?
Trap 1: TraceEnable Off and ServerTokens Prod
TraceEnable and ServerTokens harden server information disclosure and HTTP methods, not CSP or clickjacking protection.
Trap 2: FileETag None and Options -Indexes
FileETag and Options -Indexes prevent information leakage and directory listing, not XSS or framing.
Trap 3: SecurityHeadersEngine On followed by SetFrameOptions DENY
SecurityHeadersEngine is not a valid directive in standard Apache httpd configuration.
- A
LoadModule headers_module modules/mod_headers.so followed by Header set X-Frame-Options 'DENY' and Header set Content-Security-Policy "default-src 'self'"
Loading mod_headers.so enables the Header directive, which Apache otherwise rejects. `Header set Content-Security-Policy "default-src 'self'"` restricts script and resource origins, mitigating XSS, while `X-Frame-Options 'DENY'` blocks all framing, satisfying the clickjacking constraint. Both are response headers, so mod_headers is mandatory.
- B
TraceEnable Off and ServerTokens Prod
Why it fails: TraceEnable and ServerTokens harden server information disclosure and HTTP methods, not CSP or clickjacking protection.
- C
FileETag None and Options -Indexes
Why it fails: FileETag and Options -Indexes prevent information leakage and directory listing, not XSS or framing.
- D
SecurityHeadersEngine On followed by SetFrameOptions DENY
Why it fails: SecurityHeadersEngine is not a valid directive in standard Apache httpd configuration.