首頁 資料庫 mysql教程 HTTP Status 403 – Access to the requested resource has been

HTTP Status 403 – Access to the requested resource has been

Jun 07, 2016 pm 03:30 PM
access http the

访问地址: http://localhost:8080/manager/status http://localhost:8080/manager/html 错误提示 HTTP Status 403 – Access to the requested resource has been denied type Status report message Access to the requested resource has been denied des

访问地址:

http://localhost:8080/manager/status

http://localhost:8080/manager/html

错误提示

HTTP Status 403 – Access to the requested resource has been denied


type Status report

message Access to the requested resource has been denied

description Access to the specified resource (Access to the requested resource has been denied) has been forbidden.


Apache Tomcat/7.0.21

解决方法:

先进入manager所在目录
[root@localhost tomcat]# cd webapps/manager/WEB-INF/
查看 web.xml
[root@localhost WEB-INF]# more  web.xml

  <!-- Define a Security Constraint on this Application -->
  <!-- NOTE:  None of these roles are present in the default users file -->
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>HTML Manager interface (for humans)</web-resource-name>
     <span> <url-pattern>/html/*</url-pattern> 对应:http://localhost:8080/manager/html</span>
    </web-resource-collection>
    <auth-constraint>
      <span> <role-name>manager-gui</role-name> 定义了访问这个页面的角色名:manage-gui</span>
    </auth-constraint>
  </security-constraint>
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Text Manager interface (for scripts)</web-resource-name>
      <url-pattern>/text/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
       <role-name>manager-script</role-name>
    </auth-constraint>
  </security-constraint>
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>JMX Proxy interface</web-resource-name>
      <url-pattern>/jmxproxy/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
       <role-name>manager-jmx</role-name>
    </auth-constraint>
  </security-constraint>

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Status interface</web-resource-name>
    <span> <url-pattern>/status/*</url-pattern> 对应:http://localhost:8080/manager/status  </span>
    </web-resource-collection>
    <auth-constraint>
      <span> <role-name>manager-gui</role-name> </span>
       <role-name>manager-script</role-name>
       <role-name>manager-jmx</role-name>
       <role-name>manager-status</role-name>
    </auth-constraint>
  </security-constraint>
登入後複製

进入host-manager所在目录
[root@localhost tomcat]# cd webapps/host-manager/WEB-INF/
查看 web.xml
[root@localhost WEB-INF]# more  web.xml

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>HTMLHostManager commands</web-resource-name>
      <url-pattern><span>/html/*</span></url-pattern> <span>对应:<span>http://192.168.14.219:8080/host-manager/</span>htm</span>l
    </web-resource-collection>
    <auth-constraint>
       <!-- NOTE:  This role is not present in the default users file -->
      <span> <role-name>admin-gui</role-name> 定义了管理角色名称</span></auth-constraint>
  </security-constraint>
登入後複製
  <!-- Security roles referenced by this web application -->
  <security-role>
    <description>
      <span>The role that is required to log in to the Host Manager Application HTML</span>
<span> interface</span>
    </description>
    <span><role-name>admin-gui</role-name></span>
  </security-role>
  <security-role>
    <description>
      The role that is required to log in to the Host Manager Application text
      interface
    </description>
    <role-name>admin-script</role-name>
  </security-role>
登入後複製

 

编辑Tomcat用户配置文件,添加角色
[root@localhost tomcat]# vi conf/tomcat-users.xml

<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.
-->
<span><!-- 这里有个注释符号去掉,使下面的生效</span>
  <role rolename="tomcat"/>
  <role rolename="role1"/>
<!--添加管理页面访问角色-->
 <span> <role rolename="manager-gui"></role> </span>
 <span> <role rolename="admin-gui"></role></span>
  <span><user username="manager" password="manager" roles="manager-gui,admin-gui">>
  <user username="tomcat" password="tomcat" roles="tomcat"></user>
  <user username="both" password="tomcat" roles="tomcat,role1"></user>
  <user username="role1" password="tomcat" roles="role1"></user>
<span>--> 这里有个注释符号去掉,是下面的生效</span>
</user></span></span></tomcat-users>
登入後複製

重启 tomcat

[root@localhost tomcat]# ./bin/shutdown.sh
[root@localhost tomcat]# ./bin/startup.sh

总结:
虚拟目录/WEB-INF/web.xml一般定义了访问这个目录的安全角色名称,得知这个安全角色名称后便可在conf/tomcat-users.xml添加对应的访问角色,获得访问权限。(于是这里也是个黑客可以利用的后门。。。)


本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

AI Hentai Generator

AI Hentai Generator

免費產生 AI 無盡。

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
2 週前 By 尊渡假赌尊渡假赌尊渡假赌
倉庫:如何復興隊友
4 週前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒險:如何獲得巨型種子
3 週前 By 尊渡假赌尊渡假赌尊渡假赌

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

Windows11怎麼停用後台應用程式_Windows11停用後台應用程式教學 Windows11怎麼停用後台應用程式_Windows11停用後台應用程式教學 May 07, 2024 pm 04:20 PM

Windows11怎麼停用後台應用程式_Windows11停用後台應用程式教學

deepseek怎麼轉換pdf deepseek怎麼轉換pdf Feb 19, 2025 pm 05:24 PM

deepseek怎麼轉換pdf

無法允許存取 iPhone 中的相機和麥克風 無法允許存取 iPhone 中的相機和麥克風 Apr 23, 2024 am 11:13 AM

無法允許存取 iPhone 中的相機和麥克風

field在java中是什麼意思 field在java中是什麼意思 Apr 25, 2024 pm 10:18 PM

field在java中是什麼意思

Java反射機制如何修改類別的行為? Java反射機制如何修改類別的行為? May 03, 2024 pm 06:15 PM

Java反射機制如何修改類別的行為?

vue中iframe跨域的方法 vue中iframe跨域的方法 May 02, 2024 pm 10:48 PM

vue中iframe跨域的方法

記憶體長什麼樣 記憶體長什麼樣 Apr 21, 2024 pm 01:01 PM

記憶體長什麼樣

Java 函數開發中常見的異常類型及其修復措施 Java 函數開發中常見的異常類型及其修復措施 May 03, 2024 pm 02:09 PM

Java 函數開發中常見的異常類型及其修復措施

See all articles