【Azure 应用服务】App Service 默认页面暴露Tomcat版本信息,存在安全风险
问题描述
在创建Azure App Service时,服务端的配置使用Java 8 + Tomcat 8.5。默认的根目录页面显示出App Service Tomcat版本信息,存在一定的安全隐患。

如何来避免这个问题呢?
问题解答
因为在初始创建App Service时,Azure会根据所选Stack, Web Server的信息默认生成首页内容。大多是情况下,在部署您的应用时,默认的首页内容会被替换掉。
App Service默认使用的首页名称如下(这些文件位于wwwroot目录下):

但对于Java Tomcat服务,默认的首页启动路径为 wwwroot/webapps/ROOT/index.jsp, 所以只需要修改 index.jsp中的内容或者删除这个文件就可以避免根路径 (“/”) 泄露服务信息。
修改步骤
1)登录App Service Kudu站点 ( 在左侧目录栏中选择 Advanced Tools –> Go 进入Kudu站点(https://<your app service name>.scm.chinacloudsites.cn/)), 选择 Debug Console 页面
2) 进入 HOME\SITE\WWWROOT\WEBAPPS\ROOT 目录

点击编辑 index.jsp 或者删除这个文件(文件删除后,访问App Service默认URL会返回404错误)
修改index.jsp文件:
如把内容修改为:This is Java Site...保存后,在浏览器中再次访问App Service

删除index.jsp文件

以上方式均可以避免在App Service的首页暴露 服务端Tomcat 信息!
默认生成的Index.jsp 内容
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Microsoft Azure App Service - Welcome</title>
<link rel="SHORTCUT ICON" href="https://c.s-microsoft.com/favicon.ico?v2" type="image/x-icon"/>
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/4.1.1/css/bootstrap.min.css" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="https://appservice.azureedge.net/css/linux-landing-page/v3/main.css">
<style>
#container {
position: relative;
}
#abc{
position: relative;
bottom: 0px;
}
.abc{
position: relative;
bottom: 0px;
}
</style>
<script type="text/javascript">
window.onload=function(){try{var a=window.location.hostname;if(a.includes(".azurewebsites.net")){a=a.replace(".azurewebsites.net", "")}var b=document.getElementById("depCenterLink");b.setAttribute("href", b.getAttribute("href") + "&sitename=" + a);}catch(d){}}
</script>
</head>
<body>
<nav class="navbar navbar-light bg-light">
<a class="navbar-brand " href="#">
<div class="container pl-4 ml-5">
<img src="https://appservice.azureedge.net/images/linux-landing-page/v3/microsoft_azure_logo.png" width="270" height="108" alt=""> </div>
</a>
</nav>
<div class="container-fluid container-height mr-2">
<div class="pt-10 pb-10 mt-10 mb-10 d-xxs-none d-xs-none d-sm-none d-md-none d-lg-block d-xl-block" style="height:20px; width:100%; clear:both;"></div>
<div class="row">
<div class="row col-xs-12 col-sm-12 d-block d-lg-none d-xl-none d-md-block d-sm-block d-xs-block">
<div class="text-center">
<img src="https://appservice.azureedge.net/images/linux-landing-page/v3/java.svg"> </div>
</div>
<div class=" extra-pl-small-scr offset-xl-1 offset-lg-1 offset-md-2 offset-sm-2 offset-xs-4 col-xl-5 col-lg-5 col-md-10 col-sm-11 col-xs-11 div-vertical-center">
<div class="container-fluid">
<div class="row">
<h2>Hey, Java developers!</h2>
</div>
<br>
<div class="row">
<h4>Your app service is up and running.</h4>
</div>
<div class="row">
<h4>Time to take the next step and deploy your code.</h4>
</div>
<div class="row info-mg-top">
<p class=" pl-0 col-md-6 col-sm-12 info-mg-top">
Have your code ready?<br>
Use deployment center to get code published from your client or setup continuous deployment.<br>
<a id='depCenterLink' href="https://go.microsoft.com/fwlink/?linkid=2057852">
<button class="btn btn-primary btn-mg-top" type="submit">Deployment Center</button>
</a>
</p>
<p class="pl-0 offset-md-1 col-md-5 col-sm-12 info-mg-top">
Don't have your code yet?<br>
Follow our quickstart guide and you'll have a full app ready in 5 minutes or less.<br>
<button onclick="location.href='http://aka.ms/java-quickstart-windows'" class="btn btn-primary btn-mg-top" type="submit">Quickstart</button>
</p>
</div>
</div>
</div>
<div class="col-xl-5 col-lg-5 col-md-12 d-none d-lg-block">
<div class="text-center">
<img src="https://appservice.azureedge.net/images/linux-landing-page/v3/java.svg">
</div>
</div>
<div class="col-xl-1 col-lg-1 col-md-1"></div>
</div>
<div class="row">
<div class=" extra-pl-small-scr offset-xl-1 offset-lg-1 offset-md-2 offset-sm-2 offset-xs-4 col-xl-5 col-lg-5 col-md-10 col-sm-11 col-xs-11 iv-vertical-center">
<div class="container-fluid">
<div class="row">
<b>Technical Information</b>
</div>
<div class="row">
<%@ page import="java.util.*" %>
<%
ArrayList<String> mainPageProps = new ArrayList<String>();
mainPageProps.add("catalina.base");
mainPageProps.add("jetty.base");
mainPageProps.add("java.version");
mainPageProps.add("java.home");
for(String name : mainPageProps)
{
String value = System.getProperty(name);
if(value != null)
{
out.print(name + ": " + value + "<br>");
}
}
%>
</div>
</div>
</div>
<div class="col-xl-5 col-lg-5 col-md-12 d-none d-lg-block"></div>
<div class="col-xl-1 col-lg-1 col-md-1"></div>
</div>
</div>
<!-- Bootstrap core JavaScript==================================================-->
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.2.1.min.js" crossorigin="anonymous"></script>
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/4.1.1/bootstrap.min.js" crossorigin="anonymous"></script>
</body>
</html>Java Index Page
【Azure 应用服务】App Service 默认页面暴露Tomcat版本信息,存在安全风险的更多相关文章
- 【应用服务 App Service】快速获取DUMP文件(App Service for Windows(.NET/.NET Core))
问题情形 当应用在Azure 应用服务App Service中运行时,有时候出现CPU,Memory很高,但是没有明显的5XX错误和异常日志,有时就是有异常但是也不能明确的指出具体的代码错误.当面临这 ...
- 【应用服务 App Service】Azure 应用服务测试网络访问其他域名及请求超时限制(4分钟 ≈ 230秒)
测试App Service是否可以访问其他DNS 当应用服务(Azure App Service)创建完成后,想通过ping命令来查看是否可以访问其他站点或解析DNS,但是发现ping命令无法使用.这 ...
- 【应用服务 App Service】App Service中抓取网络日志
问题描述 众所周知,Azure App Service是一种PaaS服务,也就是说,IaaS层面的所有内容都由平台维护,所以使用App Service的我们根本无法触碰到远行程序的虚拟机(VM), 所 ...
- 【应用服务 App Service】App Service 中部署Java应用中文乱码现象
问题情形 有时候部署在 Azure App Service的 Java应用会出现乱码 详细日志 无 问题原因 因为 App Service默认的编码为gbk,所以在显示页面或传递中文字符时就会出现乱 ...
- 【应用服务 App Service】App Service发生错误请求时,如何查看IIS Freb日志,从中得知错误所发生的模块,请求中所携带的Header信息
问题描述 在使用Azure App Service时候,我们有时候对 一些请求发生错误毫无头绪,能从错误代码中知道请求错误,但是更多的信息呢? 当我们需要更多的信息时候,通常有以下的一些方式来查找问题 ...
- K8S 如何隐藏产品TomCat版本信息
k8s隐藏TomCat版本信息,通过sidecar方式初始化修改server.xml文件,并挂载到容器中 1.添加initcontainers initContainers: - name: conf ...
- Linux 查看Tomcat版本信息
Linux 查看Tomcat版本信息 如果我们想运行在 Linux 下的 Tomcat 版本信息,只需要在 Tomcat 的 bin/ 目录下,运行 version.sh 脚本即可. 1.使用如下命令 ...
- 【应用服务 App Service】发布到Azure上的应用显示时间不是本地时间的问题,修改应用服务的默认时区
问题情形 应用程序发布到App Service后,时间显示不是北京时间,默认情况为UTC时间,比中国时间晚 8 个小时. 详细日志 无 问题原因 Azure 上所有的服务时间都采用了 UTC 时间. ...
- 【Azure 应用服务】App Service服务无法启动,打开Kudu站点,App Service Editor 页面均抛出:The service is unavailable
问题描述 App Service 服务URL无法访问,进入门户中的Advanced Tools(Kudu).App Service Editor (Preview)等页面无法打开, 打开就出现 The ...
- 【应用服务 App Service】解决无法从Azure门户SSH登录问题
问题描述 中国区的Azure App Service(应用服务)已经支持创建Docker并选择Linux环境.在使用中,我们可以继续通过kudu站点的方式登录查看站点的一些日志及部署文件.它的登录方式 ...
随机推荐
- [转帖]NOHZ = ON如何影响Linux内核中的do_timer()?
https://www.jb51.cc/faq/897483.html 如何解决NOHZ = ON如何影响Linux内核中的do_timer()?? 首先,让我们了解什么是tickless kerne ...
- [转帖]一起来体验96核心、192线程CPU——第四代AMD EPYC处理器独家测试
http://k.sina.com.cn/article_1882475282_70344b12027010s1x.html 与第三代EPYC 7003系列处理器相比,新一代EPYC 9004系列处理 ...
- HUBUCTF 2022新生赛Writeup
既然是母校,那一定要好好对待~ 2024-01-13 22:42:34 WEB [HUBUCTF 2022 新生赛]checkin 题目链接:checkin 原题 <?php show_ ...
- TienChin-课程管理-数据表创建
CREATE TABLE `tienchin_course` ( `course_id` int NOT NULL AUTO_INCREMENT COMMENT '课程ID', `type` int ...
- Visual Studio部署C++矩阵库Armadillo的方法
本文介绍在Visual Studio软件中配置C++环境下线性代数运算库Armadillo的方法. 首先,我们需要在Armadillo库官网下载其源代码,直接点击下图所示红色框内部分即可. ...
- python截取字符串(字符串切片)
python中使用[]来截取字符串,语法: 字符串[起始位置:结束位置] 一.起始位置:结束位置 先看几个例子: s = 'python' print(s) #输出 python 直接输出字符串 #从 ...
- (python)每日代码||2024.2.2||python当中,True==1竟然引发了问题
做题的时候有的测试点里竟然用True替换1,骗过了我的代码,结果没过测试点 lst = [1, True] for item in lst: if not isinstance(item, bool) ...
- Oracle-创建用户不带C##(Oracle 19c)
由于oracle从12c开始引入了容器(PDB和CDB).租户的概念.直接连接sysdba用户创建新用户时,会默认在CDB中创建公有用户,用户名需要以"C##"或"c## ...
- IIS创建和管理虚拟网站
实验介绍: 本文会详细介绍创建虚拟站点的三种方法 一:IP地址建立站点 1.打开安装了IIS的windows,进入ip配置页面. 添加几个ip,我这里添加的是192.168.1.209,192.168 ...
- 吉特日化MES 与周边系统集成架构
作者:情缘 出处:http://www.cnblogs.com/qingyuan/ 关于作者:从事仓库,生产软件方面的开发,在项目管理以及企业经营方面寻求发展之路 版权声明:本文版权归作者和博客园 ...