linux隐藏tomcat版本_Ubuntu 14.04隐藏Tomcat-7.0.52的版本号与操作系统类型

一般情况下,软件的漏洞信息和特定版本,特定操作系统是相关的,因此,软件的版本号以及操作系统类型对攻击者来说是很有价值的。

在默认情况下,Tomcat会在返回信息中把自身的版本号,操作系统类型都显示出来,如下图:

5b1f13b51b4bd9d12793edb6cc9138f2.png

这样做会造成潜在的安全风险,导致不必要的攻击行为。

在Ubuntu 14.04系统上隐藏Tomcat-7.0.52的版本号与操作系统类型的方法如下:

$ cd ~

$ mkdir catalina

$ cd catalina

$ cp /usr/share/tomcat7/lib/catalina.jar .

$ unzip catalina.jar

$ cd org/apache/catalina/util

$ vim ServerInfo.properties

1

2

3

4

5

6

7

8

9

10

11

12

13

$cd~

$mkdircatalina

$cdcatalina

$cp/usr/share/tomcat7/lib/catalina.jar.

$unzipcatalina.jar

$cdorg/apache/catalina/util

$vimServerInfo.properties

可以看到里面的内容如下:

# Licensed to the Apache Software Foundation (ASF) under one or more

# contributor license agreements. See the NOTICE file distributed with

# this work for additional information regarding copyright ownership.

# The ASF licenses this file to You under the Apache License, Version 2.0

# (the "License"); you may not use this file except in compliance with

# the License. You may obtain a copy of the License at

#

# http://www.apache.org/licenses/LICENSE-2.0

#

# Unless required by applicable law or agreed to in writing, software

# distributed under the License is distributed on an "AS IS" BASIS,

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

# See the License for the specific language governing permissions and

# limitations under the License.

server.info=Apache Tomcat/7.0.52 (Ubuntu)

server.number=7.0.52.0

server.built=Jun 30 2016 01:59:37

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

#LicensedtotheApacheSoftwareFoundation(ASF)underoneormore

#contributorlicenseagreements.SeetheNOTICEfiledistributedwith

#thisworkforadditionalinformationregardingcopyrightownership.

#TheASFlicensesthisfiletoYouundertheApacheLicense,Version2.0

#(the"License");youmaynotusethisfileexceptincompliancewith

#theLicense.YoumayobtainacopyoftheLicenseat

#

#http://www.apache.org/licenses/LICENSE-2.0

#

#Unlessrequiredbyapplicablelaworagreedtoinwriting,software

#distributedundertheLicenseisdistributedonan"AS IS"BASIS,

#WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.

#SeetheLicenseforthespecificlanguagegoverningpermissionsand

#limitationsundertheLicense.

server.info=ApacheTomcat/7.0.52(Ubuntu)

server.number=7.0.52.0

server.built=Jun30201601:59:37

直接注释掉里面的内容,如下:

# Licensed to the Apache Software Foundation (ASF) under one or more

# contributor license agreements. See the NOTICE file distributed with

# this work for additional information regarding copyright ownership.

# The ASF licenses this file to You under the Apache License, Version 2.0

# (the "License"); you may not use this file except in compliance with

# the License. You may obtain a copy of the License at

#

# http://www.apache.org/licenses/LICENSE-2.0

#

# Unless required by applicable law or agreed to in writing, software

# distributed under the License is distributed on an "AS IS" BASIS,

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

# See the License for the specific language governing permissions and

# limitations under the License.

# server.info=Apache Tomcat/7.0.52 (Ubuntu)

# server.number=7.0.52.0

# server.built=Jun 30 2016 01:59:37

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

#LicensedtotheApacheSoftwareFoundation(ASF)underoneormore

#contributorlicenseagreements.SeetheNOTICEfiledistributedwith

#thisworkforadditionalinformationregardingcopyrightownership.

#TheASFlicensesthisfiletoYouundertheApacheLicense,Version2.0

#(the"License");youmaynotusethisfileexceptincompliancewith

#theLicense.YoumayobtainacopyoftheLicenseat

#

#http://www.apache.org/licenses/LICENSE-2.0

#

#Unlessrequiredbyapplicablelaworagreedtoinwriting,software

#distributedundertheLicenseisdistributedonan"AS IS"BASIS,

#WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.

#SeetheLicenseforthespecificlanguagegoverningpermissionsand

#limitationsundertheLicense.

