elasticsearch6.8.1 x-pack插件破解
一、为什么要破解x-pack?
因为涉及到了ES服务的安全性.ES服务如果被劫持,数据直接会被删除。ES登录账号和密码的设置是通过x-pack来实现的,官方只给了免费的30天的使用权,而且购买插件每年需要不少的钱,这对于中小型企业来说,是一笔不小的开支,然后你懂的。
二、本次任务是在搭建好的elk基础上进行破解elasticsearch6.8.1 x-pack插件
三、适用范围所有ES版本5.*,6.*,7目前还没研究过,破解原理大致相同。
四、开始搭建
elk6.3版本之后,x-pack都是默认安装,无需install
1.重写x-pack下的2个类:LicenseVerifier.java和XPackBuild.java,反编译破解补丁
创建目录test
mkdir test
cd test
vim LicenseVerifier.java
package org.elasticsearch.license;
import java.nio.*; import java.util.*;
import java.security.*;
import org.elasticsearch.common.xcontent.*;
import org.apache.lucene.util.*;
import org.elasticsearch.common.io.*;
import java.io.*; public class LicenseVerifier {
public static boolean verifyLicense(final License license, final byte[] encryptedPublicKeyData) {
return true;
} public static boolean verifyLicense(final License license) {
return true;
}
}
vim XPackBuild.java
package org.elasticsearch.xpack.core;
import org.elasticsearch.common.io.*;
import java.net.*;
import org.elasticsearch.common.*;
import java.nio.file.*;
import java.io.*;
import java.util.jar.*;
public class XPackBuild {
public static final XPackBuild CURRENT;
private String shortHash;
private String date;
@SuppressForbidden(reason = "looks up path of xpack.jar directly") static Path getElasticsearchCodebase() {
final URL url = XPackBuild.class.getProtectionDomain().getCodeSource().getLocation();
try { return PathUtils.get(url.toURI()); }
catch (URISyntaxException bogus) {
throw new RuntimeException(bogus); }
} XPackBuild(final String shortHash, final String date) {
this.shortHash = shortHash;
this.date = date;
} public String shortHash() {
return this.shortHash;
}
public String date(){
return this.date;
} static {
final Path path = getElasticsearchCodebase();
String shortHash = null;
String date = null;
Label_0157: { shortHash = "Unknown"; date = "Unknown";
} CURRENT = new XPackBuild(shortHash, date);
}
}
将刚创建的两个java包打包成class文件,我们需要做的就是替换这两个class文件(因里面需要引用到其他的jar,故需要用到javac -cp命令)
javac -cp "/usr/local/elasticsearch/lib/elasticsearch-6.8.1.jar:/usr/local/elasticsearch/lib/lucene-core-7.7.0.jar:/usr/local/elasticsearch/modules/x-pack-core/x-pack-core-6.8.1..jar" LicenseVerifier.java
javac -cp "/usr/local/elasticsearch/lib/elasticsearch-6.8.1.jar:/usr/local/elasticsearch/lib/lucene-core-7.7.0.jar:/usr/local/elasticsearch/modules/x-pack-core/x-pack-core-6.8.1..jar:/usr/local/elasticsearch/lib/elasticsearch-core-6.8.1..jar" XPackBuild.java
会生成2个class文件
LicenseVerifier.class
XPackBuild.class
把原文件给解压出来,然后覆盖生成新的文件
cp -a /usr/local/elasticsearch/modules/x-pack-core/x-pack-core-6.8.1.jar .
jar -xf x-pack-core-6.8.1.jar
删除多余的文件
mv x-pack-core-6.8.1.jar /tmp/
rm -rf LicenseVerifier.java XPackBuild.java
\cp -a LicenseVerifier.class org/elasticsearch/license/
\cp -a XPackBuild.class org/elasticsearch/xpack/core/
rm -rf LicenseVerifier.class XPackBuild.class
压缩,替换原文件
jar -cvf x-pack-core-6.8.1.jar *
cp -a x-pack-core-6.8.1.jar /usr/local/elasticsearch/modules/x-pack-core/
chown -R elasticsearch. /usr/local/elasticsearch/
服务重启
kill -9 `ps -ef|grep "elasticsearch\/lib"|awk '{print $2}'`
su - elasticsearch
cd /usr/local/elasticsearch/bin/
./elasticsearch -d
到此破解补丁准备完成。
2.去官网申请license证书https://license.elastic.co/registration官网地址;邮箱需要认真写,主要用来接收json文件,其他可以随便写.然后就是修改申请到的证书,主要修改如下:
"type":"basic" 替换为 "type":"platinum" # 基础版变更为铂金版
"expiry_date_in_millis":1561420799999 替换为 "expiry_date_in_millis":3107746200000# 1年变为50年
3.上传证书完成修改
上传证书主要有两种方法:
(1)在kibana上传证书
上传前准备,打开/usr/local/elasticsearch/config/elasticsearch.yml配置文件加入
xpack.security.enabled: false
启动elasticsearch服务和kibana服务,上传证书,上传成功时可以看到时间由1个月变成50年,到此破解x-pack已经成功了.
(2)在命令行
将证书上传到主机,从命令行导入,默认为changeme:
curl -XPUT -u elastic:changeme 'http://node02:9200/_xpack/license' -H "Content-Type: application/json" -d @license.json
查看是否破解成功:
curl -XGET -u elastic:changeme node02:9200/_license
如果看到类型为platinum,expiry_date变为50年,表示破解成功.
到此,x-pack插件破解完成!
5.开启ES的登录功能
1.重置登陆权限密码(如果是集群,需要在每个节点都要重置密码,并且密码要相同)
bin/elasticsearch-setup-passwords interactive
按步骤分别重置elastic/kibana等账号的密码
elastic就是登陆elasticsearch服务的最高权限账号
2.修改/usr/local/elasticsearch/config/elasticsearch.yml配置
添加如下2行,打开安全配置功能
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
3.修改kibana配置
在/usr/local/kibana/config/kibana.yml下添加如下两行
elasticsearch.username: "elastic"
elasticsearch.password: "password"
此处修改完后,重启ES和kibana服务就需要登陆账号和密码了
4.x-pack设置完毕后,head无法登陆的问题
在/usr/local/elasticsearch/config/elasticsearch.yml中添加如下三行配置
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type
重启服务,并通过如下形式访问head端口
http://10.0.0.11:9100/?auth_user=elastic&auth_password=passwd
最后供上我破解的文件,只需要更换就可以:
链接:https://pan.baidu.com/s/1gnZQCV-bmRIARdmDNiz1TA
提取码:0ls5
elasticsearch6.8.1 x-pack插件破解的更多相关文章
- Windows 7上QTP11破解及java等插件破解方法
QTP11破解方法: 1.准备文件 注册机mgn-mqt82.exe 2.安装QTP11 3.运行注册机mgn-mqt82.exe 如果运行mgn-mqt82.exe 没有反应-,请注意关掉暂时关掉杀 ...
- windows下安装elasticsearch-6.4.3和elasticsearch-head插件
windows下安装elasticsearch-6.4.3和elasticsearch-head插件 博客分类: elasticsearch es ElasticSearch下载地址:https:/ ...
- Mac App破解之路九 vscode插件破解
破解对象: luaide 破解目的:学习如何破解vscode插件 破解背景: vsscode用了这么多年,安装了很多插件,其中luaide插件是收费的. 说实话,100块并不贵, 我本来准备买的. ...
- intellij IDEA mybatis插件破解方法
1>安装mybatis插件,找到mybatis_plus.jar包的位置,在C:\Users\LZHL\.IntelliJIdea2016.3\config\plugins\mybatis_pl ...
- (新)elasticsearch6.0版本安装head插件
ES6.0版本安装head插件 1.1 前言 不知道是我电脑问题还是最近的开源软件都比较**,mysql和elasticsearch新版本变动都比较大. elasticsearch6.0貌似已经不支持 ...
- centos7安装elasticsearch6.3.x集群并破解安装x-pack
一.环境信息及安装前准备 主机角色(内存不要小于1G): 软件及版本(百度网盘链接地址和密码:链接: https://pan.baidu.com/s/17bYc8MRw54GWCQCXR6pKjg 提 ...
- ELK(Elasticsearch6.0以上版本head插件安装)
参考:https://www.cnblogs.com/Onlywjy/p/Elasticsearch.html Elasticsearch6.0不能使用命令直接安装head插件 修改配置文件/etc/ ...
- elasticsearch6.0版本安装head插件
ES6.0版本安装head插件 1.1 前言 不知道是我电脑问题还是最近的开源软件都比较**,mysql和elasticsearch新版本变动都比较大. elasticsearch6.0貌似已经不支持 ...
- ES之一:Elasticsearch6.4 windows安装 head插件ik分词插件安装
准备安装目标:1.Elasticsearch6.42.head插件3.ik分词插件 第一步:安装Elasticsearch6.4 下载方式:1.官网下载 https://www.elastic.co/ ...
随机推荐
- 关于崩溃报告的日志以及dump文件
在用户使用软件的过程当中突然产生软件崩溃的问题,必须采取相关的措施去拦截崩溃产生的原因,这有助于程序员解决此类崩溃的再次发生.特别是有些难以复现的崩溃,不稳定的崩溃,更有必要去调查崩溃产生的原因.一般 ...
- KETTLE——初见KETTLE
(PS:这是很早以前在CSDN上发过的,那个账号不想用了,所以搬过来) 就在前一段时间,因为公司需要突然被老大告知要用一个ETL工具,第一次知道这么个工具,完全不知道是做什么的.大概问了一下,说是一种 ...
- spring的基础配置
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...
- Java ——对象 类 方法重载 构造方法 封装 内部类
本节重点思维导图 快捷键 生成代码:alt+shift+s 提取变量:alt+shift+L 快速复制行:alt+ctrl+向上或向下的箭头 删除行:ctrl+d 类:对同一种事物共同属性和行为的抽象 ...
- 详细解析arry.map() ,function.apply() 方法
首先转载一篇博文:关于map 和callbackfn 的一些参数和返回值可以查看以下链接. http://www.cnblogs.com/xuan52rock/p/4460938.html array ...
- ajax传文件用express的multer接住
html部分: //input type设为file <input type="file" name="file" id="fileInputE ...
- ZOJ-1610 线段树+两种查询方法(弥补我线段树区间填充的短板)
ZOJ-1610 线段树+两种查询方法(弥补我线段树区间填充的短板) 题意 题意:给一个n,代表n次操作,接下来每次操作表示把[l,r]区间的线段涂成k的颜色其中,l,r,k的范围都是0到8000 这 ...
- mysql远程命令连接
#mysql -h 服务器地址 -P 端口 -u账号 -p密码 mysql -uroot -proot
- ex2、逻辑回归
介绍: 在本练习中,您将实现逻辑回归,并将其应用于两个不同的数据集.在开始编程练习之前,我们强烈要求建议观看视频讲座并完成相关主题的问题.要开始练习,您需要下载起始代码并将其内容解压缩到要完成练习的目 ...
- RMAN备份与恢复 —— 完全恢复与不完全恢复
名词解释: 顾名思义,完全恢复就是指数据没有丢失的恢复了.不完全恢复是指恢复后有部分数据丢失.它们是数据库的两种恢复方式. 完全恢复:利用重做日志或增量备份将数据块恢复到最接近当前时间的 ...