linuxea:ELK5.5-elasticsearch-x-pack破解


I. 创建LicenseVerifier.java文件

[root@linuxea.com-Node61 /elk/]# cat 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;
    }
}

II. 编译class文件

[root@linuxea.com-Node49 ~/elk]# javac -cp "/usr/share/elasticsearch/lib/elasticsearch-5.5.1.jar:/usr/share/elasticsearch/lib/lucene-core-6.6.0.jar:/usr/share/elasticsearch/plugins/x-pack/x-pack-5.5.1.jar" LicenseVerifier.java 
[root@linuxea.com-Node49 ~/elk]# ls
LicenseVerifier.class 
LicenseVerifier.java  
[root@linuxea.com-Node49 ~/elk]# cd /usr/share/elasticsearch/plugins/x-pack/
[root@linuxea.com-Node49 /usr/share/elasticsearch/plugins/x-pack]# mkdir test
[root@linuxea.com-Node49 /usr/share/elasticsearch/plugins/x-pack]# mv x-pack-5.5.1.jar test/
[root@linuxea.com-Node49 /usr/share/elasticsearch/plugins/x-pack]# 

备份下x-pack-5.5.1.jar

[root@linuxea.com-Node49 /usr/share/elasticsearch/plugins/x-pack/test]# cp xvf x-pack-5.5.1.jar /opt

解压

[root@linuxea.com-Node49 /usr/share/elasticsearch/plugins/x-pack/test]# jar xvf x-pack-5.5.1.jar 

替换class

[root@linuxea.com-Node49 /usr/share/elasticsearch/plugins/x-pack/test]# cd org/elasticsearch/license
[root@linuxea.com-Node49 /usr/share/elasticsearch/plugins/x-pack/test/org/elasticsearch/license]# cp /root/elk/LicenseVerifier.class ./

回到test目录打包

[root@linuxea.com-Node49 /usr/share/elasticsearch/plugins/x-pack/test/org/elasticsearch/license]# cd /usr/share/elasticsearch/plugins/x-pack/test/
[root@linuxea.com-Node49 /usr/share/elasticsearch/plugins/x-pack/test]# jar cvf x-pack-5.5.1.jar .

将打包好的文件放回x-pack目录下

[root@linuxea.com-Node49 /usr/share/elasticsearch/plugins/x-pack/test]# cp x-pack-5.5.1.jar ../

III. 申请license

https://license.elastic.co/registration

申请完成后很快会发送到邮箱,而后修改license文件
它分有不同的版本,版本有不同的权限,如下:
open source开源版本
basic基础版本
gold是黄金版
PLATINUM铂金版

curl -XPUT -u elastic 'http://<host>:<port>/_xpack/license' -H "Content-Type: application/json" -d @license.json

IV. 修改license

申请一个license后会发到邮箱,然后修改下即可

{"license":{"uid":"d13W1FM-ef9XWi-45eAKLH6-afT5b4-b8erC7460","type":"platinum","issue_date_in_millis":11042324000000,"expiry_date_in_millis":2535123399999,"max_nodes":100,"issued_to":"sean wang (alibaba)","issuer":"Web Form","signature":"AAAAAwAAAA2kxmZrvpZZohthD/HAAAABmC9ZN0hjZDBGYnVyRXpCOW5Bb3FjZDAxOWpSbTVoMVZwUzRxVk1PSmkxaktJRVl5MUYvUWWpBbmlWRmRZb25KNFlBR2x0TXc2K2p1Y1VtMG1UQU9TRGZVSGRwaEJGUjE3bXd3LzRqZ05iLzRteWFNekNUs0U1hTVlJK2E1AD93AD04A03C3DF7565FA377223916FA881A19A675E9BD2F78680EE545265lESDc3MWhlY3hSQmdKSjJ2ZTcvYlBFOHhPQlV3ZHdDQ0tHcG5uOElCaDJ4K1hob29xSG85N0kvTWV3THhlQk9NL01VMFRjNDZpZEVXeUtUMXIyMlIveFpJUkk2WUdveEZaME9XWitGUi9WNTZVQW1FMG1DenhC8rWVVUYzMwRGVySHpIdURzKzFiRDl4TmM1TUp2VTBOUlJZUlAyV0ZVL2kvVk10L0NsbXNFYVZwT3NSU082dFNNa2prQ0ZsclZ4NTltbU1CVE5lR09Bck93V2J1Y3c9PQAAAQBvSGrvXPAAtLbErFH431nJyyyuZ1A5Mqnq2mmEY2NiFA1GUTjzEorVn9rWD20vTAZaR/EUbdQ1xAKLH1/WK/Ur4ct5Gpv3KwPVI1Lvn7q5BqoO5F4AYGcaUJqu8erCuGYz9XHGipAYpCUDVppRC294MsR/o6XJLNn7VTp+FHXRIVAbgWidQQHxaT3MQo/y38t7pKZvMQQ7l5DEp0foPhgW9Nm4coK4WXoT87/LkhCwMtH5NLmD80rZKy0XKX8AXEK+usf+gtv1iIY35t7wB8EbHPO+mUlBT5rAb","start_date_in_millis":1504224000000}}

