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/ ...
随机推荐
- oracle系统调优
在Oracle数据库系统中,起到调节作用的参数叫初始化参数,在Oracle 8i及以前的版本中,这些初始化参数记录在INITsid.ora文件中:而Oracle 9i/10g/11g中将这些参数记录在 ...
- Java 八大基本数据类型
相关信息获取: (1)最小值:包装类.MIN_VALUE,如 Integer.MIN_VALUE (2)最大值:包装类.MAX_VALUE,如 Integer.MAX_VALUE (3)二进制位数:包 ...
- 阶段1 语言基础+高级_1-3-Java语言高级_09-基础加强_第2节 反射_11_反射_案例
student定义sleep方法 用反射+配置文件 定义配置文件 src下new file.新建 加载配置文件.Properties里面有一个load方法,可以加载.properties结尾的配置文件 ...
- Beetle简单构建TCP服务
使用Beetle构建TCP服务应用是件非常简单的事情,它并不需要你去关注Socket细节,如果你想用Socket编写高性能的TCP服务,那你要关注的东西非常多,异步数据处理,大量连接下的线程管理和连接 ...
- POI读取指定Excel中行与列的数据
import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFRow; import ...
- 【SD系列】SAP SD模块-公司间销售简介
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[SD系列]SAP SD模块-公司间销售简介 ...
- Proteus报错处理经验:power rails ‘GND’ and 'VCC/VDD' are interconnected in net VCC
1 前言 初学Proteus,画好原理图后遇到了power rails 'GND' and 'VCC/VDD' are interconnected in net VCC的报错. 尝试了网上的解决办法 ...
- c# 对象相等性和同一性
一:对象相等性和同一性 System.Object提供了名为Equals的虚方法,作用是在两个对象包含相同值的前提下返回true,内部实现 public class Object { public v ...
- js之状态模式
level01:电灯程序 <!DOCTYPE html> <html lang="en"> <head> <meta charset=&q ...
- from 表单回车自动提交
自动提交的情况 1 表单只有单个输入框 2 type=‘submit 这里注意button默认type为submit 解决方法 1 添加一个隐藏的输入框 2 form添加属性 onsubmit=&q ...