非JAVA开发者 - JAVA

3.ELK - x-pack-6.2.4安装+破解

2018-05-16  本文已影响21人  风云雄霸天下123456

参考:

  1. Elasticsearch6.2.2 X-pack破解及安装教程
  2. X-pack-6.2.4破解

前置说明:

本人立场:不支持大家破解,只供大家学习使用。支持大家去购买正版,正版的License链接:https://www.elastic.co/subscriptions


说明:


步骤:

1. 破解x-pack

  1. 解压原版x-pack
    unzip /data/soft/ceshi/x-pack-6.2.4.zip

  2. 找到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

  3. 修改关键代码:(使用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);
          }
      }
      
  4. 重新打包成x-pack-core-6.2.4.jar

2. 安装x-pack

  1. elasticsearch安装x-pack
    /data/soft/elasticsearch-6.2.4/bin/elasticsearch-plugin install file:///data/soft/ceshi/x-pack-6.2.4_pojie.zip
    
  2. 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
    
  3. 重置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
  4. elasticsearch.yml修改不开启x-pack安全认证(为了修改License需要,后面会改回来)
    配置文件: /data/soft/elasticsearch-6.2.4/config/elasticsearch.yml
    xpack.security.enabled: false
    
  5. kibana.yml添加elasticsearch x-pack密码配置
    elasticsearch.username: "elastic"
    elasticsearch.password: "password"
    
  6. 开启elasticsearch, kibana
    • 开启elasticsearch
      /data/soft/elasticsearch-6.2.4/bin/elasticsearch
    • 开启kibana
      /data/soft/kibana-6.2.4-linux-x86_64/bin/kibana

3. 安装License

  1. license:
    内容:参考“说明”里的
    文件:将内容保存到本地文件,比如:/Users/nishi/Downloads/license.json
  2. 访问kibana
    http://kibana.dev
  3. 修改License
    • Management -> License Management -> Install it now(Have a newer license? Splendid! Install it now)
    • 上传license.json
  4. 开启x-pack安全认证
    配置文件: /data/soft/elasticsearch-6.2.4/config/elasticsearch.yml
    # xpack安全验证是否开启
    xpack.security.enabled: true
    xpack.security.transport.ssl.enabled: true
    

4. 至此配置完成,请支持正版购买哦!

上一篇 下一篇

猜你喜欢

热点阅读