将文件保存license.json
没修改前:

[root@linuxea.com-Node49 ~/elk]# curl -XGET -u elastic:linuxea 'http://10.0.1.49:9200/_license'
{
  "license" : {
    "status" : "active",
    "uid" : "427cbb8e-9d96-435f-b56d-fa2efeb438c5",
    "type" : "trial",
    "issue_date" : "2017-09-01T14:28:04.736Z",
    "issue_date_in_millis" : 1504276084736,
    "expiry_date" : "2017-10-01T14:28:04.736Z",
    "expiry_date_in_millis" : 1506868084736,
    "max_nodes" : 1000,
    "issued_to" : "linuxea-app",
    "issuer" : "elasticsearch",
    "start_date_in_millis" : -1
  }
}


输入密码进行修改:

[root@linuxea.com-Node49 ~/elk]# curl -XPUT -u elastic 'http://10.0.1.49:9200/_xpack/license' -H "Content-Type: application/json" -d @license.json
Enter host password for user 'elastic':
{"acknowledged":true,"license_status":"valid"}

修改完成后查看

[root@linuxea.com-Node49 ~/elk]# curl -XPUT -u elastic 'http://10.0.1.49:9200/_xpack/license' -H "Content-Type: application/json"curl -XGET -u elastic:linuxea 'http://10.0.1.49:9200/_license'
{
  "license" : {
    "status" : "active",
    "uid" : "d13W1FM-ef9XWi-45eAKLH6-afT5b4-b8erC7460",
    "type" : "platinum",
    "issue_date" : "2017-09-01T00:00:00.000Z",
    "issue_date_in_millis" : 11042324000000,
    "expiry_date" : "2050-05-11T01:46:39.999Z",
    "expiry_date_in_millis" : 2535123399999,
    "max_nodes" : 100,
    "issued_to" : "sean wang (alibaba)",
    "issuer" : "Web Form",
    "start_date_in_millis" : 11042324000000
  }
}
[root@linuxea.com-Node49 ~/elk]# 

5 分享

您可以选择一种方式赞助本站

支付宝扫码赞助

支付宝扫码赞助

日期: 2017-09-11分类: ELK Stack

标签: elk

发表评论

已有 3 条评论

加载中,请稍候...
  1. mongoole
    mongoole
    October 11th, 2017 at 11:16 am

    版本5.6的情况下我这边破解没成功,,,版主您试过没有
    #curl -XPUT -u elastic 'http://192.168.10.57:9200/_license' -H "Content-Type: application/json" -d @license.json
    Enter host password for user 'elastic':
    {"acknowledged":true,"license_status":"invalid"}

    1. mark
      October 11th, 2017 at 02:42 pm

      只试过5.5的

  2. w
    w
    November 5th, 2017 at 04:34 pm

    参照楼主方法,在 x-pack-5.6.3.jar 通过
    http://download.csdn.net/download/liumeiti/10104693