【Azure 应用服务】App Service 默认页面暴露Tomcat版本信息,存在安全风险

简介: 【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 内容

默认生成的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
目录
打赏
0
2
2
2
194
分享
相关文章
【Azure App Service】基于Linux创建的App Service是否可以主动升级内置的Nginx版本呢?
基于Linux创建的App Service是否可以主动升级内置的Nginx版本呢?Web App Linux 默认使用的 Nginx 版本是由平台预定义的,无法更改这个版本。
134 77
|
2月前
|
C#
【Azure Function】Function App出现System.IO.FileNotFoundException异常
Exception while executing function: xxxxxxx,The type initializer for 'xxxxxx.Storage.Adls2.StoreDataLakeGen2Reading' threw an exception. Could not load file or assembly 'Microsoft.Extensions.Configuration, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the
115 64
【Azure App Service】App Service 是否支持HostName SNI 证书?
App Service 支持 HostName SNI 证书。为自定义域名添加 SSL 证书时,可以选择 SNI SSL 和基于 IP 的 SSL。SNI SSL 允许多个 TLS/SSL 证书保护同一 IP 地址上的多个域,适用于大多数现代浏览器。配置方法是在添加自定义域名后,点击 Add binding 配置 SNI SSL。参考文档:[Azure 官方文档](https://docs.azure.cn/zh-cn/app-service/configure-ssl-bindings#add-the-binding)。
【Azure Function】Function App门户上的Test/Run返回错误:Failed to fetch
Running your function in portal requires the app to explicitly accept requests from https://portal.azure.cn. This is known as cross-origin resource sharing (CORS).Configure CORS to add https://portal.azure.cn to allowed origins.
Tomcat 管理页面
一、配置刚下载的解压版的apache-tomcat,启动后,通过浏览器访问:http://127.0.0.1:8080/(或者http://localhost:8080)然后点击下图的Server status X 在登录界面输入用户名 both 和密码 tomcat 后出现下面的错误提示:...
966 0
tomcat管理员在远程(不同)机器上访问管理页面
tomcat8.5管理员默认只能在安装tomcat的机器上访问,如果想在其他机器上访问,则需要进行配置修改 添加用户和权限(\conf\tomcat-users.xml): 修改tomcat管理功能配置文件(/webapps/manager/META-INF/context.
1336 0
tomcat管理端的页面安全措施
由于公司的项目并未启用nginx负载均衡,所以自然也没用到tomcat与web应用一对一的安全操作,经常会遇到   重启单个应用又不想重启tomcat的情况.同时,又出于安全考虑,将tomcat的默认管理页面给删除了,这无疑给应用维   护带来诸多不便.
956 0
Tomcat如何配置PFX证书?
【10月更文挑战第2天】Tomcat如何配置PFX证书?
348 7
Tomcat如何配置JKS证书?
【10月更文挑战第2天】Tomcat如何配置JKS证书?
568 4
centos7环境下tomcat8的安装与配置
本文介绍了在Linux环境下安装和配置Tomcat 8的详细步骤。首先,通过无网络条件下的文件交互软件(如Xftp 6或MobaXterm)下载并解压Tomcat安装包至指定路径,启动Tomcat服务并测试访问。接着,修改Tomcat端口号以避免冲突,并部署Java Web应用项目至Tomcat服务器。最后,调整Linux防火墙规则,确保外部可以正常访问部署的应用。关键步骤包括关闭或配置防火墙、添加必要的端口规则,确保Tomcat服务稳定运行。

热门文章

最新文章

  • 1
    SpringBoot集成Tomcat、DispatcherServlet
    5
  • 2
    MNN-LLM App:在手机上离线运行大模型,阿里巴巴开源基于 MNN-LLM 框架开发的手机 AI 助手应用
    225
  • 3
    原生鸿蒙版小艺APP接入DeepSeek-R1,为HarmonyOS应用开发注入新活力
    22
  • 4
    【11】flutter进行了聊天页面的开发-增加了即时通讯聊天的整体页面和组件-切换-朋友-陌生人-vip开通详细页面-即时通讯sdk准备-直播sdk准备-即时通讯有无UI集成的区别介绍-开发完整的社交APP-前端客户端开发+数据联调|以优雅草商业项目为例做开发-flutter开发-全流程-商业应用级实战开发-优雅草Alex
    10
  • 5
    【08】flutter完成屏幕适配-重建Android,增加GetX路由,屏幕适配,基础导航栏-多版本SDK以及gradle造成的关于fvm的使用(flutter version manage)-卓伊凡换人优雅草Alex-开发完整的社交APP-前端客户端开发+数据联调|以优雅草商业项目为例做开发-flutter开发-全流程-商业应用级实战开发-优雅草Alex
    30
  • 6
    【Azure App Service】基于Linux创建的App Service是否可以主动升级内置的Nginx版本呢?
    4
  • 7
    【Azure Function】Function App出现System.IO.FileNotFoundException异常
    1
  • 8
    1688APP 原数据 API 接口的开发、应用与收益
    10
  • 9
    PiliPala:开源项目真香,B站用户狂喜!这个开源APP竟能自定义主题+去广告?PiliPala隐藏功能大揭秘
    11
  • 10
    APP-国内主流安卓商店-应用市场-鸿蒙商店上架之必备前提·全国公安安全信息评估报告如何申请-需要安全评估报告的资料是哪些-优雅草卓伊凡全程操作
    5
  • 1
    iOS|记一名 iOS 开发新手的前两次 App 审核经历
    12
  • 2
    2025同城线下陪玩APP开发/电竞游戏平台搭建游戏陪玩APP源码/语音APP开发
    18
  • 3
    flutter3-wetrip跨平台自研仿携程app预约酒店系统模板
    25
  • 4
    通过外部链接启动 Flutter App(详细介绍及示例)
    21
  • 5
    【03】仿站技术之python技术,看完学会再也不用去购买收费工具了-修改整体页面做好安卓下载发给客户-并且开始提交网站公安备案-作为APP下载落地页文娱产品一定要备案-包括安卓android下载(简单)-ios苹果plist下载(稍微麻烦一丢丢)-优雅草卓伊凡
    55
  • 6
    【02】仿站技术之python技术,看完学会再也不用去购买收费工具了-本次找了小影-感觉页面很好看-本次是爬取vue需要用到Puppeteer库用node.js扒一个app下载落地页-包括安卓android下载(简单)-ios苹果plist下载(稍微麻烦一丢丢)-优雅草卓伊凡
    46
  • 7
    【01】仿站技术之python技术,看完学会再也不用去购买收费工具了-用python扒一个app下载落地页-包括安卓android下载(简单)-ios苹果plist下载(稍微麻烦一丢丢)-客户的麻将软件需要下载落地页并且要做搜索引擎推广-本文用python语言快速开发爬取落地页下载-优雅草卓伊凡
    40
  • 8
    【Azure Function】Function App门户上的Test/Run返回错误:Failed to fetch
    36
  • 9
    小游戏源码开发之可跨app软件对接是如何设计和开发的
    42
  • 10
    原生鸿蒙版小艺APP接入DeepSeek-R1,为HarmonyOS应用开发注入新活力
    179
  • AI助理

    你好,我是AI助理

    可以解答问题、推荐解决方案等