【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站点的方式登录查看站点的一些日志及部署文件.它的登录方式 ...
随机推荐
- vue3.2如何将写hooks呢?
场景 有些时候,我们需要将一个页面拆分成各个模块. 这些模块包含增加,删除,修改,等 并且这些模块会处理非常复杂的业务逻辑问题 所以,我们最好是将他们分开. 如何将分离新增模块拆离出去 主页面 < ...
- 【JS 逆向百例】PEDATA 加密资讯以及 zlib.gunzipSync() 的应用
关注微信公众号:K哥爬虫,持续分享爬虫进阶.JS/安卓逆向等技术干货! 声明 本文章中所有内容仅供学习交流,抓包内容.敏感网址.数据接口均已做脱敏处理,严禁用于商业用途和非法用途,否则由此产生的一切后 ...
- C语言输出键盘
使用printf()函数输出样式 #include <stdio.h> int main() { printf("┌───┬───┬───┬───┬───┬───┬───┬─── ...
- SqlSugar入门
SqlSugar入门 创建对象 你可以使用 SqlSugarClient (new模式)或者 SqlSugarScope (单例) 对数据库进行增.删.查.改等功能 注意:除了名字和使用模式不同,功能 ...
- 大规模语言LLaVA:多模态GPT-4智能助手,融合语言与视觉,满足用户复杂需求
大规模语言LLaVA:多模态GPT-4智能助手,融合语言与视觉,满足用户复杂需求 一个面向多模式GPT-4级别能力构建的助手.它结合了自然语言处理和计算机视觉,为用户提供了强大的多模式交互和理解.LL ...
- 【3】opencv_contrib 4.3.0库配置+opencv安装
相关文章: [1]windows下安装OpenCV(4.3)+VS2017安装+opencv_contrib4.3.0配置 [2]Visual Studio 2017同时配置OpenCV2.4 以及O ...
- 2.7 CE修改器:多级指针查找
在本步骤中,你需要使用多级指针的概念来查找健康值真正的地址并修改它.多级指针就是一个指针的指针,也就是第一个指针指向第二个指针,第二个指针指向第三个指针,以此类推,最终指向你想要访问的地址. 首先,你 ...
- Centos8 配置IP地址与阿里YUM源
Centos8 系统中无法找到network.service网络服务,默认已经被nmcli替换了,所以修改方式略微变化,在/etc/sysconfig/network-scripts/里也看不到任何脚 ...
- Arduino-电位器调节led
Arduino-电位器调节led 电位器相关: 电位器是具有三个引出端.阻值可按某种变化规律调节的电阻元件.电位器通常由电阻体和可移动的电刷组成.当电刷沿电阻体移动时,在输出端即获得与位移量成一定关系 ...
- 利用显卡的SR-IOV虚拟GPU技术,实现一台电脑当七台用
背景 虚拟桌面基础设施(VDI)技术一般部署在服务器,可以实现多个用户连接到服务器上的虚拟桌面.随着桌面计算机性能的日益提升,桌面计算机在性能在很多场景下已经非常富余,足够同时满足多个用户同时使用的需 ...