Aktionen

ISPConfig ab 3.1.x - Webinterface als Subdomain auf Port 443 https einrichten: Unterschied zwischen den Versionen

Aus znilwiki

 
Zeile 49: Zeile 49:
                         SetHandler None
                         SetHandler None
                 </FilesMatch>
                 </FilesMatch>
        </Directory>
        </Directory>
        <Directory /usr/local/ispconfig/interface/web/>
        <Directory /usr/local/ispconfig/interface/web/>
                 <FilesMatch "\.ph(p3?|tml)$">
                 <FilesMatch "\.ph(p3?|tml)$">
                        SetHandler None
                        SetHandler None
                 </FilesMatch>
                 </FilesMatch>
        </Directory>
      </Directory>
   
   
        <IfModule mod_fcgid.c>
      <IfModule mod_fcgid.c>
                DocumentRoot /var/www/ispconfig/
              DocumentRoot /var/www/ispconfig/
                SuexecUserGroup ispconfig ispconfig
              SuexecUserGroup ispconfig ispconfig
                <Directory /var/www/ispconfig/>
              <Directory /var/www/ispconfig/>
                        Options -Indexes +FollowSymLinks +MultiViews +ExecCGI
                    Options -Indexes +FollowSymLinks +MultiViews +ExecCGI
                        AllowOverride AuthConfig Indexes Limit Options FileInfo
                    AllowOverride AuthConfig Indexes Limit Options FileInfo
                        <FilesMatch "\.php$">
                    <FilesMatch "\.php$">
                                SetHandler fcgid-script
                            SetHandler fcgid-script
                        </FilesMatch>
                    </FilesMatch>
                        FCGIWrapper /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter .php
                    FCGIWrapper /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter .php
                        Require all granted
                    Require all granted
                </Directory>
            </Directory>
                IPCCommTimeout  7200
            IPCCommTimeout  7200
                MaxRequestLen 15728640
            MaxRequestLen 15728640
        </IfModule>
      </IfModule>
   
   
        <IfModule mpm_itk_module>
      <IfModule mpm_itk_module>
                DocumentRoot /usr/local/ispconfig/interface/web/
            DocumentRoot /usr/local/ispconfig/interface/web/
                AssignUserId ispconfig ispconfig
            AssignUserId ispconfig ispconfig
                AddType application/x-httpd-php .php
            AddType application/x-httpd-php .php
                <Directory /usr/local/ispconfig/interface/web>
            <Directory /usr/local/ispconfig/interface/web>
                        # php_admin_value open_basedir "/usr/local/ispconfig/interface:/usr/share:/tmp"
                    # php_admin_value open_basedir "/usr/local/ispconfig/interface:/usr/share:/tmp"
                        Options +FollowSymLinks
                    Options +FollowSymLinks
                        AllowOverride None
                    AllowOverride None
                        Require all granted
                    Require all granted
                        php_value magic_quotes_gpc        0
                    php_value magic_quotes_gpc        0
                </Directory>
            </Directory>
        </IfModule>
      </IfModule>
   
   
        # ErrorLog /var/log/apache2/error.log
      # ErrorLog /var/log/apache2/error.log
        # CustomLog /var/log/apache2/access.log combined
      # CustomLog /var/log/apache2/access.log combined
        ServerSignature Off
      ServerSignature Off
      <IfModule mod_security2.c>
            SecRuleEngine Off
      </IfModule>
      # SSL Configuration
   
   
        <IfModule mod_security2.c>
      # SSL Configuration
                SecRuleEngine Off
      SSLEngine On
        </IfModule>
      SSLProtocol All -SSLv3 -TLSv1 -TLSv1.1
      <span style="background:lightgreen">SSLCertificateFile /var/www/clients/client0/web1/ssl/webdghb.znil.org-le.crt</span>
      <span style="background:lightgreen">SSLCertificateKeyFile /var/www/clients/client0/web1/ssl/webdghb.znil.org-le.key</span>
      SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
      SSLHonorCipherOrder On
   
   
        # SSL Configuration
    <IfModule mod_headers.c>
            # ISPConfig 3.1 currently requires unsafe-line for both scripts and styles, as well as unsafe-eval
            Header set Content-Security-Policy "default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' data:; object-src 'none'"
            Header set Content-Security-Policy "default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' data:; object-src 'none'; upgrade-insecure-requests"
            Header set X-Content-Type-Options: nosniff
            Header set X-Frame-Options: SAMEORIGIN
            Header set X-XSS-Protection: "1; mode=block"
            Header always edit Set-Cookie (.*) "$1; HTTPOnly"
            Header always edit Set-Cookie (.*) "$1; Secure"
            <IfVersion >= 2.4.7>
                  Header setifempty Strict-Transport-Security "max-age=15768000"
            </IfVersion>
            <IfVersion < 2.4.7>
                  Header set Strict-Transport-Security "max-age=15768000"
            </IfVersion>
                  RequestHeader unset Proxy early
    </IfModule>
   
   
        SSLEngine on
    SSLUseStapling On
        SSLProtocol All -SSLv2 -SSLv3
    SSLStaplingResponderTimeout 5
        <span style="background:lightgreen">SSLCertificateFile /var/www/clients/client0/web1/ssl/ispconfig.znil.net.crt</span>
    SSLStaplingReturnResponderErrors Off
        <span style="background:lightgreen">SSLCertificateKeyFile /var/www/clients/client0/web1/ssl/ispconfig.znil.net.key</span>
  </VirtualHost>
        <span style="background:lightgreen">SSLCertificateChainFile /var/www/clients/client0/web1/ssl/ispconfig.znil.net.bundle</span>
        <IfModule mod_headers.c>
                Header always add Strict-Transport-Security "max-age=15768000"
                RequestHeader unset Proxy early
        </IfModule>
        SSLUseStapling On
        SSLStaplingResponderTimeout 5
        SSLStaplingReturnResponderErrors Off
