Elasticsearch 6.4.3 x-pach破解

x-pach破解

elasticsearch在6.3版本之后x-pack默认是安装好的,且只提供基础版的功能,使用高级功能就需要进行破解。

你可以开启体验使用30天(不影响后面的破解)

启动elasticsearch后通过curl启动使用版:

curl -H "Content-Type:application/json" -XPOST  http://localhost:9200/_xpack/license/start_trial?acknowledge=true

返回如下表示开启成功:

{"acknowledged":true,"trial_was_started":true,"type":"trial"}

自己编译或者直接下载:
附件 : 链接:https://pan.baidu.com/s/10UmO8Lf2kzPHNIw54stTsg 密码:0or5

  1. 创建LicenseVerifier.java文件:
package org.elasticsearch.license;
import java.nio.*; import java.util.*;
import java.security.*;
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;
    }
}
  1. 创建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);
    }
}
  1. 分别编译两个文件
javac -cp "/usr/share/elasticsearch/modules/x-pack-core/x-pack-core-6.4.3.jar:/usr/share/elasticsearch/lib/lucene-core-7.4.0.jar:/usr/share/elasticsearch/lib/elasticsearch-core-6.4.3.jar" LicenseVerifier.java
javac -cp "/usr/share/elasticsearch/modules/x-pack-core/x-pack-core-6.4.3.jar:/usr/share/elasticsearch/lib/lucene-core-7.4.0.jar:/usr/share/elasticsearch/lib/elasticsearch-core-6.4.3.jar" XPackBuild.java
  1. 覆盖之前的jar文件

cd /usr/share
mkdir tempJar
cp /usr/share/elasticsearch/modules/x-pack-core/x-pack-core-6.4.3.jar tempJar
cd tempJar
jar -xf x-pack-core-6.4.3.jar
cp /root/LicenseVerifier.class org/elasticsearch/license/
cp /root/XPackBuild.class org/elasticsearch/xpack/core/
rm x-pack-core-6.4.3.jar
jar -cvf x-pack-core-6.4.3.jar *
cp x-pack-core-6.4.3.jar /usr/share/elasticsearch/modules/x-pack-core/
  1. 修改elasticsearch配置文件,并重启elasticsearch服务
xpack.security.enabled: true
systemctl restart elasticsearch
  1. 生成用户名密码
# 自动生成
/usr/share/elasticsearch/bin/elasticsearch-setup-passwords auto
# 手动生成
# /usr/share/elasticsearch/bin/elasticsearch-setup-passwords interactive
  1. 配置elastic密码到kibana,并重启kibana服务
cd /etc/kibana/
vim kibana.yml
#找到以下参数并修改(以下用户名和密码均为你自己的elasticsearch的账户和密码)
#就是上一步骤5生成的密码
elasticsearch.username: elastic
elasticsearch.password: XXXXXXXXXXX

systemctl restart kibana
  1. 破解

保存以下内容到license.json文件中

{
	"license": {
		"uid": "9gfhf46-5g78-4f1e-b5a4-afet359bc3a3",
		"type": "platinum",
		"issue_date_in_millis": 1534723200000,
		"expiry_date_in_millis": 2544271999999,
		"max_nodes": 100,
		"issued_to": "www.plaza4me.com",
		"issuer": "Web Form",
		"signature": "AAAAAwAAAA3lQFlr4GED3cGRsdfgrDDFEWGN0hjZDBGYnVyRXpCOsdfasdfsgEfghgdg3423MVZwUzRxVk1PSmkxagfsdf3242UWh3bHZVUTllbXNPbzBUemtnbWpBbmlWRmRZb25KNFlBR2x0TXc2K2p1Y1VtMG1UQU9TRGZVSGRwaEJGUjE3bXd3LzRqZ05iLzRteWFNekdxRGpIYlFwYkJiNUs0U1hTVlJKNVlXekMrSlVUdFIvV0FNeWdOYnlESDc3MWhlY3hSQmdKSjJ2ZTcvYlBFOHhPQlV3ZHdDQ0tHcG5uOElCaDJ4K1hob29xSG85N0kvTWV3THhlQk9NL01VMFRjNDZpZEVXeUtUMXIyMlIveFpJUkk2WUdveEZaME9XWitGUi9WNTZVQW1FMG1DenhZU0ZmeXlZakVEMjZFT2NvOWxpZGlqVmlHNC8rWVVUYzMwRGVySHpIdURzKzFiRDl4TmM1TUp2VTBOUlJZUlAyV0ZVL2kvVk10L0NsbXNFYVZwT3NSU082dFNNa2prQ0ZsclZ4NTltbU1CVE5lR09Bck93V2J1Y3c9PQAAAQCGcZtOlZwj0Rnl2MUjERG94a+xcifpVAurIA+z4rroxaqaewpb2MJLZVJt1ZCGeKB0KIWRAm2pkPjM2JigjaPIUBhpW4/yUzbdRtRuQB4loEKd7/p9EbHDh5GzeI8qfkMh3j7QaAlz4Bk+eett+ZNqNXHEdkr+Re9psdnqfUESz1uROhMoYWbn/Bdd0AJLKzhRnEOE972xdnAar8bCP1DIDljI9IOnYhEc6O6CboKCMJY4AWOvJY83bud4FO25hrKf6bMy0F2oO2yUkVV0UiFMX19JbhcC+WIAgxMk/KG7e/MqR8bJ1jNu2usMlgkvV97BxiPogTujFnTQxoHdpNdR",
		"start_date_in_millis": 1534723200000
	}
}

使用curl或kinbana提交

curl -XPUT -u elastic 'http://127.0.0.1:9200/_xpack/license' -H "Content-Type: application/json" -d @license.json

不出意外会这样

{"error":{"root_cause":[{"type":"illegal_state_exception","reason":"Cannot install a [PLATINUM] license unless TLS is configured or security is disabled"}],"type":"illegal_state_exception","reason":"Cannot install a [PLATINUM] license unless TLS is configured or security is disabled"},"status":500}

需要关闭x-pack或开始TLS认证才可以,关了简单,先关闭。

xpack.security.enabled: false

再次请求,就会成功。

然后打开x-pack,又报错。。。

ERROR: [1] bootstrap checks failed
[1]: Transport SSL must be enabled for setups with production licenses. Please set [xpack.security.transport.ssl.enabled] to [true] or disable security by setting [xpack.security.enabled] to [false]

要么关闭x-pack,要么必须打开SSL。继续配置SSL

  1. 生成节点证书

根据官网,进行配置

https://www.elastic.co/guide/en/elasticsearch/reference/current/configuring-tls.html

  1. 破解的文件需要传到所有es节点上。成功

你可能感兴趣的:(Elasticsearch 6.4.3 x-pach破解)