Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Nächste Überarbeitung
Vorhergehende Überarbeitung
de:shibidp:config-storage-postgresql [2025/11/17 16:08] – angelegt als Kopie von config-storage Thorsten Michelsde:shibidp:config-storage-postgresql [2025/11/24 13:58] (aktuell) – systemctl enable postgresql Thorsten Michels
Zeile 13: Zeile 13:
    
 <code bash> <code bash>
-root@idp:~# apt install mariadb-server mariadb-client libmariadb-java+root@idp:~# apt install postgresql postgresql-contrib libpostgresql-jdbc-java
 </code> </code>
  
 +<del>
 <code bash> <code bash>
 root@idp:~# ln -s /usr/share/java/mariadb-java-client.jar /var/lib/tomcat10/lib/mariadb-java-client.jar root@idp:~# ln -s /usr/share/java/mariadb-java-client.jar /var/lib/tomcat10/lib/mariadb-java-client.jar
 +</code>
 +</del>
 +
 +Damit die DB beim Booten gestartet wird:
 +<code bash>
 +root@idp:~# systemctl enable postgresql
 </code> </code>
  
Zeile 34: Zeile 41:
   * ''shibpid'' für die persistentIds   * ''shibpid'' für die persistentIds
  
-<code mysql+Einloggen in PostgresQL funktioniert zum Beispiel mit  
-mysql> SET NAMES 'utf8'; +<code bash
-SET CHARACTER SET utf8; +root@idp:~# sudo -i -u postgres psql 
-CHARSET utf8; +</code>
-CREATE DATABASE IF NOT EXISTS shibboleth CHARACTER SET=utf8; +
-USE shibboleth; +
- +
-mysqlCREATE TABLE IF NOT EXISTS StorageRecords ( +
-  context varchar(255) NOT NULL, +
-  id varchar(255) NOT NULL, +
-  expires bigint(20) DEFAULT NULL, +
-  value longtext NOT NULL, +
-  version bigint(20) NOT NULL, +
-  PRIMARY KEY (context, id) +
-) COLLATE utf8_bin;+
  
-mysql> CREATE TABLE IF NOT EXISTS shibpid ( +<code postgresql> 
-    localEntity VARCHAR(255) NOT NULL, +postgres=# CREATE ROLE shibboleth WITH LOGIN; 
-    peerEntity VARCHAR(255) NOT NULL, +postgres=# \password shibboleth 
-    persistentId VARCHAR(50) NOT NULL, +postgres=# CREATE DATABASE shibboleth WITH OWNER shibboleth ENCODING 'UTF8' TEMPLATE template0; 
-    principalName VARCHAR(50) NOT NULL, +postgres=# \c shibboleth 
-    localId VARCHAR(50) NOT NULL, +shibboleth=# SET ROLE shibboleth; 
-    peerProvidedId VARCHAR(50) NULL, +shibboleth=# CREATE TABLE shibpid ( 
-    creationDate TIMESTAMP NOT NULL, +        localEntity VARCHAR(1024) NOT NULL, 
-    deactivationDate TIMESTAMP NULL, +        peerEntity VARCHAR(1024) NOT NULL, 
-    PRIMARY KEY (localEntity, peerEntity, persistentId) +        principalName VARCHAR(255) NOT NULL, 
-); +        localId VARCHAR(255) NOT NULL, 
- +        persistentId VARCHAR(36) NOT NULL, 
-mysql> CREATE USER 'shibboleth'@'localhost' IDENTIFIED BY 'GeHEIM007'+        peerProvidedId VARCHAR(255) NULL, 
- +        creationDate TIMESTAMP NOT NULL DEFAULT LOCALTIMESTAMP
-mysql> GRANT ALL PRIVILEGES ON shibboleth.* TO 'shibboleth'@'localhost'; +        deactivationDate TIMESTAMP NULL DEFAULT NULL, 
- +        PRIMARY KEY (localEntity, peerEntity, persistentId) 
-mysql> FLUSH PRIVILEGES;+        ); 
 +shibboleth=# CREATE INDEX shibpid_getbysourcevalue_index ON shibpid(localEntity, peerEntity, localId, deactivationDate)
 +shibboleth=# CREATE TABLE storagerecords ( 
 +        context VARCHAR(255) NOT NULL, 
 +        id VARCHAR(255) NOT NULL, 
 +        expires BIGINT DEFAULT NULL, 
 +        value TEXT NOT NULL, 
 +        version BIGINT NOT NULL, 
 +        PRIMARY KEY (context, id) 
 +        ); 
 +shibboleth=# CREATE INDEX storagerecords_expires_index ON storagerecords(expires);
 </code> </code>
  
Zeile 90: Zeile 96:
     <!-- Use this file to define any custom beans needed globally. -->     <!-- Use this file to define any custom beans needed globally. -->
          
-    <!-- Die folgenden Werte sind Default-Werte: +       <!-- Postgres configuration --> 
-           p:maxTotal="100" +       <bean id="shibboleth.PostgreSQLDataSource
-           p:maxIdle="100" +                class="org.apache.tomcat.jdbc.pool.DataSource" 
-         Es ist unter Umständen nötig, dass Sie diese Werte je nach Auslastung Ihres IdP anpassen, +                destroy-method="close" lazy-init="true
-         ebenso wie die Konfiguration Ihres MySQL-Servers. --> +                p:driverClassName="org.postgresql.Driver" 
-        <bean id="shibboleth.MySQLDataSource+                p:username="%{psql.username}" 
-          class="%{mysql.class}+                p:password="%{psql.password}" 
-          p:driverClassName="org.mariadb.jdbc.Driver" +       /> 
-          p:url="%{mysql.url}" + 
-          p:username="%{mysql.username}" +       <bean id="JDBCStorageServiceparent="shibboleth.JDBCStorageService
-          p:password="%{mysql.password}" +                p:dataSource-ref="shibboleth.PostgreSQLDataSource
-          p:maxTotal="100" +                p:transactionIsolation="4
-          p:maxIdle="100+                p:retryableErrors="40001
-          p:maxWaitMillis="15000+       />
-          p:testOnBorrow="true+
-          p:validationQuery="select 1+
-          p:validationQueryTimeout="5" />+
  