</VirtualHost>
   
   
  <IfModule mod_ssl.c>
  <IfModule mod_ssl.c>
Zeile 116: Zeile 128:
  </IfModule>
  </IfModule>
   
   
<Directory /var/www/php-cgi-scripts>
        AllowOverride None
        Require all denied
</Directory>
<Directory /var/www/php-fcgi-scripts>
        AllowOverride None
        Require all denied
</Directory>
Anpassen müsst Ihr:<br>
Anpassen müsst Ihr:<br>
* Die IP bei den '''''VirtualHost''''' einträgen - lasst die beim löschen am besten stehen<br>
* Die IP bei den '''''VirtualHost''''' einträgen - lasst die beim löschen am besten stehen<br>

Version vom 24. April 2023, 14:13 Uhr

Normalerweise verbirgt sich das ISPConfig Interface hinter dem Port 8080
Dieser Port ist natürlich nicht aus jedem Netzwerk erreichbar - insbesondere aus Firmennetzwerken.

Also machen wir das Interface über den Port 443 (= https) erreichbar, und zwar unter einer eigenen Subdomain!


Subdomain in ISPConfig anlegen

Wir legen einfach eine neue Webseite in ISPConfig an:

ispconfig.euredomain.suffix

ich z.B. also

ispconfig.znil.net
ISPConfig-3.1-hinter-Subdomain-und-https-001.png

Den Haken bei Let's Encrypt SSL: setzen wir auch gleich - so geht es von überall ohne Zertifikatswarnungen.

Nun warten wir einen Moment bis ISPConfig uns die Seite angelegt und das Zertifikat erstellt hat. Dauert bei der neuen Version keine 2 Minuten.
Wenn Ihr die Subdomäne schon bei euren Domänen-Hoster angelegt habt bzw. es diese im DNS angelegt ist könnt Ihr schon auf die Seite zugreifen - er müsste euch die Standard-Seite des Apache2 zeigen.



.vhost Datei bearbeiten

Wir melden uns per SSH / puTTY auf unserem Server mit dem installiertem ISPConfig 3.1.x an und bearbeiten die .vhost Datei unserer Subdomain.
Da meine Subdomain ispconfig.znil.net heisst, muss ich folgende Datei bearbeiten:

nano /etc/apache2/sites-available/ispconfig.znil.net.vhost

In der Datei löschen wir (fast) alles zwischen den VirtualHost Einträgen und ersetzen den Inhalt wie folgt:

  • Alles was Gelb hinterlegt ist müsst Ihr an den Namen eurer Subdomain oder eurer IP-Adresse anpassen!
  • Alles was Grün hinterlegt übernehmt Ihr aus der Original-Datei - also NICHT löschen. Das sind die Zeilen mit dem Pfad zum SSL-Zertifikat
<VirtualHost 192.168.42.10:80>

                ServerName ispconfig.znil.net
                ServerAdmin admin@znil.net

                Redirect permanent / https://ispconfig.znil.net
</VirtualHost>

