Tomcat摘要与Manager WebApp [英] Tomcat Digest with Manager WebApp

查看:127
本文介绍了Tomcat摘要与Manager WebApp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为tomcat管理器应用程序设置摘要密码.

I'm trying to get a digest password setup for the tomcat manager application.

我有

<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase" digest="MD5"/>

在我的tomcat server.xml中,将管理器Web应用程序的web.xml更改为使用摘要,并将领域名称更改为TESTING:

in my tomcat server.xml changed the manager web application's web.xml to use digest and changed the realm name to TESTING:

<login-config>
    <auth-method>DIGEST</auth-method>
    <realm-name>TESTING</realm-name>
  </login-config>

然后我使用随附的bat文件生成md5哈希值:

I then used the included bat file to generate the md5 hash:

C:\tomcat6\bin>digest.bat -a MD5 tomcat:TESTING:testor
tomcat:TESTING:testor:1926e50988667dbd5deda9df02b82f28

然后,我在tomcat-users.xml中有一个用户,该用户使用该摘要哈希作为密码:

I then have a user in tomcat-users.xml with that digested hash as a password:

<!-- testor -->
  <user username="tomcat" password="1926e50988667dbd5deda9df02b82f28" roles="manager"/>

我还修改了401.jsp页面,以将摘要和TESTING用作领域名称.

I've also modifed the 401.jsp page to use digest and TESTING as the realm name.

我启动了Web应用程序,请转到 http://localhost:8080/manager/html 并提示输入标准表格.输入 tomcat 作为用户,并输入 testor 作为密码,我只按Enter即可获得401.我当然会再试一次获得401.

I start up the web app, go to http://localhost:8080/manager/html and am prompted with the standard form. Typing in tomcat as the user, and testor as the password, I hit enter only to get a 401. I of course try again and again get a 401.

据我所知,由于蚂蚁无法消化,最终我可能会通过SSL进行BASIC身份验证.

I'll probably go with BASIC authentication over SSL in the end since ant can't do digest, as far as I know.

但是反正有这样做吗?

But is there anyway to do this?

推荐答案

我在Tomcat 8.0.32中尝试了KiaMorot的答案,但是它没有用.当我在生成摘要密码时添加了选项"-s 0"(盐度为零)时,它确实起作用了:

I tried out KiaMorot's answer with Tomcat 8.0.32, but it did not work. It did work when I added the option "-s 0" (salt lenth zero) when generating the digested password:

sudo/opt/apache-tomcat-8.0.32/bin/digest.sh -s 0 -a MD5'开发人员:用户数据库:我的明文密码'

sudo /opt/apache-tomcat-8.0.32/bin/digest.sh -s 0 -a MD5 'developer:UserDatabase:my clear text password'

在此命令的引用中,我省略了明文密码,而将其替换为字符串我的明文密码".请保留单引号,否则外壳程序将在您的密码中解释特殊字符.

In this citation of my command I omitted my clear text password and replaced it with the string "my clear text password". Please keep the single quotes, otherwise the shell will interpret special characters in your password.

您可以检查是否忽略-s选项是您的问题,如下所示.如果我在没有-s选项的情况下多次执行了digest.sh命令,尽管每次重复的命令行都是相同的,但我得到的结果却不同.

You can check whether omitting the -s option is your problem as follows. If I do the digest.sh command multiple times without the -s option, I get different results although the command-line of each repetition is the same.

这篇关于Tomcat摘要与Manager WebApp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