HSTS zu aktivieren

  • Bei welchen Anbieter: Lokal?
  • Auf welcher Hardware: Nano r5c
  • Betriebssystem: Debian 12.6
  • Nextcloud Version: 29.07
  • PHP Version: 8.2
  • Welche Datenbank: MariaDB
  • Apache2
  • Netzwerk Aufgliederung: Router
  • Wurden vor kurzen Server Updates gemacht von 29.06 auf 29.07
  • Habt ihr die Logs angesehen von Nextcloud und von System ja
  • Bei was fĂŒr einer Aktion ist der Fehler aufgetreten: Update von 29.06 auf 29.07

Seit den Update von 29.06 auf 29.07 erscheinen folgende Warnhinweise:

Einige Header sind in deiner Instanz nicht richtig eingestellt - Der HTTP-Header X-Content-Type-Options ist nicht auf nosniff gesetzt. Dies stellt ein potenzielles Sicherheits- oder Datenschutzrisiko dar und es wird empfohlen, diese Einstellung zu Ă€ndern. - Der HTTP-Header X-Robots-Tag ist nicht auf noindex,nofollow gesetzt. Dies stellt ein potenzielles Sicherheits- oder Datenschutzrisiko dar und es wird empfohlen, diese Einstellung zu Ă€ndern. - Der HTTP-Header X-Frame-Options ist nicht auf sameorigin gesetzt. Dies stellt ein potenzielles Sicherheits- oder Datenschutzrisiko dar und es wird empfohlen, diese Einstellung zu Ă€ndern. - Der HTTP-Header X-Permitted-Cross-Domain-Policies ist nicht auf none gesetzt. Dies stellt ein potenzielles Sicherheits- oder Datenschutzrisiko dar und es wird empfohlen, diese Einstellung zu Ă€ndern. - Der HTTP-Header X-XSS-Protection enthĂ€lt nicht 1; mode=block. Dies stellt ein potenzielles Sicherheits- oder Datenschutzrisiko dar und es wird empfohlen, diese Einstellung zu Ă€ndern. - Der Strict-Transport-Security-HTTP-Header ist nicht gesetzt (er sollte mindestens 15552000 Sekunden betragen). FĂŒr erhöhte Sicherheit wird empfohlen, HSTS zu aktivieren. Weitere Informationen findest du in der Dokumentation :arrow_upper_right:

Meine .htacess schaut so aus:

<IfModule mod_headers.c>
  <IfModule mod_setenvif.c>
    <IfModule mod_fcgid.c>
       SetEnvIfNoCase ^Authorization$ "(.+)" XAUTHORIZATION=$1
       RequestHeader set XAuthorization %{XAUTHORIZATION}e env=XAUTHORIZATION
    </IfModule>
    <IfModule mod_proxy_fcgi.c>
       SetEnvIfNoCase Authorization "(.+)" HTTP_AUTHORIZATION=$1
    </IfModule>
    <IfModule mod_lsapi.c>
      SetEnvIfNoCase ^Authorization$ "(.+)" XAUTHORIZATION=$1
      RequestHeader set XAuthorization %{XAUTHORIZATION}e env=XAUTHORIZATION
    </IfModule>
  </IfModule>

  <IfModule mod_env.c>
    # Add security and privacy related headers

    # Avoid doubled headers by unsetting headers in "onsuccess" table,
    # then add headers to "always" table: https://github.com/nextcloud/server/pull/19002
    Header onsuccess unset Referrer-Policy
    Header always set Referrer-Policy "no-referrer"

    Header onsuccess unset X-Content-Type-Options
    Header always set X-Content-Type-Options "nosniff"

    Header onsuccess unset X-Frame-Options
    Header always set X-Frame-Options "SAMEORIGIN"

    Header onsuccess unset X-Permitted-Cross-Domain-Policies
    Header always set X-Permitted-Cross-Domain-Policies "none"

    Header onsuccess unset X-Robots-Tag
    Header always set X-Robots-Tag "noindex, nofollow"

    Header onsuccess unset X-XSS-Protection
    Header always set X-XSS-Protection "1; mode=block"

    SetEnv modHeadersAvailable true
  </IfModule>

  # Add cache control for static resources
  <FilesMatch "\.(css|js|mjs|svg|gif|png|jpg|ico|wasm|tflite)$">
    <If "%{QUERY_STRING} =~ /(^|&)v=/">
      Header set Cache-Control "max-age=15778463, immutable"
    </If>
    <Else>
      Header set Cache-Control "max-age=15778463"
    </Else>
  </FilesMatch>

  # Let browsers cache WOFF files for a week
  <FilesMatch "\.woff2?$">
    Header set Cache-Control "max-age=604800"
  </FilesMatch>