-        <bean id="JDBCStorageService" 
-              parent="shibboleth.JDBCStorageService" 
-              p:cleanupInterval="%{idp.storage.cleanupInterval:PT10M}" 
-              p:dataSource-ref="shibboleth.MySQLDataSource" />   
-       
 </beans> </beans>
 </file> </file>
Zeile 123: Zeile 121:
 <file java /opt/shibboleth-idp/conf/idp.properties> <file java /opt/shibboleth-idp/conf/idp.properties>
 # ... # ...
-mysql.class    = org.apache.commons.dbcp2.BasicDataSource +psql.url      = jdbc:postgresql://localhost/shibboleth 
-mysql.url      = jdbc:mysql://localhost:3306/shibboleth +psql.username = shibboleth
-mysql.username = shibboleth+
 # ... # ...
 </file> </file>
Zeile 131: Zeile 128:
 2. Das Passwort gehört wieder in die Datei ''./credentials/secrets.properties'': 2. Das Passwort gehört wieder in die Datei ''./credentials/secrets.properties'':
 <file /opt/shibboleth-idp/credentials/secrets.properties> <file /opt/shibboleth-idp/credentials/secrets.properties>
-mysql.password = GeHEIM007+psql.password = GeHEIM007
 </file> </file>
  
Zeile 152: Zeile 149:
 ==== Generierung und Speicherung ==== ==== Generierung und Speicherung ====
  
-Das gewählte Quellattribut legen Sie in ''./conf/saml-nameid.properties'' fest: Schauen Sie in ''./conf/attribute-resolver.xml'' nach, welche "id" das Quellattribut hat und tragen Sie sie hier ein. Es wird //nicht// der originale Attribut-Name aus dem IdM verwendet! Hier stellen Sie auch ein, dass die persistentIds in der MySQL-Datenbank gespeichert werden sollen.+Das gewählte Quellattribut legen Sie in ''./conf/saml-nameid.properties'' fest: Schauen Sie in ''./conf/attribute-resolver.xml'' nach, welche "id" das Quellattribut hat und tragen Sie sie hier ein. Es wird //nicht// der originale Attribut-Name aus dem IdM verwendet! Hier stellen Sie auch ein, dass die persistentIds in der Postgres-Datenbank gespeichert werden sollen.
  
 <file properties /opt/shibboleth-idp/conf/saml-nameid.properties> <file properties /opt/shibboleth-idp/conf/saml-nameid.properties>
Zeile 162: Zeile 159:
 idp.persistentId.generator = shibboleth.StoredPersistentIdGenerator idp.persistentId.generator = shibboleth.StoredPersistentIdGenerator
 # For basic use, set this to a JDBC DataSource bean name: # For basic use, set this to a JDBC DataSource bean name:
-idp.persistentId.dataSource = shibboleth.MySQLDataSource+idp.persistentId.dataSource = shibboleth.PostgreSQLDataSource
  
 </file> </file>
Zeile 231: Zeile 228:
         salt="%{idp.persistentId.salt}">         salt="%{idp.persistentId.salt}">
         <InputAttributeDefinition ref="%{idp.persistentId.sourceAttribute}" />         <InputAttributeDefinition ref="%{idp.persistentId.sourceAttribute}" />
-        <BeanManagedConnection>shibboleth.MySQLDataSource</BeanManagedConnection>+        <BeanManagedConnection>shibboleth.PostgreSQLDataSource</BeanManagedConnection>
     </DataConnector>     </DataConnector>
 </file> </file>
Zeile 337: Zeile 334:
         queryTimeout="0">         queryTimeout="0">
         <InputAttributeDefinition ref="%{idp.persistentId.sourceAttribute}" />         <InputAttributeDefinition ref="%{idp.persistentId.sourceAttribute}" />
-        <BeanManagedConnection>shibboleth.MySQLDataSource</BeanManagedConnection>+        <BeanManagedConnection>shibboleth.PostgreSQLDataSource</BeanManagedConnection>
     </DataConnector></file>     </DataConnector></file>
   * Bereits **bestehende persistentIDs** lassen Sie in der Datenbank bestehen, wie sie sind. Aus diesen persistentIDs werden dann zwar nicht standardkonforme SAML pairwise-ids gebildet. Wir gehen allerdings nicht davon aus, dass Service Provider, die die pairwise-id entgegennehmen, prüfen, ob der Wert vor dem Scope standardkonform ist.   * Bereits **bestehende persistentIDs** lassen Sie in der Datenbank bestehen, wie sie sind. Aus diesen persistentIDs werden dann zwar nicht standardkonforme SAML pairwise-ids gebildet. Wir gehen allerdings nicht davon aus, dass Service Provider, die die pairwise-id entgegennehmen, prüfen, ob der Wert vor dem Scope standardkonform ist.
  • Zuletzt geändert: vor 2 Monaten