#server.info=ApacheTomcat/7.0.52(Ubuntu)

#server.number=7.0.52.0

#server.built=Jun30201601:59:37

修改完成后,把修改完成的数据存储到catalina.jar中。

$ cd ~

$ cd catalina

$ jar uvf catalina.jar org/apache/catalina/util/ServerInfo.properties

1

2

3

4

5

$cd~

$cdcatalina

$jaruvfcatalina.jarorg/apache/catalina/util/ServerInfo.properties

把修改后的catalina.jar放回到Tomcat的目录下面:

$ cd ~

$ cd catalina

$ sudo unlink /usr/share/tomcat7/lib/catalina.jar

$ sudo mv /usr/share/java/catalina.jar /usr/share/java/catalina.jar.old

$ sudo cp catalina.jar /usr/share/java/

$ sudo chmod +r /usr/share/java/catalina.jar

$ cd /usr/share/tomcat7/lib

$ sudo ln -s ../../java/catalina.jar catalina.jar

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

$cd~

$cdcatalina

$sudounlink/usr/share/tomcat7/lib/catalina.jar

$sudomv/usr/share/java/catalina.jar/usr/share/java/catalina.jar.old

$sudocpcatalina.jar/usr/share/java/

$sudochmod+r/usr/share/java/catalina.jar

$cd/usr/share/tomcat7/lib

$sudoln-s../../java/catalina.jarcatalina.jar

重启Tomcat的服务

$ sudo service tomcat7 restart

1

$sudoservicetomcat7restart

修改后的结果如下图所示,已经没有系统类型信息了,仅仅返回了一个404错误。

4d179c05f54f7e486cac74d7f5a0464e.png

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/574071.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

将java.util.Date类型转换成json时,使用JsonValueProcessor将date转换成希望的类型

