【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站点的方式登录查看站点的一些日志及部署文件.它的登录方式 ...
随机推荐
- Qt连接MySQL的问题解决方法
Qt5在连接MySQL数据库时会出现一些问题,本文介绍两种最常见的问题,以及其相对简单的解决办法. Qt5数据库支持列表里没有MySQL 输入以下代码查看支持的数据库类型 //打印支持的数据库类型 q ...
- mysql系列基础篇03----约束
一.概述 1.概念:约束是作用于表中字段上的规则,用于限制存储在表中的数据 2.目的:保证数据库中数据的正确,有效性和完整性. 3.分类 二.约束演示 创建一个用户表 create table my ...
- 手撕Vuex-实现共享数据
经过上一篇章介绍,完成了添加全局 $store,接下来就是实现共享数据的功能. 在 Vuex 中,共享数据是通过 state 来实现的,所以我们需要在 Nuex.js 文件中实现 state 的功能. ...
- 设计模式学习-使用go实现组合模式
组合模式 定义 适用范围 优点 缺点 代码实现 参考 组合模式 定义 组合模式(Composite),将对象组合成树形结构以表示'部分-整体'的层次关系.组合模式使得用户对单个对象和组合对象的使用具有 ...
- BigDecimal详解和精度问题
JavaGuide :「Java学习+面试指南」一份涵盖大部分 Java 程序员所需要掌握的核心知识. BigDecimal 是大厂 Java 面试常问的一个知识点. <阿里巴巴 Java 开发 ...
- Milvus性能优化提速之道:揭秘优化技巧,避开十大误区,确保数据一致性无忧,轻松实现高性能
Milvus性能优化提速之道:揭秘优化技巧,避开十大误区,确保数据一致性无忧,轻松实现高性能 Milvus 是全球最快的向量数据库,在最新发布的 Milvus 2.2 benchmark中,Milvu ...
- 大语言模型的预训练4:指示学习Instruction Learning详解以及和Prompt Learning,In-content Learning区别
大语言模型的预训练[4]:指示学习Instruction Learning:Entailment-oriented.PLM oriented.human-oriented详解以及和Prompt Lea ...
- 深度学习基础入门篇[六]:模型调优,学习率设置(Warm Up、loss自适应衰减等),batch size调优技巧,基于方差放缩初始化方法。
深度学习基础入门篇[六]:模型调优,学习率设置(Warm Up.loss自适应衰减等),batch size调优技巧,基于方差放缩初始化方法. 1.学习率 学习率是训练神经网络的重要超参数之一,它代表 ...
- 【五】AI Studio 项目详解【VisualDL工具、环境使用说明、脚本任务、图形化任务、(五)在线部署及预测】PARL
相关文章 [一]-环境配置+python入门教学 [二]-Parl基础命令 [三]-Notebook.&pdb.ipdb 调试 [四]-强化学习入门简介 [五]-Sarsa&Qlear ...
- 19.9 Boost Asio 同步字典传输
这里所代指的字典是Python中的样子,本节内容我们将通过使用Boost中自带的Tokenizer分词器实现对特定字符串的切割功能,使用Boost Tokenizer,可以通过构建一个分隔符或正则表达 ...