标签:boolean license pku import cow sbt security nod llb
破解x-pack
-----------
1. 编辑文件: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;
}
}
2. 编译生成class文件
javac -cp "/data/elk/elasticsearch/lib/elasticsearch-5.5.0.jar:/data/elk/elasticsearch/lib/lucene-core-6.6.0.jar:/data/elk/elasticsearch/plugins/x-pack/x-pack-5.5.0.jar" LicenseVerifier.java
3. 替换x-pack中的LicenseVerifier.class
cd /data/elk/elasticsearch/plugins/x-pack/
mkdir test
cp x-pack-5.5.0.jar test/
cd test/
jar xvf x-pack-5.5.0.jar
rm -rf x-pack-5.5.0.jar
cd org/elasticsearch/license/
rm -rf LicenseVerifier.class
cp /root/LicenseVerifier.class .
cd /data/elk/elasticsearch/plugins/x-pack/test/
jar cvf x-pack-5.5.0.jar .
cp x-pack-5.5.0.jar ../
cd ../; rm -rf test
3. 申请证书
https://license.elastic.co/registration
注册即可获得试用证书
4. 修改证书
{"license":{"uid":"58bf0ac1-1f4d-4e61-b8bd-bc3390332203","type":"platinum","issue_date_in_millis":1502150400000,"expiry_date_in_millis":9532563199999,"max_nodes":100,"issued_to":"jonjon zhao (lshen)","issuer":"Web Form","signature":"AAAAAwAAAA0hwabZEs6XiKMLRH5PAAABmC9ZN0hjZDBGYnVyRXpCOW5Bb3FjZDAxOWpSbTVoMVZwUzRxVk1PSmkxaktJRVl5MUYvUWh3bHZVUTllbXNPbzBUemtnbWpBbmlWRmRZb25KNFlBR2x0TXc2K2p1Y1VtMG1UQU9TRGZVSGRwaEJGUjE3bXd3LzRqZ05iLzRteWFNekdxRGpIYlFwYkJiNUs0U1hTVlJKNVlXekMrSlVUdFIvV0FNeWdOYnlESDc3MWhlY3hSQmdKSjJ2ZTcvYlBFOHhPQlV3ZHdDQ0tHcG5uOElCaDJ4K1hob29xSG85N0kvTWV3THhlQk9NL01VMFRjNDZpZEVXeUtUMXIyMlIveFpJUkk2WUdveEZaME9XWitGUi9WNTZVQW1FMG1DenhZU0ZmeXlZakVEMjZFT2NvOWxpZGlqVmlHNC8rWVVUYzMwRGVySHpIdURzKzFiRDl4TmM1TUp2VTBOUlJZUlAyV0ZVL2kvVk10L0NsbXNFYVZwT3NSU082dFNNa2prQ0ZsclZ4NTltbU1CVE5lR09Bck93V2J1Y3c9PQAAAQAkeIT4OVVhwnz0s5FiO73LzATuFZfGHao9WH/xlAowalMBI6RcJcNezP8Vv0PSTfBWxaGRbC3nv9yd1GLao6Z1/jZLwiZ+fqJ+WnYMBQId498Y52EDW1hFhLgrrMwRzy5r8JNWVrgkidiSW6MtZmO4D7ZcFBX3SG8qYP/iFclTv7UO8YCBVaF6X0R7O3+e41DMNZNQP+dymailHNoyyLr7uTOIT4tMNqC5RsRAgKtRWxpM9xmO6IM9eXyo1drw79gEd2bGe+lQrWzgYsFX0SDYpKuq9Tmt2+QP4GTU7RfF26Tnc4vpSrta7nXahsV9MD7kLV6pKrWTbmZE52dhD9Ai","start_date_in_millis":1502150400000}}
注明:主要是两个地方,一个是type,修改为platinum版本,一个是expiry_date_in_millis时间。
5. 导入证书
注:在导入证书之前,必须先重启elasticsearch,不然会报证书invalid
curl -XPUT -u elastic:Lishen12345 ‘http://127.0.0.1:9200/_xpack/license?acknowledge=true‘ -H "Content-Type: application/json" -d @jonjon-zhao-58bf0ac1-1f4d-4e61-b8bd-bc3390332203-v5.json
查看证书: curl -XGET -u elastic:Lishen12345 ‘http://127.0.0.1:9200/_xpack/license‘
{
"license" : {
"status" : "active",
"uid" : "58bf0ac1-1f4d-4e61-b8bd-bc3390332203",
"type" : "platinum",
"issue_date" : "2017-08-08T00:00:00.000Z",
"issue_date_in_millis" : 1502150400000,
"expiry_date" : "2272-01-28T14:13:19.999Z",
"expiry_date_in_millis" : 9532563199999,
"max_nodes" : 100,
"issued_to" : "jonjon zhao (lshen)",
"issuer" : "Web Form",
"start_date_in_millis" : 1502150400000
}
}
6. 刷新kibana,到monitor里面查看证书是否更新成功。
标签:boolean license pku import cow sbt security nod llb
原文地址:http://www.cnblogs.com/zhaojonjon/p/7307755.html