Benutzer-Werkzeuge

Webseiten-Werkzeuge


tachtler:apache_tomcat_7_-_ldap-authentifizierung_jndirealm

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
tachtler:apache_tomcat_7_-_ldap-authentifizierung_jndirealm [2015/05/07 16:43] klaustachtler:apache_tomcat_7_-_ldap-authentifizierung_jndirealm [2015/05/07 18:20] (aktuell) – [/etc/tomcat/tomcat-users.xml] klaus
Zeile 348: Zeile 348:
 ===== Konfiguration: Apache Tomcat ===== ===== Konfiguration: Apache Tomcat =====
  
-Nachfolgende Konfiguration zeigt die notwendigen Ergänzun[[http://tomcat.apache.org/|Apache Tomcat]]-Apache Tomcat Applikation-Servers+Nachfolgende Konfiguration zeigt die notwendigen Ergänzungen und Änderungen an der unter nachfolgendem internen Link gezeigten Installation eines [[http://tomcat.apache.org/|Apache Tomcat]]-Apache Tomcat Applikation-Servers
   * Siehe auch den internen Link: [[tachtler:apache_tomcat_7|Apache Tomcat 7]]   * Siehe auch den internen Link: [[tachtler:apache_tomcat_7|Apache Tomcat 7]]
  
 :!: **WICHTIG** - **Nachfolgende Konfigurationen sind auf dem __Apache Tomcat Applikations-Server__ durchzuführen !!!** :!: **WICHTIG** - **Nachfolgende Konfigurationen sind auf dem __Apache Tomcat Applikations-Server__ durchzuführen !!!**
 +
 +Nachfolgende Stellen innerhalb der Konfigurationsdatei des [[http://tomcat.apache.org/|Apache Tomcat]]-Applikation-Servers müssen auskommentiert bzw. ergänzt werden.
 +
 +==== /etc/tomcat/server.xml ====
 +
 +Die Konfigurationsdatei 
 +  * **''/etc/tomcat/server.xml''**
 +ist unter [[http://centos.org|CentOS]] in der **Version 7.x** die **Haupt**-Konfigurationsdatei des [[http://tomcat.apache.org/|Apache Tomcat]]-Applikation-Servers.
 +
 +Nachfolgend sollen einige Änderungen bzw. Ergänzungen an dieser Konfigurationsdatei durchgeführt werden, welchen ein Kommentar, wie nachfolgend dargestellt, voransteht:
 +<code>
 +<!-- Tachtler -->
 +</code>
 +
 +Hier die **komplette Konfigurationsdatei** mit allen Änderungen bzw. Ergänzungen, welche ebenfalls nachfolgend erklärt werden:
 +<code xml>
 +<?xml version='1.0' encoding='utf-8'?>
 +<!--
 +  Licensed to the Apache Software Foundation (ASF) under one or more
 +  contributor license agreements.  See the NOTICE file distributed with
 +  this work for additional information regarding copyright ownership.
 +  The ASF licenses this file to You under the Apache License, Version 2.0
 +  (the "License"); you may not use this file except in compliance with
 +  the License.  You may obtain a copy of the License at
 +
 +      http://www.apache.org/licenses/LICENSE-2.0
 +
 +  Unless required by applicable law or agreed to in writing, software
 +  distributed under the License is distributed on an "AS IS" BASIS,
 +  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 +  See the License for the specific language governing permissions and
 +  limitations under the License.
 +-->
 +<!-- Note:  A "Server" is not itself a "Container", so you may not
 +     define subcomponents such as "Valves" at this level.
 +     Documentation at /docs/config/server.html
 + -->
 +<!-- Tachtler -->
 +<!-- default: <Server port="8005" shutdown="SHUTDOWN"> -->
 +<Server port="8089" shutdown="DOWNBABY">
 +  <!-- Security listener. Documentation at /docs/config/listeners.html
 +  <Listener className="org.apache.catalina.security.SecurityListener" />
 +  -->
 +  <!--APR library loader. Documentation at /docs/apr.html -->
 +  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
 +  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
 +  <Listener className="org.apache.catalina.core.JasperListener" />
 +  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
 +  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
 +  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
 +  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
 +
 +  <!-- Global JNDI resources
 +       Documentation at /docs/jndi-resources-howto.html
 +  -->
 +  <GlobalNamingResources>
 +    <!-- Editable user database that can also be used by
 +         UserDatabaseRealm to authenticate users
 +    -->
 +    <!-- Tachtler disabled -->
 +    <!-- disabled: <Resource name="UserDatabase" auth="Container" -->
 +    <!-- disabled:           type="org.apache.catalina.UserDatabase" -->
 +    <!-- disabled:          description="User database that can be updated and saved" -->
 +    <!-- disabled:          factory="org.apache.catalina.users.MemoryUserDatabaseFactory" -->
 +    <!-- disabled:          pathname="conf/tomcat-users.xml" /> -->
 +  </GlobalNamingResources>
 +
 +  <!-- A "Service" is a collection of one or more "Connectors" that share
 +       a single "Container" Note:  A "Service" is not itself a "Container",
 +       so you may not define subcomponents such as "Valves" at this level.
 +       Documentation at /docs/config/service.html
 +   -->
 +  <Service name="Catalina">
 +
 +    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
 +    <!--
 +    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
 +        maxThreads="150" minSpareThreads="4"/>
 +    -->
 +
 +
 +    <!-- A "Connector" represents an endpoint by which requests are received
 +         and responses are returned. Documentation at :
 +         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
 +         Java AJP  Connector: /docs/config/ajp.html
 +         APR (HTTP/AJP) Connector: /docs/apr.html
 +         Define a non-SSL HTTP/1.1 Connector on port 8080
 +    -->
 +    <!-- Tachtler -->
 +    <!-- default: <Connector port="8080" protocol="HTTP/1.1" -->
 +    <!-- default:            connectionTimeout="20000" -->
 +    <!-- default:            redirectPort="8443" /> -->
 +    <Connector port="8088" protocol="HTTP/1.1"
 +               connectionTimeout="20000"
 +               redirectPort="8443"
 +               address="127.0.0.1" />
 +    <!-- A "Connector" using the shared thread pool-->
 +    <!--
 +    <Connector executor="tomcatThreadPool"
 +               port="8080" protocol="HTTP/1.1"
 +               connectionTimeout="20000"
 +               redirectPort="8443" />
 +    -->
 +    <!-- Define a SSL HTTP/1.1 Connector on port 8443
 +         This connector uses the BIO implementation that requires the JSSE
 +         style configuration. When using the APR/native implementation, the
 +         OpenSSL style configuration is required as described in the APR/native
 +         documentation -->
 +    <!--
 +    <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
 +               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
 +               clientAuth="false" sslProtocol="TLS" />
 +    -->
 +
 +    <!-- Define an AJP 1.3 Connector on port 8009 -->
 +    <!-- <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> -->
 +    <Connector port="8099" protocol="AJP/1.3" redirectPort="8443" address="127.0.0.1" />
 +
 +
 +    <!-- An Engine represents the entry point (within Catalina) that processes
 +         every request.  The Engine implementation for Tomcat stand alone
 +         analyzes the HTTP headers included with the request, and passes them
 +         on to the appropriate Host (virtual host).
 +         Documentation at /docs/config/engine.html -->
 +
 +    <!-- You should set jvmRoute to support load-balancing via AJP ie :
 +    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
 +    -->
 +    <Engine name="Catalina" defaultHost="localhost">
 +
 +      <!--For clustering, please take a look at documentation at:
 +          /docs/cluster-howto.html  (simple how to)
 +          /docs/config/cluster.html (reference documentation) -->
 +      <!--
 +      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
 +      -->
 +
 +      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
 +           via a brute-force attack -->
 +      <Realm className="org.apache.catalina.realm.LockOutRealm">
 +        <!-- This Realm uses the UserDatabase configured in the global JNDI
 +             resources under the key "UserDatabase" Any edits
 +             that are performed against this UserDatabase are immediately
 +             available for use by the Realm.  -->
 +        <!-- Tachtler - disabled -->
 +        <!-- disabled: <Realm className="org.apache.catalina.realm.UserDatabaseRealm" -->
 +        <!-- disabled:        resourceName="UserDatabase"/> -->
 +      </Realm>
 +
 +      <Host name="localhost"  appBase="webapps"
 +            unpackWARs="true" autoDeploy="true">
 +
 +        <!-- SingleSignOn valve, share authentication between web applications
 +             Documentation at: /docs/config/valve.html -->
 +        <!--
 +        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
 +        -->
 +
 +        <!-- Access log processes all example.
 +             Documentation at: /docs/config/valve.html
 +             Note: The pattern used is equivalent to using pattern="common" -->
 +        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
 +               prefix="localhost_access_log." suffix=".txt"
 +               pattern="%h %l %u %t &quot;%r&quot; %s %b" />
 +
 +      </Host>
 +    </Engine>
 +  </Service>
 +</Server>
 +</code>
 +
 +**Nachfolgend die Erklärungen zu den gemachten Änderungen bzw. Ergänzungen:**
 +
 +=== Bereich: Server | GlobalNamingResources ===
 +
 +Nachfolgende Änderungen **deaktivieren** die Nutzung der Konfigurationsdatei
 +  * ''/etc/tomcat/tomcat-users.xml''
 +durch den [[http://tomcat.apache.org/|Apache Tomcat]]-Applikations-Server zur Authentifizierung der nachfolgenden, oder auch anderer Web-Anwendungen:
 +  * **''tomcat-admin-webapps''** - [[http://tomcat.apache.org/|Apache Tomcat]]-Administrative Web-Anwendungen (host-manager, manager)
 +
 +<code xml>
 +  <GlobalNamingResources>
 +    <!-- Editable user database that can also be used by
 +         UserDatabaseRealm to authenticate users
 +    -->
 +    <!-- Tachtler - DISABLED -->
 +    <!-- disabled: <Resource name="UserDatabase" auth="Container" -->
 +    <!-- disabled:           type="org.apache.catalina.UserDatabase" -->
 +    <!-- disabled:          description="User database that can be updated and saved" -->
 +    <!-- disabled:          factory="org.apache.catalina.users.MemoryUserDatabaseFactory" -->
 +    <!-- disabled:          pathname="conf/tomcat-users.xml" /> -->
 +  </GlobalNamingResources>
 +</code>
 +
 +=== Bereich: Server | Service | Engine | Realm ===
 +
 +Nachfolgende Änderungen **deaktivieren** die Nutzung der Konfigurationsdatei
 +  * ''/etc/tomcat/tomcat-users.xml''
 +durch den [[http://tomcat.apache.org/|Apache Tomcat]]-Applikations-Server zur Authentifizierung der nachfolgenden, oder auch anderer Web-Anwendungen:
 +  * **''tomcat-admin-webapps''** - [[http://tomcat.apache.org/|Apache Tomcat]]-Administrative Web-Anwendungen (host-manager, manager)
 +
 +<code xml>
 +      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
 +           via a brute-force attack -->
 +      <Realm className="org.apache.catalina.realm.LockOutRealm">
 +        <!-- This Realm uses the UserDatabase configured in the global JNDI
 +             resources under the key "UserDatabase" Any edits
 +             that are performed against this UserDatabase are immediately
 +             available for use by the Realm.  -->
 +        <!-- Tachtler - DISABLED -->
 +        <!-- disabled: <Realm className="org.apache.catalina.realm.UserDatabaseRealm" -->
 +        <!-- disabled:        resourceName="UserDatabase"/> -->
 +      </Realm>
 +</code>
 +
 +==== /etc/tomcat/context.xml ====
 +
 +Die Konfigurationsdatei 
 +  * **''/etc/tomcat/context.xml''**
 +ist unter [[http://centos.org|CentOS]] in der **Version 7.x** die Konfigurationsdatei des [[http://tomcat.apache.org/|Apache Tomcat]]-Applikation-Servers welche nachfogende Konfiguration für **jede** Web-Applikation zur verfügung stellt.
 +
 +Nachfolgend sollen einige Änderungen bzw. Ergänzungen an dieser Konfigurationsdatei durchgeführt werden, welchen ein Kommentar, wie nachfolgend dargestellt, voransteht:
 +<code>
 +<!-- Tachtler -->
 +</code>
 +
 +Hier die **komplette Konfigurationsdatei** mit allen Änderungen bzw. Ergänzungen, welche ebenfalls nachfolgend erklärt werden:
 +<code xml>
 +<?xml version='1.0' encoding='utf-8'?>
 +<!--
 +  Licensed to the Apache Software Foundation (ASF) under one or more
 +  contributor license agreements.  See the NOTICE file distributed with
 +  this work for additional information regarding copyright ownership.
 +  The ASF licenses this file to You under the Apache License, Version 2.0
 +  (the "License"); you may not use this file except in compliance with
 +  the License.  You may obtain a copy of the License at
 +
 +      http://www.apache.org/licenses/LICENSE-2.0
 +
 +  Unless required by applicable law or agreed to in writing, software
 +  distributed under the License is distributed on an "AS IS" BASIS,
 +  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 +  See the License for the specific language governing permissions and
 +  limitations under the License.
 +-->
 +<!-- The contents of this file will be loaded for each web application -->
 +<Context>
 +
 +    <!-- Default set of monitored resources -->
 +    <WatchedResource>WEB-INF/web.xml</WatchedResource>
 +
 +    <!-- Tachtler -->
 +    <!-- Enable LDAP authentication -->
 +    <Realm className="org.apache.catalina.realm.JNDIRealm" 
 +        connectionName="cn=Ersatzbenutzer,dc=tachtler,dc=net"
 +    connectionPassword="geheim"
 +         connectionURL="ldaps://ldap.idmz.tachtler.net:636"
 +           userPattern="uid={0},ou=People,dc=tachtler,dc=net"
 +              roleBase="ou=TomcatRoles,dc=tachtler,dc=net"
 +              roleName="cn"
 +            roleSearch="(uniqueMember={0})"
 +    />
 +
 +    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
 +    <!--
 +    <Manager pathname="" />
 +    -->
 +
 +    <!-- Uncomment this to enable Comet connection tacking (provides events
 +         on session expiration as well as webapp lifecycle) -->
 +    <!--
 +    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
 +    -->
 +
 +</Context>
 +</code>
 +
 +=== Bereich: Context ===
 +
 +Nachfolgende Änderungen **aktivieren** die Nutzung die Nutzung eines LDAP_Servers durch den [[http://tomcat.apache.org/|Apache Tomcat]]-Applikations-Server zur Authentifizierung der nachfolgenden, oder auch anderer Web-Anwendungen, des [[http://tomcat.apache.org/|Apache Tomcat]]-Applikations-Servers dar.
 +  * **''tomcat-admin-webapps''** - [[http://tomcat.apache.org/|Apache Tomcat]]-Administrative Web-Anwendungen (host-manager, manager)
 +
 +<code xml>
 +    <!-- Tachtler -->
 +    <!-- Enable LDAP authentication -->
 +    <Realm className="org.apache.catalina.realm.JNDIRealm" 
 +        connectionName="cn=Ersatzbenutzer,dc=tachtler,dc=net"
 +    connectionPassword="geheim"
 +         connectionURL="ldaps://ldap.idmz.tachtler.net:636"
 +           userPattern="uid={0},ou=People,dc=tachtler,dc=net"
 +              roleBase="ou=TomcatRoles,dc=tachtler,dc=net"
 +              roleName="cn"
 +            roleSearch="(uniqueMember={0})"
 +    />
 +</code>
 +
 +==== /etc/tomcat/tomcat-users.xml ====
 +
 +Die Konfigurationsdatei 
 +  * **''/etc/tomcat/tomcat-users.xml''**
 +stellt eine **Standard**-Konfigurationsdatei zur Authentifizierung der nachfolgenden, oder auch anderer Web-Anwendungen, des [[http://tomcat.apache.org/|Apache Tomcat]]-Applikations-Servers dar.
 +  * **''tomcat-admin-webapps''** - [[http://tomcat.apache.org/|Apache Tomcat]]-Administrative Web-Anwendungen (host-manager, manager)
 +
 +:!: **WICHTIG** - **Änderungen zur __Aktivierung__ von Rollen und Benutzer, wie unter nachfolgendem internen Link**
 +  * Siehe auch den internen Link: [[tachtler:apache_tomcat_7#etc_tomcat_tomcat-usersxml|Apache Tomcat 7 - /etc/tomcat/tomcat-users.xml]]
 +**__sollten__ wieder __rückgängig gemacht werden__**
 +
 +Nachfolgend die **komplette Konfigurationsdatei** (**wie nach der original Installation ausgeliefert**):
 +<code xml>
 +<?xml version='1.0' encoding='utf-8'?>
 +<!--
 +  Licensed to the Apache Software Foundation (ASF) under one or more
 +  contributor license agreements.  See the NOTICE file distributed with
 +  this work for additional information regarding copyright ownership.
 +  The ASF licenses this file to You under the Apache License, Version 2.0
 +  (the "License"); you may not use this file except in compliance with
 +  the License.  You may obtain a copy of the License at
 +
 +      http://www.apache.org/licenses/LICENSE-2.0
 +
 +  Unless required by applicable law or agreed to in writing, software
 +  distributed under the License is distributed on an "AS IS" BASIS,
 +  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 +  See the License for the specific language governing permissions and
 +  limitations under the License.
 +-->
 +<tomcat-users>
 +<!--
 +  NOTE:  By default, no user is included in the "manager-gui" role required
 +  to operate the "/manager/html" web application.  If you wish to use this app,
 +  you must define such a user - the username and password are arbitrary.
 +-->
 +<!--
 +  NOTE:  The sample user and role entries below are wrapped in a comment
 +  and thus are ignored when reading this file. Do not forget to remove
 +  <!.. ..> that surrounds them.
 +-->
 +<!--
 +  <role rolename="tomcat"/>
 +  <role rolename="role1"/>
 +  <user username="tomcat" password="tomcat" roles="tomcat"/>
 +  <user username="both" password="tomcat" roles="tomcat,role1"/>
 +  <user username="role1" password="tomcat" roles="role1"/>
 +-->
 +
 +<!-- <role rolename="admin"/> -->
 +<!-- <role rolename="admin-gui"/> -->
 +<!-- <role rolename="admin-script"/> -->
 +<!-- <role rolename="manager"/> -->
 +<!-- <role rolename="manager-gui"/> -->
 +<!-- <role rolename="manager-script"/> -->
 +<!-- <role rolename="manager-jmx"/> -->
 +<!-- <role rolename="manager-status"/> -->
 +<!-- <user name="admin" password="adminadmin" roles="admin,manager,admin-gui,admin-script,manager-gui,manager-script,manager-jmx,manager-status" /> -->
 +</tomcat-users>
 +</code>
  
tachtler/apache_tomcat_7_-_ldap-authentifizierung_jndirealm.1431009838.txt.gz · Zuletzt geändert: 2015/05/07 16:43 von klaus