一、为什么要破解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插件破解的更多相关文章

  1. Windows 7上QTP11破解及java等插件破解方法

    QTP11破解方法: 1.准备文件 注册机mgn-mqt82.exe 2.安装QTP11 3.运行注册机mgn-mqt82.exe 如果运行mgn-mqt82.exe 没有反应-,请注意关掉暂时关掉杀 ...

  2. windows下安装elasticsearch-6.4.3和elasticsearch-head插件

    windows下安装elasticsearch-6.4.3和elasticsearch-head插件 博客分类: elasticsearch es  ElasticSearch下载地址:https:/ ...

  3. Mac App破解之路九 vscode插件破解

    破解对象: luaide 破解目的:学习如何破解vscode插件 破解背景: vsscode用了这么多年,安装了很多插件,其中luaide插件是收费的.  说实话,100块并不贵, 我本来准备买的. ...

  4. intellij IDEA mybatis插件破解方法

    1>安装mybatis插件,找到mybatis_plus.jar包的位置,在C:\Users\LZHL\.IntelliJIdea2016.3\config\plugins\mybatis_pl ...

  5. (新)elasticsearch6.0版本安装head插件

    ES6.0版本安装head插件 1.1 前言 不知道是我电脑问题还是最近的开源软件都比较**,mysql和elasticsearch新版本变动都比较大. elasticsearch6.0貌似已经不支持 ...

  6. centos7安装elasticsearch6.3.x集群并破解安装x-pack

    一.环境信息及安装前准备 主机角色(内存不要小于1G): 软件及版本(百度网盘链接地址和密码:链接: https://pan.baidu.com/s/17bYc8MRw54GWCQCXR6pKjg 提 ...

  7. ELK(Elasticsearch6.0以上版本head插件安装)

    参考:https://www.cnblogs.com/Onlywjy/p/Elasticsearch.html Elasticsearch6.0不能使用命令直接安装head插件 修改配置文件/etc/ ...

  8. elasticsearch6.0版本安装head插件

    ES6.0版本安装head插件 1.1 前言 不知道是我电脑问题还是最近的开源软件都比较**,mysql和elasticsearch新版本变动都比较大. elasticsearch6.0貌似已经不支持 ...

  9. ES之一:Elasticsearch6.4 windows安装 head插件ik分词插件安装

    准备安装目标:1.Elasticsearch6.42.head插件3.ik分词插件 第一步:安装Elasticsearch6.4 下载方式:1.官网下载 https://www.elastic.co/ ...

随机推荐

  1. VMware 虚拟化编程(3) —VMware vSphere Web Service API 解析

    目录 目录 前文列表 VMware vSphere Web Services API VMware vSphere Web Services SDK vSphere WS API 中的托管对象 Man ...

  2. python时间模块time,时间戳,结构化时间,字符串时间,相互转换,datetime

    time.time() 时间戳 time.localtime() time.localtime() 得到的是一个对象,结构化时间对象 struct_time 通过对象.属性,拿到对应的值 time.g ...

  3. GMS认证测试FQA

    ---摘要 本文档用于收录GMS认证测试的异常问题,提供一般性指导.对于本文档中未提供解答的问题请咨询@开发经理或@领域技术专家 cts测试工具如何获取? A:见Google官网 https://so ...

  4. 5G调研与总结

    5G的重点是: 将极大地超越现有的4G,主要包括速度,时延,带宽,能耗等方面 传输速度的快速提高(相对于4G来说提升了近10倍),在万物物联上的作用会更大 由于传速度快,让各种远程操控成为了可能(AR ...

  5. Common Linux Commands 日常工作常用Linux命令

      How to know CPU info      cat /proc/cpuinfo      arch   How to know memory info: cat /proc/meminfo ...

  6. data plugin for vs2019

    Reporting Service projects for VS 2019https://marketplace.visualstudio.com/items?itemName=ProBITools ...

  7. 《剑指offer》面试题18 树的子结构 Java版

    (输入两棵二叉树A和B,判断B是不是A的子结构.补充下,根据书中的代码来看,子结构的定义并不包括叶子节点下的null,也就是说只要B的存在数字的结构存在于A中就行,那么如果B是null树,那么就不属于 ...

  8. HTML5-video(播放暂停视频;打开关闭声音;进度条)

    <!DOCTYPE html> <html> <head> <title>HTML5-video(播放暂停视频:打开关闭声音:进度条)</titl ...

  9. zip loader

    GS.ZipAssetLoader = function(audioContext) { this.audioContext = audioContext, this.objLoader = new ...

  10. 23飞机大战__pygame 快速入门

      1. 使用 pygame 创建图形窗口 小节目标 游戏的初始化和退出 理解游戏中的坐标系 创建游戏主窗口 简单的游戏循环 可以将图片素材 绘制 到 游戏的窗口 上, 开发游戏之前需要先知道 如何建 ...