ElasticsearchX-package 6.6.1破解及安装教程

1.把jar包拿出来,单独解压出来

jar -xvf x-pack-core-6.6.1.jar

下载 luyten

下载页面:https://github.com/deathmarine/Luyten/releases

软件下载下来,打开软件,把x-pack-core-6.6.1.jar 丢进去,就能看到我们jar包的源代码了。

我们需要把2个文件提取出来进行修改。

org.elasticsearch.license.LicenseVerifier

org.elasticsearch.xpack.core.XPackBuild

1、修改LicenseVerifier

LicenseVerifier 中有两个静态方法,这就是验证授权文件是否有效的方法,我们把它修改为全部返回true.

package org.elasticsearch.license;

 

import java.nio.*;

import org.elasticsearch.common.bytes.*;

import java.security.*;

import java.util.*;

import org.elasticsearch.common.xcontent.*;

import org.apache.lucene.util.*;

import org.elasticsearch.core.internal.io.*;

import java.io.*;

 

public class LicenseVerifier

{

public static boolean verifyLicense(final License license, final byte[] publicKeyData) {

return true;

}

public static boolean verifyLicense(final License license) {

return true;

}

}

 

 

2、修改XPackBuild

XPackBuild 中最后一个静态代码块中 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);

}

}

 

 

javac -cp "/usr/local/elasticsearch-6.6.1/lib/elasticsearch-6.6.1.jar:/usr/local/elasticsearch-6.6.1/lib/lucene-core-7.6.0.jar:/usr/local/elasticsearch-6.6.1/modules/x-pack-core/x-pack-core-6.6.1.jar:/usr/local/elasticsearch-6.6.1/modules/x-pack-core/netty-common-4.1.30.Final.jar:/usr/local/elasticsearch-6.6.1/lib/elasticsearch-core-6.6.1.jar" LicenseVerifier.java
javac -cp "/usr/local/elasticsearch-6.6.1/lib/elasticsearch-6.6.1.jar:/usr/local/elasticsearch-6.6.1/lib/lucene-core-7.6.0.jar:/usr/local/elasticsearch-6.6.1/modules/x-pack-core/x-pack-core-6.6.1.jar:/usr/local/elasticsearch-6.6.1/modules/x-pack-core/netty-common-4.1.30.Final.jar:/usr/local/elasticsearch-6.6.1/lib/elasticsearch-core-6.6.1.jar" XPackBuild.java

 

 

打包

$ cp /home/elastic/XPackBuild.class ./org/elasticsearch/xpack/core/

cp /home/elastic/LicenseVerifier.class ./org/elasticsearch/license/

 

jar -cvf x-pack-core-6.6.1_new.jar -C x-pack-core-6.6.1 .

放到原来的目录,然后重启下进程。

1.去官网申请个license,执行以下命令,这样就是白金版的了

[elastic@dm-elk-01 ~]$ curl -XPUT -u elastic:changeme 'http://172.18.2.144:9200/_xpack/license' -H "Content-Type: application/json" -d @1.json
{"acknowledged":true,"license_status":"valid"}[elastic@dm-elk-01 ~]$

 

[elastic@dm-elk-01 bin]$ ./elasticsearch-setup-passwords auto
Initiating the setup of passwords for reserved users elastic,apm_system,kibana,logstash_system,beats_system,remote_monitoring_user.
The passwords will be randomly generated and printed to the console.
Please confirm that you would like to continue [y/N]y


Changed password for user apm_system
PASSWORD apm_system = 24UtJKbNI1UqHUQkKPZY

Changed password for user kibana
PASSWORD kibana = 8SSZMisIY0NZFMCS6wv9

Changed password for user logstash_system
PASSWORD logstash_system = rFhWkYzayIUZVl8VIunJ

Changed password for user beats_system
PASSWORD beats_system = U1B4O5SKrSEatqDQRsQz

Changed password for user remote_monitoring_user
PASSWORD remote_monitoring_user = zdpj7HqO02yRXZR9Bwa2

Changed password for user elastic
PASSWORD elastic = tWbWZc7NE3wYqS6DvSu4

 

 

[elastic@dm-elk-01 bin]$ curl -XGET -u elastic:tWbWZc7NE3wYqS6DvSu4 http://172.18.2.144:9200/_license
{
  "license" : {
    "status" : "active",
    "uid" : "d8a53c64-fa8f-407c-8a8f-e3e1442c8c73",
    "type" : "platinum",
    "issue_date" : "2019-01-17T00:00:00.000Z",
    "issue_date_in_millis" : 1547683200000,
    "expiry_date" : "2039-01-17T08:59:12.000Z",
    "expiry_date_in_millis" : 2178867552000,
    "max_nodes" : 900,
    "issued_to" : "li ming (1988)",
    "issuer" : "Web Form",
    "start_date_in_millis" : 1547683200000
  }
}

 

破解成功。

 

 

你可能感兴趣的:(ElasticsearchX-package 6.6.1破解及安装教程)