elasticsearch x-pack 5x,6x 授权永久破解

该教程适用于 5.x 6.x 版本


Elasticsearch version: 5.5.1


1、确定好 elasticsearch 安装位置

# 这是我的安装位置
/usr/share/elasticsearch

2、解压 x-pack-5.5.1.jar

# 备份文件
cp /usr/share/elasticsearch/plugins/x-pack/x-pack-5.5.1.jar ~/x-pack-5.5.1.jar.bak
# 复制文件
cp /usr/share/elasticsearch/plugins/x-pack/x-pack-5.5.1.jar ~/.
jar -xvf x-pack-5.5.1.jar

3、创建 `LicenseVerifier.java`

echo "
package org.elasticsearch.license;

public class LicenseVerifier
{
    public static boolean verifyLicense(final License license, final byte[] encryptedPublicKeyData) {
        return true;
    }

    public static boolean verifyLicense(final License license) {
        return true;
    }
}
" > LicenseVerifier.java

4、将 .java 文件编译成 .class 文件,注意文件名和路径变化

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

5、然后覆盖到更改解压的 x-pack-5.5.1.jar 后的目录下, 具体覆盖路径

mv LicenseVerifier.class ~/x-pack/org/elasticsearch/license/.

6、重新打包成 jar 包

jar -cvf x-pack-5.5.1.jar ./x-pack/*

7、覆盖原来x-pack的jar包

mv x-pack-5.5.1.jar /usr/share/elasticsearch/plugins/x-pack

8、重启 elasticsearch


9、创建 license.json 文件,内容如下

{"license":{"uid":"171e95c8-4bba-496b-96b9-a8e079c83925","type":"platinum","issue_date_in_millis":1530057600000,"expiry_date_in_millis":2524579200999,"max_nodes":100,"issued_to":"杨 圆建 (zentrust)","issuer":"Web Form","signature":"AAAAAwAAAA17DTj3Rb3cxoE0VNIHAAABmC9ZN0hjZDBGYnVyRXpCOW5Bb3FjZDAxOWpSbTVoMVZwUzRxVk1PSmkxaktJRVl5MUYvUWh3bHZVUTllbXNPbzBUemtnbWpBbmlWRmRZb25KNFlBR2x0TXc2K2p1Y1VtMG1UQU9TRGZVSGRwaEJGUjE3bXd3LzRqZ05iLzRteWFNekdxRGpIYlFwYkJiNUs0U1hTVlJKNVlXekMrSlVUdFIvV0FNeWdOYnlESDc3MWhlY3hSQmdKSjJ2ZTcvYlBFOHhPQlV3ZHdDQ0tHcG5uOElCaDJ4K1hob29xSG85N0kvTWV3THhlQk9NL01VMFRjNDZpZEVXeUtUMXIyMlIveFpJUkk2WUdveEZaME9XWitGUi9WNTZVQW1FMG1DenhZU0ZmeXlZakVEMjZFT2NvOWxpZGlqVmlHNC8rWVVUYzMwRGVySHpIdURzKzFiRDl4TmM1TUp2VTBOUlJZUlAyV0ZVL2kvVk10L0NsbXNFYVZwT3NSU082dFNNa2prQ0ZsclZ4NTltbU1CVE5lR09Bck93V2J1Y3c9PQAAAQC4ZJhCl93iw2GjQmjF/c5XB6Xc+pgkf5MmnBPCsEfjbVd2AAKbylTDsEcdcv6RauMFGPO+ciAFedFklesyYfxTg+lAv/XmpssdV4vOdvTYR/c4+pdyvzyXuwRqcZ4lmFhdZh1DBvTtMB+ndH9B3iJPjVtbg5jwUjyO6PNfCL5Gsmi2NxzmoW6iSVSiUTQlaysS/qyS0lzL+59Yptuwdv8XG7e6KSUY7Ef6zC4ygL7i5zXAEjLYz1gKtGs5FVC6q4ejG1yrRZi0+BG7JvECdqHICSthr2qnHElPnyk34yKPZeeOYaHzrvOq+DYtNSCx9IwubR4c+xuxBOy4g8xTetAv","start_date_in_millis":1530057600000}}

10、更新License文件

5.x 直接执行 curl 即可

curl -XPUT -u elastic:changeme "http://192.168.0.166:9200/_xpack/license?acknowledge=true" -d @license.json

6.x 更新之前先配置elasticsearch.yml,加入:

xpack.security.enabled: false

执行

curl -XPUT -u elastic:changeme "http://192.168.0.166:9200/_xpack/license?acknowledge=true" -d @license.json

生效之后,再开启security,并开启SSL\TLS:

xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true

11、重启 elasticsearch。


12、查看License状态:

curl -XGET -u elastic:changeme "http://192.168.0.166:9200/_license"

编辑于 2018-06-27