返回

Elasticsearch 7.x破解

破解脚本

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash

ES_HOME='/usr/share/elasticsearch'
JAVAC="${ES_HOME}/jdk/bin/javac"
JAR="${ES_HOME}/jdk/bin/jar"

[ ! -d "${ES_HOME}" ] && echo "directory ${ES_HOME} does not exist!" > /dev/stderr && exit

lib_dir="${ES_HOME}/lib"

elasticsearch_jar_name=$(/bin/ls ${lib_dir} | grep -E '^elasticsearch-[0-9]\.[0-9]{1,2}\.[0-9]{1,2}\.jar$')
[ $? -ne 0 ] && echo "could not found elasticsearch-x.x.x.jar in ${lib_dir}" && exit 1

lucene_core_jar_name=$(/bin/ls ${lib_dir} | grep -E '^lucene-core-[0-9]\.[0-9]{1,2}\.[0-9]{1,2}\.jar$')
[ $? -ne 0 ] && echo "could not found lucene-core-x.x.x.jar in ${lib_dir}" && exit 1

xpack_jar_base_dir="${ES_HOME}/modules/x-pack-core"
xpack_jar_name=$(/bin/ls ${xpack_jar_base_dir} | grep -E '^x-pack-core-[0-9]\.[0-9]{1,2}\.[0-9]{1,2}\.jar$')
[ $? -ne 0 ] && echo "could not found x-pack-core-x.x.x.jar in ${xpack_jar_base_dir}" && exit 1

base_dir=$(mktemp -d --tmpdir $(basename $0).XXXXXXXX)
cd ${base_dir}

source_java_prefix='LicenseVerifier'
cat > ${source_java_prefix}.java << EOF_License
package org.elasticsearch.license;

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

    public static boolean verifyLicense(final License license) {
        return true;
    }
}
EOF_License

$JAVAC -cp ${lib_dir}/${elasticsearch_jar_name}:${lib_dir}/${lucene_core_jar_name}:${xpack_jar_base_dir}/${xpack_jar_name} ${source_java_prefix}.java
mkdir xpack
cd xpack
$JAR -xf ${xpack_jar_base_dir}/${xpack_jar_name}
/bin/cp ../${source_java_prefix}.class org/elasticsearch/license/
$JAR -cf /tmp/${xpack_jar_name}.crack *
cat > /tmp/xpack_license.json << EOF_xpack_json
{
    "license": {
        "uid": "96c22980-b1a3-4dd8-ac16-4bade3be3724",
        "type": "platinum",
        "issue_date_in_millis": 946684800000,
        "expiry_date_in_millis": 2524608000000,
        "max_nodes": 1000,
        "issued_to": "Elasticsearch",
        "issuer": "Web Form",
        "signature": "AAAAAwAAAA2i/cSCqia/z1FVlHHkAAABmC9ZN0hjZDBGYnVyRXpCOW5Bb3FjZDAxOWpSbTVoMVZwUzRxVk1PSmkxaktJRVl5MUYvUWh3bHZVUTllbXNPbzBUemtnbWpBbmlWRmRZb25KNFlBR2x0TXc2K2p1Y1VtMG1UQU9TRGZVSGRwaEJGUjE3bXd3LzRqZ05iLzRteWFNekdxRGpIYlFwYkJiNUs0U1hTVlJKNVlXekMrSlVUdFIvV0FNeWdOYnlESDc3MWhlY3hSQmdKSjJ2ZTcvYlBFOHhPQlV3ZHdDQ0tHcG5uOElCaDJ4K1hob29xSG85N0kvTWV3THhlQk9NL01VMFRjNDZpZEVXeUtUMXIyMlIveFpJUkk2WUdveEZaME9XWitGUi9WNTZVQW1FMG1DenhZU0ZmeXlZakVEMjZFT2NvOWxpZGlqVmlHNC8rWVVUYzMwRGVySHpIdURzKzFiRDl4TmM1TUp2VTBOUlJZUlAyV0ZVL2kvVk10L0NsbXNFYVZwT3NSU082dFNNa2prQ0ZsclZ4NTltbU1CVE5lR09Bck93V2J1Y3c9PQAAAQAIK7ob185xrP6wbrBMIwrBSuMPZjRhEr+9sPssn/oGV86GfAKwJ97QvEjW049gjVnJjoorbFZGM2yOcFrCUvyQUYVwBJSz5SVlmdl4K8DgmXKev07n4+zjhtvr41L41ENUiMpRocq2Cw8uKRTrDAo4Q4auKrdiqZe++//3Yn29/IhG5WB4rnHtFmUM32YlnlFI8IrYav5nwyQO0UF2qO1Y6slZN2l71A8pP+pCg4QebkKH899LI3mT212ZO0ro1n1mgK40n07gNTqVP7TIcWUWMjvTSlXRB+n3c9Ss0lLpdRRjg94b/r5++nK13rsNxqX4nQOTtr/9DP5E8JZgPtsf",
        "start_date_in_millis": 946656000000
    }
}
EOF_xpack_json

cat << EOF
*********************************************************************************************
xpack crack file: /tmp/${xpack_jar_name}.crack     md5:$(md5sum /tmp/${xpack_jar_name}.crack | awk '{print $1}')
license file: /tmp/xpack_license.json        md5:$(md5sum /tmp/xpack_license.json | awk '{print $1}')
crack command:
sudo cp /tmp/${xpack_jar_name}.crack ${ES_HOME}/modules/x-pack-core/${xpack_jar_name}
*********************************************************************************************
EOF

/bin/rm -rf ${base_dir}

把生成的破解文件复制覆盖掉原文件:sudo cp /tmp/x-pack-core-x.x.x.jar.crack /usr/share/elasticsearch/modules/x-pack-core/x-pack-core-x.x.x.jar

更新Elasticsearch许可证:curl -XPUT -u elastic http://127.0.0.1:9200/_xpack/license -H "Content-Type: application/json" -d @/tmp/xpack_license.json

启用密码验证功能

设置密码

1
2
3
4
#自动生成密码
sudo /usr/share/elasticsearch/bin/elasticsearch-setup-passwords auto
#手动设置密码
sudo /usr/share/elasticsearch/bin/elasticsearch-setup-passwords interactive

配置Kibana密码

1
2
3
4
5
vim /etc/kibana/kibana.yml

#搜索取消注释并配置下面两行配置
elasticsearch.username: "kibana_system"
elasticsearch.password: "passowrd"
Built with Hugo
Theme Stack designed by Jimmy