</IfModule>

<IfModule mod_php.c>
  php_value mbstring.func_overload 0
  php_value default_charset 'UTF-8'
  php_value output_buffering 0
  <IfModule mod_env.c>
    SetEnv htaccessWorking true
  </IfModule>
</IfModule>

<IfModule mod_mime.c>
  AddType image/svg+xml svg svgz
  AddType application/wasm wasm
  AddEncoding gzip svgz
  # Serve ESM javascript files (.mjs) with correct mime type
  AddType text/javascript js mjs
</IfModule>

<IfModule mod_dir.c>
  DirectoryIndex index.php index.html
</IfModule>

Wenn ich folgenden Befehl absetzte:

curl -I bika-the.xxxx.xxx8443

bekomme ich folgende Antwort
HTTP/1.1 400 Bad Request
Date: Sat, 21 Sep 2024 13:21:00 GMT
Server: Apache/2.4.62 (Debian)
Strict-Transport-Security: max-age=31536000
Content-Length: 454
Connection: close
Content-Type: text/html; charset=iso-8859-1

Also sollte eigentlich alles stimmen

Versuche mal folgende Header (Bitte nicht copy paste, meine sind im Caddy format hier):

header {
    Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
    X-Robots-Tag "noindex,nofollow"
    X-Download-Options "noopen"
    X-Permitted-Cross-Domain-Policies "none"
    X-Frame-Options "sameorigin"
    X-XSS-Protection "1; mode=block"
    X-Content-Type-Options "nosniff"
    Referrer-Policy "no-referrer"
}

Warum verwendest du den Port im curl Befehl?

Hallo gelbphoenix,

ich verwende den Port 8443 deshalb, weil auf Port 80 und 443 ein phpbb-Forum lÀuft.

Den Curl Befehl muß ich ja mit https anwenden und dann kommt folgendes heraus:
curl -I https://bika-the.xxxxx.xxxx:8443

HTTP/1.1 302 Found
Date: Sat, 21 Sep 2024 20:11:08 GMT
Server: Apache/2.4.62 (Debian)
Strict-Transport-Security: max-age=31536000
Referrer-Policy: no-referrer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-Robots-Tag: noindex, nofollow
X-XSS-Protection: 1; mode=block
Set-Cookie: oc5a69rvlnuf=kd5f85e0im95bev4uipvsutjot; path=/; secure; HttpOnly; SameSite=Lax
Set-Cookie: oc_sessionPassphrase=RW7RV2HGEFze%2FYpWFK6H7%2Bh%2BJsSYplmEwKRVyU9mAWUScVr7LIlwy0JGhrcy2NgbI57oaO0xz4CjDRXBEr1E0wcyaE3NIqkCUgzyaciDVWVVhh4RQAk%2BzeL5%2FPYlfOMe; path=/; secure; HttpOnly; SameSite=Lax
Set-Cookie: oc5a69rvlnuf=kd5f85e0im95bev4uipvsutjot; path=/; secure; HttpOnly; SameSite=Lax
Content-Security-Policy: default-src ‘self’; script-src ‘self’ ‘nonce-OXMvSFpLbmtDQ0F2TDNQSWtWWXFRVkltbVpPbWNQcTBxK1hSR1lFQnVXYz06dFByMkhNeVNPWHBNUlRxN3BqcGdPREZ0eXZuV0tZTDd5bzJZY3V4WGdGYz0=’; style-src ‘self’ ‘unsafe-inline’; frame-src *; img-src * data: blob:; font-src ‘self’ data:; media-src *; connect-src *; object-src ‘none’; base-uri ‘self’;
Set-Cookie: __Host-nc_sameSiteCookielax=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax
Set-Cookie: __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=strict
Set-Cookie: oc5a69rvlnuf=kd5f85e0im95bev4uipvsutjot; path=/; secure; HttpOnly; SameSite=Lax
Location: https://bika-the.xxxxxr.xxxx:8443/index.php/login
Content-Type: text/html; charset=UTF-8

Wenn ich danach gehe stimmt es ja was ich in der .htacess eingetragen habe.
Nextcloud meldet es mir dennoch als nicht angewandt an

Die Fehlermeldung kommt nur wenn ich nicht die Standard Ports 80 /443 verwende

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.