<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://wiki.ixheim.de/index.php?action=history&amp;feed=atom&amp;title=Nginx_mit_Modsecurity_Rocky</id>
	<title>Nginx mit Modsecurity Rocky - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ixheim.de/index.php?action=history&amp;feed=atom&amp;title=Nginx_mit_Modsecurity_Rocky"/>
	<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=Nginx_mit_Modsecurity_Rocky&amp;action=history"/>
	<updated>2026-06-29T11:36:27Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Xinux Wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.ixheim.de/index.php?title=Nginx_mit_Modsecurity_Rocky&amp;diff=69411&amp;oldid=prev</id>
		<title>Thomas.will: /* Start &amp; Test */</title>
		<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=Nginx_mit_Modsecurity_Rocky&amp;diff=69411&amp;oldid=prev"/>
		<updated>2026-05-04T07:28:35Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Start &amp;amp; Test&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 4. Mai 2026, 07:28 Uhr&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l156&quot; &gt;Zeile 156:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 156:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  sudo systemctl enable --now nginx&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  sudo systemctl enable --now nginx&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Test-Backend&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/ins&gt;# Test-Backend&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  python3 -m http.server 8080 &amp;amp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  python3 -m http.server 8080 &amp;amp;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Abruf&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/ins&gt;# Abruf&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  curl -k https://localhost/&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  curl -k https://localhost/&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Block-Test&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/ins&gt;# Block-Test&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  curl -k &amp;quot;https://localhost/?param=&amp;lt;script&amp;gt;alert(1)&amp;lt;/script&amp;gt;&amp;quot; -I&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  curl -k &amp;quot;https://localhost/?param=&amp;lt;script&amp;gt;alert(1)&amp;lt;/script&amp;gt;&amp;quot; -I&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Logs verfolgen&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/ins&gt;# Logs verfolgen&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  sudo tail -f /var/log/nginx/modsec_audit.log /var/log/nginx/error.log&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  sudo tail -f /var/log/nginx/modsec_audit.log /var/log/nginx/error.log&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Thomas.will</name></author>
	</entry>
	<entry>
		<id>https://wiki.ixheim.de/index.php?title=Nginx_mit_Modsecurity_Rocky&amp;diff=64415&amp;oldid=prev</id>
		<title>Thomas.will: Die Seite wurde neu angelegt: „= NGINX + ModSecurity v3 + OWASP CRS auf Rocky Linux (RHEL-kompatibel) =  == Voraussetzungen == * Rocky Linux 8/9 (SELinux enforcing möglich) * Backend-Dienst…“</title>
		<link rel="alternate" type="text/html" href="https://wiki.ixheim.de/index.php?title=Nginx_mit_Modsecurity_Rocky&amp;diff=64415&amp;oldid=prev"/>
		<updated>2025-08-23T17:31:27Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „= NGINX + ModSecurity v3 + OWASP CRS auf Rocky Linux (RHEL-kompatibel) =  == Voraussetzungen == * Rocky Linux 8/9 (SELinux enforcing möglich) * Backend-Dienst…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= NGINX + ModSecurity v3 + OWASP CRS auf Rocky Linux (RHEL-kompatibel) =&lt;br /&gt;
