参考:
前置说明:
本人立场:不支持大家破解,只供大家学习使用。支持大家去购买正版,正版的License链接:https://www.elastic.co/subscriptions
说明:
- 软件版本
- elasticsearch-6.2.4
- kibana-6.2.4-linux-x86_64
- x-pack-6.2.4.zip
- 位置
- elasticsearch: /data/soft/elasticsearch-6.2.4/
- kibana: /data/soft/kibana-6.2.4-linux-x86_64/
- x-pack:
- 原版:/data/soft/ceshi/x-pack-6.2.4.zip(后期会删除)
- 破解的:/data/soft/ceshi/x-pack-6.2.4_pojie.zip
- x-pack-core-6.2.4.jar:
- 原版:/data/soft/ceshi/tmp/x-pack-core-6.2.4/x-pack-core-6.2.4.jar(jar解压后会删除)
- 破解的:/data/soft/ceshi/tmp/x-pack-core-6.2.4/x-pack-core-6.2.4.jar
- java文件:
- /data/soft/ceshi/tmp/XPackBuild.java
- /data/soft/ceshi/tmp/LicenseVerifier.java
- 编译后的class文件:
- /data/soft/ceshi/tmp/XPackBuild.class
- /data/soft/ceshi/tmp/LicenseVerifier.class
- 访问
- ES: http://es.dev(我开启了nginx代理, kibana同样。如果你没代理,则是http://localhost:9200 和 http://localhost:5601访问)
- Kibana: http://kibana.dev
- 工具
- 密码:
password - license
- 文件:/Users/nishi/Downloads/license.json
- 内容:
{ "license": { "uid": "fc978bcf-0220-403f-8dba-689070310eb2", "type": "platinum", "issue_date_in_millis": 1526428800000, "expiry_date_in_millis": 2524579200999, "max_nodes": 1000, "issued_to": "ceshi ceshi (aa)", "issuer": "Web Form", "signature": "AAAAAwAAAA1b+cl8GBV/IwBEZ/UbAAABmC9ZN0hjZDBGYnVyRXpCOW5Bb3FjZDAxOWpSbTVoMVZwUzRxVk1PSmkxaktJRVl5MUYvUWh3bHZVUTllbXNPbzBUemtnbWpBbmlWRmRZb25KNFlBR2x0TXc2K2p1Y1VtMG1UQU9TRGZVSGRwaEJGUjE3bXd3LzRqZ05iLzRteWFNekdxRGpIYlFwYkJiNUs0U1hTVlJKNVlXekMrSlVUdFIvV0FNeWdOYnlESDc3MWhlY3hSQmdKSjJ2ZTcvYlBFOHhPQlV3ZHdDQ0tHcG5uOElCaDJ4K1hob29xSG85N0kvTWV3THhlQk9NL01VMFRjNDZpZEVXeUtUMXIyMlIveFpJUkk2WUdveEZaME9XWitGUi9WNTZVQW1FMG1DenhZU0ZmeXlZakVEMjZFT2NvOWxpZGlqVmlHNC8rWVVUYzMwRGVySHpIdURzKzFiRDl4TmM1TUp2VTBOUlJZUlAyV0ZVL2kvVk10L0NsbXNFYVZwT3NSU082dFNNa2prQ0ZsclZ4NTltbU1CVE5lR09Bck93V2J1Y3c9PQAAAQAqb+texZEGBZ2RWJbgS4OGxAbTNAQqP60DEH0h6HlLiTUgUPLNxTa8YCRoFPZQEg8/7VTtCNeM/ooJtRgeS+frU9qRr/uEfkxk+P+Y/OaHKPyKOWCF3XnU+HKnKh65JJNapt+8at65J51hpSbQhQk5/uBnNBR3b2rTrx3cKKSMozkuJqixAouXSCkGAKIkHQ5RfS5efsifSpG16ZsTHYfInN2LDA1/xku2kcYGUGQoj6zvjvXn7EUa3MMw5dTlNmy1wTETyDc6vvAMm6kDSNeqYmNSYbXUd0I4tIOiKgR0PXeYPPO+uITETUF/PSMnubFIJYBXDX0R3KuMGtBXHt0W", "start_date_in_millis": 1526428800000 } }
步骤:
1. 破解x-pack
-
解压原版x-pack
unzip /data/soft/ceshi/x-pack-6.2.4.zip -
找到x-pack-core-6.2.4.jar
路径:/data/soft/ceshi/elasticsearch/core/x-pack-core-6.2.4.jar,拷贝到/data/soft/ceshi/tmp/x-pack-core-6.2.4/x-pack-core-6.2.4.jar -
修改关键代码:(使用Luyten打开x-pack-core-6.2.4.jar)
-
LicenseVerifier.class:
拷贝 org.elasticsearch.license.LicenseVerifier.class内容,新建LicenseVerifier.java(位置:/data/soft/ceshi/tmp/LicenseVerifier.java),将两个静态方法(verifyLicense、verifyLicense)中内容删除,改为"return true;"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; } }
-
XPackBuild.class:
拷贝 org.elasticsearch.xpack.core.XPackBuild.class内容,新建XPackBuild.java(位置:/data/soft/ceshi/tmp/XPackBuild.java),最后一个静态代码块中 try的部分全部删除,这部分会验证jar包是否被修改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); } }
-
-
重新打包成x-pack-core-6.2.4.jar
- 编译XPackBuild.class
javac -cp "/data/soft/elasticsearch-6.2.4/lib/elasticsearch-6.2.4.jar:/data/soft/elasticsearch-6.2.4/lib/lucene-core-7.2.1.jar:/data/soft/ceshi/tmp/x-pack-core-6.2.4.jar:/data/soft/elasticsearch-6.2.4/lib/elasticsearch-core-6.2.4.jar" XPackBuild.java
- 编译LicenseVerifier.class
javac -cp "/data/soft/elasticsearch-6.2.4/lib/elasticsearch-6.2.4.jar:/data/soft/elasticsearch-6.2.4/lib/lucene-core-7.2.1.jar:/data/soft/ceshi/tmp/x-pack-core-6.2.4.jar" LicenseVerifier.java
- jar解压
jar -xvf x-pack-core-6.2.4.jar - 删除x-pack-core-6.2.4.jar
rm -f x-pack-core-6.2.4.jar - 拷贝覆盖修改的class(XPackBuild.class LicenseVerifier.class)
当前目录: /data/soft/ceshi/tmp/x-pack-core-6.2.4cp /data/soft/ceshi/tmp/XPackBuild.class org/elasticsearch/xpack/core/XPackBuild.class cp /data/soft/ceshi/tmp/LicenseVerifier.class org/elasticsearch/license/LicenseVerifier.class
- jar打包
jar -cvf x-pack-core-6.2.4.jar ./*,得到:x-pack-core-6.2.4.jar - 替换原版的x-pack-core-6.2.4.jar
cp /data/soft/ceshi/tmp/x-pack-core-6.2.4/x-pack-core-6.2.4.jar elasticsearch/core/x-pack-core-6.2.4.jar - 删除多余的包
当前目录:/data/soft/ceshi
rm -rf tmp/ x-pack-6.2.4.zip - 重新压缩
zip -r x-pack-6.2.4_pojie.zip ./*
2. 安装x-pack
- elasticsearch安装x-pack
/data/soft/elasticsearch-6.2.4/bin/elasticsearch-plugin install file:///data/soft/ceshi/x-pack-6.2.4_pojie.zip
- kibana安装x-pack
/data/soft/kibana-6.2.4-linux-x86_64/bin/kibana-plugin install file:///data/soft/ceshi/x-pack-6.2.4_pojie.zip
- 重置x-pack账户密码
- 临时开启elasticsearch
/data/soft/elasticsearch-6.2.4/bin/elasticsearch - 重置密码
/data/soft/elasticsearch-6.2.4/bin/x-pack/setup-passwords interactive
- 关闭elasticsearch
Ctrl+c
- 临时开启elasticsearch
- elasticsearch.yml修改不开启x-pack安全认证(为了修改License需要,后面会改回来)
配置文件: /data/soft/elasticsearch-6.2.4/config/elasticsearch.ymlxpack.security.enabled: false
- kibana.yml添加elasticsearch x-pack密码配置
elasticsearch.username: "elastic" elasticsearch.password: "password"
- 开启elasticsearch, kibana
- 开启elasticsearch
/data/soft/elasticsearch-6.2.4/bin/elasticsearch - 开启kibana
/data/soft/kibana-6.2.4-linux-x86_64/bin/kibana
- 开启elasticsearch
3. 安装License
- license:
内容:参考“说明”里的
文件:将内容保存到本地文件,比如:/Users/nishi/Downloads/license.json - 访问kibana
http://kibana.dev - 修改License
- Management -> License Management -> Install it now(Have a newer license? Splendid! Install it now)
- 上传license.json
- 开启x-pack安全认证
配置文件: /data/soft/elasticsearch-6.2.4/config/elasticsearch.yml# xpack安全验证是否开启 xpack.security.enabled: true xpack.security.transport.ssl.enabled: true
网友评论