将java.util.Date类型转换成json时,使用JsonValueProcessor将date转换成希望的类型 问题描述: java里面时间类型转换成json数据就成这样了:"createTime":{"date":30,"day":3,"hours":15,"minut…

java redis 商品秒杀_使用redis秒杀出现产品超发现象求解?

亲测,用ab 压测并发500 请求4000 无超卖!header("content-type:text/html;charsetutf-8");$redis new redis();$result $redis->connect(127.0.0.1, 7379);$redis->watch("mywatchlist");$len $redis->hlen("mywat…

删除日志为0的文件

find . -size 0 -name "*.log" -exec rm {} \; 转载于:https://www.cnblogs.com/getong/p/5143366.html

在java中8421_JAVA常量介绍

常量:在程序执行过程中,其值不发生改变的量;1、分类: 字面值常量和自定义常量;1、字面值常量有以下几种:字符串常量、小数常量、整数常量、字符常量、布尔常量(true、false)、空常量(null);2、整数常量…

自定义tabbar

/** * 注意:* 打开自定义tabbar的背景视图的交互* 选中的tabb视图高度为tabbar背景视图的高度/2-选中视图高度/2* 选中视图加载到tabbar背景视图上* label注意居中,imgView注意选择适应模式,都加载到tabbar背景视图* 设置点击手势的点击事件…

java候选码计算的替换法_候选码求解方法

候选码的求解基本方法集合一、求解候选码基本算法的具体步骤.第1 步,求关系模式R 的最小函数依赖集F第2 步, 按照上面的定义, 分别计算出UL ,UR , UB (UL 表示仅在函数依赖集中各依赖关系式左边出现的属性的集合; UR 表示仅在函数依赖集中各依赖关系式右边出现的属性的集合;另…

java post返回xml数据类型_Java 通过HttpURLConnection Post方式提交xml,并从服务端返回数据...

这里面简单介绍下,HttpURLConnection连接服务器,并返回数据客户端代码Java代码:import java.io.InputStream;import java.io.OutputStream;import java.net.HttpURLConnection;import java.net.URL;public class PostXml {public static void…

Java关键字finally

参考文章:关于Java中finally语句块的深度辨析 仅考虑程序正常执行的情况下,不考虑System.exit(0)等情况。不过关于“finally 语句块一定会执行吗?”这个问题确实会有一定的说法。 1,无控制转移语句,在return之前执行 …

单表置换密码java代码实现_单表替换密码

要求:实现单表替换密码,用键盘接收明文和密钥,屏幕答应替换表和密文,大小写敏感,输入健壮性。实际问题:密钥处理应该是这个程序的重点,加密和解密都没有什么要注意的地方。用key[]数组接收keyte…

hdu-5082

题意非常easy,就是给出父母的名字,然后依据父母的名字来给孩纸取名字! 能够将此题简化为: 孩纸的名字父亲的frist name字符串(_small_)母亲额frist name; 然后将孩纸的名字输出就可以!代码例如以…

java面试compareble_Java(面试必备):30 个 Java 集合面试问题和答案

30 个 Java 集合面试问题和答案前言今天博主将为大家分享一下Java(面试必备):30 个 Java 集合面试问题和答案,不喜勿喷,如有异议欢迎讨论!Java集合框架为Java编程语言的基础,也是Java面试中很重要的一个知识点。这里&a…

有关java的名句_关于志气的名言名句(精选50句)

1、路漫漫其修远兮,吾将上下而求索。——屈原《离骚》2、会当凌绝顶,一览众山小。——杜甫《望岳》3、志当存高远。——诸葛亮《诫外生书》4、精诚所加,金石为开。——《后汉书光武十王列传》5、天行健,君子以自强不息。——《周易…

java 折线图 放大 缩小_可拖拉放大缩小HC折线图 | JShare

可拖拉放大缩小HC折线图 | JSharevar chart Highcharts.chart(container, {chart: {zoomType: x},title: {text: Hide overlapping data labels},series: [{data: (function (arr, len) {var i;for (i 0; i < len; i i 1) {arr.push(i);}return arr;}([], 50)),dataLabe…

php二进制加密_怎样给PHP源代码加密?PHP二进制加密与解密的解决办法

分享2种PHP的源码加密方式&#xff0c;此加密方法支持任意PHP版。注意&#xff0c;加密后的PHP代码无需第三方工具解密&#xff0c;像往常一样&#xff0c;直接运行即可。function encode_file_contents($filename) {$typestrtolower(substr(strrchr($filename,.),1));if (php …

Hibernate所用15个jar包

Hbernate3.jar-------------------核心包antlr.jar----------------------------语言转换工具&#xff0c;hibernate用他将hql语句转换为sql语句dom4j.jar--------------------------解析xml文档的工具ehcahe.jar-------------------------缓存工具&#xff0c;如没提供其它缓存…

php中常用的运算符和表达式有哪几种,php 运算符与表达式详细介绍

php 运算符与表达式一、运算符的分类1、按操作数分类1.!true // 一元运算符2.$a$b // 二元运算符3.true ? 1:0 // 三元运算符2、按操功能分类(1)算术运算符1.、-、x、/、%(取余)(2)字符串运算符1.. // 例如&#xff1a;$a abc.efg;(3)赋值运算符1. // 简单赋值2.、-、X、/、…

ogrinfo使用

简介 orginfo是OGR模块中提供的一个重要工具&#xff0c;用于读取地图文件中记录&#xff0c;可以指定筛选条件&#xff08;按字段、sql、矩形范围&#xff09;使用方式 命令行参数 Usage: ogrinfo [--help-general] [-ro] [-q] [-where restricted_where][-spat xmin ymin xma…

php7与apache整合,apache集成php7.3.5的详细步骤

安装 php首先安装 php 的压缩包&#xff0c;目前下载地址解压文件到这个路径下&#xff1a;D:Program Filesphp-7.3.5(自行选择合适的路径).然后将这个路径加入到环境变量 path 中。然后打开 cmd 运行php -version,输出类似如下&#xff0c;说明安装成功。PHP 7.3.5 (cli) (bui…

php正则去除base64,使用PHP preg_match_all的正则表达式base64块

我正在尝试使用php中的正则表达式来匹配base64编码的块。 它以Content-Transfer-Encoding: base64开头&#xff0c;因此我希望可以在此之后匹配内容&#xff0c;但是下面的正则表达式无法正常工作。 请帮助我修复此正则表达式以匹配base64块。 在电子邮件正文中&#xff0c;bas…

真机iOS SDK升级后xcode不能进行真机调试 怎么办

今天升级了一下iPod的SDK到iOS8&#xff0c;xcode仅仅能支持到7.1&#xff0c;真机调试遇到问题&#xff1f;&#xff1f;&#xff1f;以下是解决的方法&#xff01;找到xcode&#xff0c;点击右键。打开显示包内容&#xff0c;按路径Contents/Develpoer/Platforms/iPoneOS.pla…