&lt;br /&gt;
== Voraussetzungen ==&lt;br /&gt;
* Rocky Linux 8/9 (SELinux enforcing möglich)&lt;br /&gt;
* Backend-Dienst (z. B. http://127.0.0.1:8080)&lt;br /&gt;
* TLS-Dateien: /etc/nginx/crt.pem, /etc/nginx/privkey.pem, optional /etc/nginx/ca.crt&lt;br /&gt;
&lt;br /&gt;
== Repos aktivieren ==&lt;br /&gt;
 sudo dnf install -y epel-release&lt;br /&gt;
 # (Rocky 9) CRB einschalten, (Rocky 8) PowerTools:&lt;br /&gt;
 sudo dnf config-manager --set-enabled crb || sudo dnf config-manager --set-enabled powertools&lt;br /&gt;
&lt;br /&gt;
== Pakete installieren ==&lt;br /&gt;
 sudo dnf install -y nginx modsecurity libmodsecurity nginx-mod-modsecurity git httpd-tools&lt;br /&gt;
&lt;br /&gt;
== Verzeichnisstruktur ==&lt;br /&gt;
 sudo mkdir -p /etc/nginx/modsec&lt;br /&gt;
&lt;br /&gt;
== OWASP CRS installieren ==&lt;br /&gt;
 cd /etc/nginx/modsec&lt;br /&gt;
 sudo git clone https://github.com/coreruleset/coreruleset.git&lt;br /&gt;
 sudo cp coreruleset/crs-setup.conf.example coreruleset/crs-setup.conf&lt;br /&gt;
&lt;br /&gt;
== ModSecurity-Basisconfig ==&lt;br /&gt;
 sudo tee /etc/nginx/modsec/modsecurity.conf &amp;gt;/dev/null &amp;lt;&amp;lt;'EOF'&lt;br /&gt;
SecRuleEngine On&lt;br /&gt;
SecRequestBodyAccess On&lt;br /&gt;
SecResponseBodyAccess Off&lt;br /&gt;
&lt;br /&gt;
SecAuditEngine RelevantOnly&lt;br /&gt;
SecAuditLog /var/log/nginx/modsec_audit.log&lt;br /&gt;
SecAuditLogParts ABIJDEFHZ&lt;br /&gt;
&lt;br /&gt;
SecDebugLog /var/log/nginx/modsec_debug.log&lt;br /&gt;
SecDebugLogLevel 3&lt;br /&gt;
&lt;br /&gt;
SecTmpDir /tmp/&lt;br /&gt;
SecDataDir /tmp/&lt;br /&gt;
&lt;br /&gt;
# Testregel (optional)&lt;br /&gt;
SecRule ARGS &amp;quot;@contains script&amp;quot; &amp;quot;id:9999,phase:1,deny,log,status:403,msg:'Test rule triggered'&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# OWASP CRS&lt;br /&gt;
Include /etc/nginx/modsec/coreruleset/crs-setup.conf&lt;br /&gt;
Include /etc/nginx/modsec/coreruleset/rules/*.conf&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
== NGINX-ModSecurity-Snippet ==&lt;br /&gt;
 sudo tee /etc/nginx/modsec/main.conf &amp;gt;/dev/null &amp;lt;&amp;lt;'EOF'&lt;br /&gt;
modsecurity on;&lt;br /&gt;
modsecurity_rules_file /etc/nginx/modsec/modsecurity.conf;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
== NGINX Modul laden (wichtig auf Rocky) ==&lt;br /&gt;
# In /etc/nginx/nginx.conf ganz oben NACH &amp;quot;user&amp;quot; und VOR &amp;quot;events&amp;quot; einfügen:&lt;br /&gt;
 load_module modules/ngx_http_modsecurity_module.so;&lt;br /&gt;
&lt;br /&gt;
# Zusätzlich im http{}-Block das Logformat ergänzen (siehe &amp;quot;Logging&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
== Site-Config (/etc/nginx/conf.d/waf.conf) ==&lt;br /&gt;
 sudo tee /etc/nginx/conf.d/waf.conf &amp;gt;/dev/null &amp;lt;&amp;lt;'EOF'&lt;br /&gt;
# HTTP → HTTPS Redirect&lt;br /&gt;
server {&lt;br /&gt;
    listen 80;&lt;br /&gt;
    server_name _;&lt;br /&gt;
    return 301 https://$host$request_uri;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# HTTPS mit ModSecurity&lt;br /&gt;
server {&lt;br /&gt;
    listen 443 ssl;&lt;br /&gt;
    server_name _;&lt;br /&gt;
&lt;br /&gt;
    ssl_certificate     /etc/nginx/crt.pem;&lt;br /&gt;
    ssl_certificate_key /etc/nginx/privkey.pem;&lt;br /&gt;
    # Nur wenn mTLS gewünscht:&lt;br /&gt;
    # ssl_client_certificate /etc/nginx/ca.crt;&lt;br /&gt;
&lt;br /&gt;
    ssl_protocols TLSv1.2 TLSv1.3;&lt;br /&gt;
    ssl_prefer_server_ciphers on;&lt;br /&gt;
    ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384';&lt;br /&gt;
&lt;br /&gt;
    access_log /var/log/nginx/access.log waf_combined;&lt;br /&gt;
    error_log  /var/log/nginx/error.log warn;&lt;br /&gt;
&lt;br /&gt;
    add_header Strict-Transport-Security &amp;quot;max-age=31536000; includeSubDomains&amp;quot; always;&lt;br /&gt;
    add_header Cache-Control &amp;quot;no-store, no-cache, must-revalidate&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
    error_page 403 /403.html;&lt;br /&gt;
    location = /403.html {&lt;br /&gt;
        root /usr/share/nginx/html;&lt;br /&gt;
        internal;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    include /etc/nginx/modsec/main.conf;&lt;br /&gt;
&lt;br /&gt;
    location / {&lt;br /&gt;
        proxy_pass http://127.0.0.1:8080;&lt;br /&gt;
        proxy_set_header Host $host;&lt;br /&gt;
        proxy_set_header X-Real-IP $remote_addr;&lt;br /&gt;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    # Optional: Audit-Log im Browser (Basic-Auth)&lt;br /&gt;
    location /_waflog {&lt;br /&gt;
        alias /var/log/nginx/modsec_audit.log;&lt;br /&gt;
        types { }&lt;br /&gt;
        default_type text/plain;&lt;br /&gt;
&lt;br /&gt;
        auth_basic &amp;quot;ModSecurity Auditlog&amp;quot;;&lt;br /&gt;
        auth_basic_user_file /etc/nginx/.htpasswd;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
== Fehlerseite (optional) ==&lt;br /&gt;
 sudo tee /usr/share/nginx/html/403.html &amp;gt;/dev/null &amp;lt;&amp;lt;'EOF'&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
 &amp;lt;head&amp;gt;&amp;lt;title&amp;gt;403 Forbidden&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;
 &amp;lt;body&amp;gt;&lt;br /&gt;
 &amp;lt;h1&amp;gt;Oops! Zugriff verweigert&amp;lt;/h1&amp;gt;&lt;br /&gt;
 &amp;lt;p&amp;gt;Deine Anfrage wurde von der Web Application Firewall blockiert.&amp;lt;/p&amp;gt;&lt;br /&gt;
 &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
== Logging (in /etc/nginx/nginx.conf, im http{}-Block) ==&lt;br /&gt;
# In den http-Block einfügen:&lt;br /&gt;
 log_format waf_combined '$remote_addr - $remote_user [$time_local] '&lt;br /&gt;
                         '&amp;quot;$request&amp;quot; $status $body_bytes_sent '&lt;br /&gt;
                         '&amp;quot;$http_referer&amp;quot; &amp;quot;$http_user_agent&amp;quot; '&lt;br /&gt;
                         'ModSecID=$request_id Host=&amp;quot;$host&amp;quot; URI=&amp;quot;$request_uri&amp;quot;';&lt;br /&gt;
&lt;br /&gt;
== Logdateien anlegen und Rechte ==&lt;br /&gt;
 sudo touch /var/log/nginx/modsec_audit.log /var/log/nginx/modsec_debug.log&lt;br /&gt;
 sudo chown nginx:nginx /var/log/nginx/modsec_*.log&lt;br /&gt;
 sudo chmod 640 /var/log/nginx/modsec_*.log&lt;br /&gt;
&lt;br /&gt;
== Basic-Auth für /_waflog (optional) ==&lt;br /&gt;
 sudo htpasswd -c /etc/nginx/.htpasswd admin&lt;br /&gt;
&lt;br /&gt;
== SELinux (empfohlen statt Abschalten) ==&lt;br /&gt;
# NGINX darf zu Backends verbinden:&lt;br /&gt;
 sudo setsebool -P httpd_can_network_connect 1&lt;br /&gt;
# Wenn Logs unter /var/log/nginx bleiben, passt der Kontext. Bei eigenen Pfaden ggf.:&lt;br /&gt;
# sudo semanage fcontext -a -t httpd_log_t &amp;quot;/var/log/nginx(/.*)?&amp;quot;&lt;br /&gt;
# sudo restorecon -Rv /var/log/nginx&lt;br /&gt;
&lt;br /&gt;
== Firewall (Firewalld) ==&lt;br /&gt;
 sudo firewall-cmd --permanent --add-service=https&lt;br /&gt;
 sudo firewall-cmd --permanent --add-service=http&lt;br /&gt;
 sudo firewall-cmd --reload&lt;br /&gt;
&lt;br /&gt;
== Start &amp;amp; Test ==&lt;br /&gt;
 sudo nginx -t&lt;br /&gt;
 sudo systemctl enable --now nginx&lt;br /&gt;
&lt;br /&gt;
# Test-Backend&lt;br /&gt;
 python3 -m http.server 8080 &amp;amp;&lt;br /&gt;
# Abruf&lt;br /&gt;
 curl -k https://localhost/&lt;br /&gt;
# Block-Test&lt;br /&gt;
 curl -k &amp;quot;https://localhost/?param=&amp;lt;script&amp;gt;alert(1)&amp;lt;/script&amp;gt;&amp;quot; -I&lt;br /&gt;
&lt;br /&gt;
# Logs verfolgen&lt;br /&gt;
 sudo tail -f /var/log/nginx/modsec_audit.log /var/log/nginx/error.log&lt;br /&gt;
&lt;br /&gt;
== Hinweise ==&lt;br /&gt;
* crs-setup.conf definiert Paranoia-Level, Variablen und Schwellenwerte.&lt;br /&gt;
* Regeln liegen unter /etc/nginx/modsec/coreruleset/rules/.&lt;br /&gt;
* Zugriff auf /_waflog erlaubt Audit-Log-Ansicht im Browser (Basic-Auth).&lt;br /&gt;
* ModSecurity greift nur, wenn include /etc/nginx/modsec/main.conf in der Server-Config enthalten ist.&lt;br /&gt;
* Auf Rocky MUSS das Modul explizit via load_module modules/ngx_http_modsecurity_module.so; in nginx.conf geladen werden.&lt;br /&gt;
&lt;br /&gt;
[[KATEGORIE:WAF]]&lt;/div&gt;</summary>
		<author><name>Thomas.will</name></author>
	</entry>
</feed>