You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jon Eaves <jo...@eaves.org> on 2002/12/17 14:35:18 UTC

Tomcat Administration Tool

Hi all,

The Tomcat Admin Tool uses a UserDatabaseRealm for authentication and
for editing as part of the configuration options. This uses the
conf/tomcat-users.xml file for the source of information

I was interested in knowing if anybody has configured Tomcat _and_
the Admin tool to use an alternate Realm, like JDBCRealm or a
close cousin that the Admin Tool can manage ?

I'd be interested in hearing from anybody who has gone down this
path

Cheers,
	-- jon
-- 
Jon Eaves <jo...@eaves.org>
http://www.eaves.org/jon/


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Tomcat Administration Tool

Posted by Rasputin <ra...@idoru.mine.nu>.
* Jon Eaves <jo...@eaves.org> [1238 13:38]:
> Hi all,
> 
> The Tomcat Admin Tool uses a UserDatabaseRealm for authentication and
> for editing as part of the configuration options. This uses the
> conf/tomcat-users.xml file for the source of information
> 
> I was interested in knowing if anybody has configured Tomcat _and_
> the Admin tool to use an alternate Realm, like JDBCRealm or a
> close cousin that the Admin Tool can manage ?

Do you using another way to limit access to the admin tool? If so, then
read the realm howto on the homepage; I use a PostgreSQL database for 
storing users and passwords, it works weel for me.

If you mean you want to be able to manage these password databases using
the admin servlet, then I'm not sure; Tomcat doesn't have write access
to my database tables (I use other ways of inserting new users) so it
wouldn't be able to update my database, for example.

-- 
Rasputin :: Jack of All Trades - Master of Nuns

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Tomcat Administration Tool

Posted by Luc Santeramo <lu...@univ-avignon.fr>.
Hi,

I've written a doc about that
but it's in french...

there a doc in english on tomcat website
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/realm-howto.html

anyway, here is mine (maybe google will translate it for you....) :


Mise en place JDBC Realm pour Tomcat

(stockage des utilisateurs et de leurs roles dans un base de données)


----------



Versions installées :

    * Jakarta Tomcat 4.0.6
    * MySQL 3.23.51
    * JDBC Driver mm.mysql-2.0.14-bin.jar

Liens utiles :
    * http://jakarta.apache.org/tomcat/tomcat-4.0-doc/realm-howto.html


Creation de la base de données

Sous mysql, creer la base principale :

mysql> create database tomcat_users;
mysql> GRANT select ON tomcat_users.* TO tomcatuser@localhost IDENTIFIED BY 
'xxxxxxx';

Créer les tables :

# création des tables utiles pour Tomcat JDBC Realm
# répéter la création de ces 2 tables pour chaque webapps de tomcat

## webapp xxxx

create table xxxx_users (
user_name varchar(8) not null primary key,
user_pass varchar(40) not null
# 40 pour les mots de passe md5
);

create table xxxx_user_roles (
user_name varchar(8) not null,
role_name varchar(20) not null,
primary key (user_name, role_name)
);

Créer les utilisateurs

Faire des scripts de creation d'utilisateurs :

# creation utilisateur
insert into xxxx_users values ('username', 'md5pass')

# ajout de role pour un utilisateur
insert into xxxx_user_roles values ('username', 'rolename');

Pour générer un mot de passe md5 à partir d'un mot de passe en clair, 
executer :

$ java -classpath "$CATALINA_HOME/server/lib/catalina.jar" 
org.apache.catalina.realm.RealmBase -a MD5 motdepasseenclair



Mise en place des drivers

Copier le driver (mm.mysql-2.0.14-bin.jar) dans le repertoire 
$CATALINA_HOME/common/lib ou $CATALINA_HOME/server/lib



Configuration Tomcat

Editer le fichier server.xml

Commenter la ligne suivante :

<Realm className="org.apache.catalina.realm.MemoryRealm" />

Ajouter les lignes suivantes dans la partie <Engine name="Standalone" 
defaultHost="localhost" debug="0"> :

<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
driverName="org.gjt.mm.mysql.Driver"
connectionURL="jdbc:mysql://localhost/tomcat_users"
connectionName="tomcatuser"
connectionPassword="xxxxxx"
digest="MD5"
userTable="manager_users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="manager_user_roles" roleNameCol="role_name" />

Et pour chaque webapps necessitant la définition de roles, suivre l'exemple 
suivant :

<!-- MyWebapp Context -->
<Context path="/MyWebapp" docBase="MyWebapp"
debug="0" privileged="true">
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
driverName="org.gjt.mm.mysql.Driver"
connectionURL="jdbc:mysql://localhost/tomcat_users"
connectionName="tomcatuser"
connectionPassword="xxxxx"
digest="MD5"
userTable="mywebapp_users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="mywebapp_user_roles" roleNameCol="role_name" />
</Context>



Relancer Tomcat

en root :

# /etc/init.d/jakarta-tomcat restart



It works fine for me :)

hope it helps

Luc

At 00:35 18/12/2002  +1100, you wrote:
>Hi all,
>
>The Tomcat Admin Tool uses a UserDatabaseRealm for authentication and
>for editing as part of the configuration options. This uses the
>conf/tomcat-users.xml file for the source of information
>
>I was interested in knowing if anybody has configured Tomcat _and_
>the Admin tool to use an alternate Realm, like JDBCRealm or a
>close cousin that the Admin Tool can manage ?
>
>I'd be interested in hearing from anybody who has gone down this
>path
>
>Cheers,
>         -- jon
>--
>Jon Eaves <jo...@eaves.org>
>http://www.eaves.org/jon/
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>