<VirtualHost 192.168.42.10:443>

        ServerName ispconfig.znil.net
        ServerAdmin webmaster@znil.net

        <Directory /var/www/ispconfig/>
                <FilesMatch "\.ph(p3?|tml)$">
                        SetHandler None
                </FilesMatch>
       </Directory>
       <Directory /usr/local/ispconfig/interface/web/>
                <FilesMatch "\.ph(p3?|tml)$">
                       SetHandler None
                </FilesMatch>
      </Directory>

      <IfModule mod_fcgid.c>
             DocumentRoot /var/www/ispconfig/
             SuexecUserGroup ispconfig ispconfig
             <Directory /var/www/ispconfig/>
                    Options -Indexes +FollowSymLinks +MultiViews +ExecCGI
                    AllowOverride AuthConfig Indexes Limit Options FileInfo
                    <FilesMatch "\.php$">
                           SetHandler fcgid-script
                    </FilesMatch>
                    FCGIWrapper /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter .php
                    Require all granted
            </Directory>
            IPCCommTimeout  7200
            MaxRequestLen 15728640
      </IfModule>

     <IfModule mpm_itk_module>
            DocumentRoot /usr/local/ispconfig/interface/web/
            AssignUserId ispconfig ispconfig
            AddType application/x-httpd-php .php
            <Directory /usr/local/ispconfig/interface/web>
                   # php_admin_value open_basedir "/usr/local/ispconfig/interface:/usr/share:/tmp"
                   Options +FollowSymLinks
                   AllowOverride None
                   Require all granted
                   php_value magic_quotes_gpc        0
            </Directory>
     </IfModule>

     # ErrorLog /var/log/apache2/error.log
     # CustomLog /var/log/apache2/access.log combined
     ServerSignature Off
     <IfModule mod_security2.c>
            SecRuleEngine Off
     </IfModule>
     # SSL Configuration

     # SSL Configuration
     SSLEngine On
     SSLProtocol All -SSLv3 -TLSv1 -TLSv1.1
     SSLCertificateFile /var/www/clients/client0/web1/ssl/webdghb.znil.org-le.crt
     SSLCertificateKeyFile /var/www/clients/client0/web1/ssl/webdghb.znil.org-le.key
     SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
     SSLHonorCipherOrder On

    <IfModule mod_headers.c>
           # ISPConfig 3.1 currently requires unsafe-line for both scripts and styles, as well as unsafe-eval
           Header set Content-Security-Policy "default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' data:; object-src 'none'"
           Header set Content-Security-Policy "default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' data:; object-src 'none'; upgrade-insecure-requests"
           Header set X-Content-Type-Options: nosniff
           Header set X-Frame-Options: SAMEORIGIN
           Header set X-XSS-Protection: "1; mode=block"
           Header always edit Set-Cookie (.*) "$1; HTTPOnly"
           Header always edit Set-Cookie (.*) "$1; Secure"
           <IfVersion >= 2.4.7>
                  Header setifempty Strict-Transport-Security "max-age=15768000"
           </IfVersion>
           <IfVersion < 2.4.7>
                  Header set Strict-Transport-Security "max-age=15768000"
           </IfVersion>
                 RequestHeader unset Proxy early
    </IfModule>

    SSLUseStapling On
    SSLStaplingResponderTimeout 5
    SSLStaplingReturnResponderErrors Off
 </VirtualHost>

<IfModule mod_ssl.c>
        SSLStaplingCache shmcb:/var/run/ocsp(128000)
</IfModule>

Anpassen müsst Ihr:

  • Die IP bei den VirtualHost einträgen - lasst die beim löschen am besten stehen
  • ServerName und ServerAdmin auch beim löschen stehen lassen
  • Bei Redirect permanent eure Subdomain eintragen (https!)
  • Bei SSLCertificateFile und SSLCertificateKeyFile halt eure Pfade - am besten lasst Ihr diese Zeilen beim löschen ebenfalls stehen!
Face-wink.png
Tipp: Mit der Taste F9 könnt Ihr in nano eine Zeile löschen, mit F10 fügt Ihr die zuletzt gelöschten wieder ein!



Nun noch speichern und mit

service apache2 restart

bzw.

systemctl reload apache2

den Webserver neu starten. Und schon funktioniert es! Im Webbrowser einmal F5 drücken und schon sollte die Anmeldeseite von ISPConfig 3.1.x kommen!



Erklärung der Lösung

Warum das nicht nach der alten Proxy Methode funktioniert kann ich auch nicht sagen, eventuell gibt es eine HTTP_REDIRECT Prüfung oder ähnliches.
Nach vielen - ergebnislosen - probieren und etwas nachdenken fand ich dann aber die oben stehende Lösung.
In der Datei

/etc/apache2/sites-available/ispconfig.vhost

steht die normale Konfiguration für die ISPConfig Webseite drin. Also das diese auf Port 8080 lauschen soll und welches Zertifikat usw.
Den Inhalt dieser Datei habe ich einfach - bis auf wenige Zeilen - in die .vhost Datei meiner Subdomain übertragen - und schon ging das.
Die Seite wird nun also 2 x gehostet - einmal im Original und dem selbst signierten Zertifikat auf Port 8080 und einmal mit dem Let's Encrypt Zertifikat in der Subdomain.



Kommentare

Loading comments...