Dies ist eine alte Version des Dokuments!
IdP-Vorarbeiten: Webserver
Firewall
Die TCP-Ports 443 und 8443 müssen auf dem IdP für eingehende Zugriffe geöffnet sein!Linux mit Apache Webserver
Installation
Debian 10/11
root@idp:~# apt install apache2
RHEL 6/CentOS 7
root@idp:~# yum -y install httpd mod_ssl
SLES 11/12, OpenSUSE Leap 15.1
Apache wird als Proxy vor Tomcat via AJP verwendet. In /etc/sysconfig/apache2
muss bei APACHE_MODULES proxy vor proxy_ajp stehen. Außerdem muss APACHE_SERVER_FLAGS=„SSL“
gesetzt sein.
Apache-Module aktivieren
root@idp:~# a2enmod ssl headers proxy proxy_ajp
Abschließend muss der Web Server neu gestartet werden
root@idp:~# systemctl restart apache2
VHost-Konfiguration
Eine Anleitung zur Erstellung einer korrekten Zertifikatskette findet sich hier.
Im Mozilla-Wiki finden Sie Empfehlungen für eine sichere SSL-Konfiguration. Wir empfehlen Ihnen, mittels der Seite SSLLabs Ihren fertigen Webserver zu testen.
- /etc/apache2/sites-enabled/idp.uni-beispiel.de.conf
################################################ # # Bitte im Folgenden 'IDP-IP-ADRESSE' und ggf. 'IDP-IPv6-ADRESSE' # jeweils durch die entsprechende IP und 'idp.uni-beispiel.de' durch # den FQDN Ihres IdPs ersetzen! # ################################################ # # SingleSignOnService auf Port 443 # <VirtualHost IDP-IP-ADRESSE:443 [IDP-IPv6-ADRESSE]:443> ServerName idp.uni-beispiel.de SSLEngine on # Die Zertifikatsdatei enthält die vollständige Kette, vgl. # http://httpd.apache.org/docs/current/mod/mod_ssl.html#sslcertificatechainfile SSLCertificateFile /etc/ssl/localcerts/idp.uni-beispiel.crt.pem SSLCertificateKeyFile /etc/ssl/private/idp.uni-beispiel.key.pem AddDefaultCharset UTF-8 <Location /idp> Require all granted ProxyPass ajp://localhost:8009/idp # "SAMEORIGIN" vermeidet etwaige Fehlermeldungen # im Browser beim Logout über mehrere SPs, # da hierbei mit iframes gearbeitet wird Header always append X-FRAME-OPTIONS "SAMEORIGIN" </Location> # Support für favicon.ico, robots.txt und ggfs. Info-Seiten DocumentRoot /opt/shibboleth-idp/htdocs <Directory /opt/shibboleth-idp/htdocs> Require all granted </Directory> </VirtualHost> ################################################ # # ArtifactResolutionService und AttributeService # # Port 8443 sollte an anderer Stelle angeschaltet werden (Listen-Direktive). <VirtualHost IDP-IP-ADRESSE:8443 [IDP-IPv6-ADRESSE]:8443> ServerName idp.uni-beispiel.de SSLEngine on # Die Zertifikatsdatei enthält die vollständige Kette, vgl. # http://httpd.apache.org/docs/current/mod/mod_ssl.html#sslcertificatechainfile SSLCertificateFile /etc/ssl/localcerts/idp.uni-beispiel.crt.pem SSLCertificateKeyFile /etc/ssl/private/idp.uni-beispiel.key.pem # Diese drei SSL-Optionen sind zwingend notwendig # damit SP-Abfragen auf diesen Port funktionieren! # Details siehe Shibboleth-Wiki SSLVerifyClient optional_no_ca SSLVerifyDepth 10 SSLOptions +StdEnvVars +ExportCertData <Location /idp> Require all granted ProxyPass ajp://localhost:8009/idp </Location> </VirtualHost>
Laden Sie nach den Änderungen die Konfiguration des Webservers neu:
root@idp:~# service apache2 reload
Lassen Sie beim Reload des Apache den Apache-Error-Log in einem zweiten Fenster mitlaufen um etwaige Fehler oder Warnings sehen zu können:
root@idp:~# tail -f /var/log/apache2/error_log
Windows mit Apache Webserver
Beispiel für eine Minimal-Konfiguration unter Windows (bereitgestellt von Thomas Glatzer, Uni Mainz):
- conf/httpd.conf
ServerRoot "C:/Program Files/Apache/Apache24" # # Dynamic Shared Object (DSO) Support # LoadModule authn_core_module modules/mod_authn_core.so LoadModule authz_core_module modules/mod_authz_core.so LoadModule headers_module modules/mod_headers.so LoadModule reqtimeout_module modules/mod_reqtimeout.so LoadModule log_config_module modules/mod_log_config.so LoadModule mime_module modules/mod_mime.so LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule ssl_module modules/mod_ssl.so LoadModule socache_shmcb_module modules/mod_socache_shmcb.so # 'Main' server configuration ServerAdmin glatzert@uni-mainz.de ServerName shib.uni-mainz.de # Deny access to the entirety of your server's filesystem. You must # explicitly permit access to web content directories in other # <Directory> blocks below. <Directory /> AllowOverride none Require all denied </Directory> DocumentRoot "c:/inetpub/shib.uni-mainz.de" <Directory "c:/inetpub/shib.uni-mainz.de"> Options None AllowOverride None Require all granted </Directory> <Files ".ht*"> Require all denied </Files> ErrorLog "C:/inetpub/logs/apache/error.log" TransferLog "C:/inetpub/logs/apache/access.log" LogLevel warn <IfModule mime_module> TypesConfig conf/mime.types AddType application/x-compress .Z AddType application/x-gzip .gz .tgz </IfModule> Include conf/extra/httpd-ssl.conf Include conf/extra/shib-sp.conf Include conf/extra/shib-idp.conf
- conf/extra/httpd-ssl.conf
AddType application/x-x509-ca-cert .crt AddType application/x-pkcs7-crl .crl SSLRandomSeed startup builtin SSLRandomSeed connect builtin # SSLProtocol HIER INFORMIEREN SIE SICH BITTE ÜBER EINE STATE-OF-THE-ART-KONFIGURATION # SSLCipherSuite HIER INFORMIEREN SIE SICH BITTE ÜBER EINE STATE-OF-THE-ART-KONFIGURATION # Nützliche Quelle: https://wiki.mozilla.org/Security/Server_Side_TLS SSLHonorCipherOrder On SSLUseStapling off SSLStaplingCache "shmcb:c:/inetpub/logs/apache/ssl_stapling(512000)" SSLStaplingReturnResponderErrors off SSLSessionCache "shmcb:c:/inetpub/logs/apache/ssl_scache(512000)" SSLSessionCacheTimeout 300 SSLCertificateFile "C:/inetpub/shibboleth/idp/credentials/shib.uni-mainz.de.crt" SSLCertificateKeyFile "C:/inetpub/shibboleth/idp/credentials/shib.uni-mainz.de.key"
- conf/extra/shib-idp.conf
################################################ # # SingleSignOnService # Listen 443 <VirtualHost _default_:443> DocumentRoot "C:/inetpub/shib.uni-mainz.de" ServerAdmin glatzert@uni-mainz.de SSLEngine on Header add Strict-Transport-Security "max-age=15768000" <Proxy http://localhost:8080/idp/*> Require all granted </Proxy> ProxyPass /idp/ http://localhost:8080/idp/ </VirtualHost> ################################################ # # ArtifactResolutionService und AttributeService # Listen 8443 <VirtualHost _default_:8443> DocumentRoot "C:/inetpub/shib.uni-mainz.de" ServerAdmin glatzert@uni-mainz.de SSLEngine on Header add Strict-Transport-Security "max-age=15768000" <Proxy http://localhost:8080/idp/*> Require all granted </Proxy> ProxyPass /idp/ http://localhost:8080/idp/ </VirtualHost>
- conf/extra/shib-sp.conf
# https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPApacheConfig LoadModule mod_shib C:/inetpub/shibboleth/sp/lib64/shibboleth/mod_shib_24.so <Location /Shibboleth.sso> AuthType None Require all granted </Location> <LocationMatch "(/idp/(.*)/SSO)|(/idp/Authn)"> AuthType shibboleth ShibRequestSetting requireSession 1 Require shibboleth </LocationMatch>
Testen der Verbindung Apache --> Tomcat
Liest der Apache seine Config ohne Fehler ein, testen Sie bitte als nächstes die Weiterleitung von Apache auf den Tomcat indem Sie folgende URL aufrufen:
https://HOSTNAME/idp/
Funktioniert die Weiterleitung, dann bekommen Sie eine Fehlermeldung „HTTP Status 404 - /idp/“ oder (je nach Tomcat-Version) eine weiße Seite vom Tomcat zu sehen, da das IdP-Servlet im Tomcat noch nicht aktiv ist. Die Weiterleitung ist damit aber erfolgreich getestet! Kommt eine Apache-Fehlermeldung, dann stimmt die Apache-Konfiguration noch nicht. Bitte dann nochmal obige Punkte sorgfältig durchgehen.
Anmerkungen:
- Bitte stellen Sie sicher dass die Apache-SSL-Konfiguration aktuellen Sicherheitsstandards entspricht! Details dazu übersteigen den Rahmen diese Anleitung. Hilfreiche Seiten: