ARTIFACTORY:我如何提取许可证密钥中的过期日期

大卫胫骨
2023-01-22 11:06

影响版本

Artifactory 7.倍

Descrtiption

有时,在添加新的Artifactory许可证密钥以替换旧许可证之后,您可能会看到“您的Artifactory许可证已过期”。
这是因为Artifactory中还有过期的许可证密钥。Lic或artifactory.cluster.license文件
您可能会困惑如何知道哪个是有效的或过期的。

决议

工厂许可证密钥采用Base64加密。
基本上可以使用base64解码。您可以使用以下命令查看每个许可密钥的到期日期。
Echo "license_strings_xxx" | base64 -d | grep license | cut -d: -f2 | base64 -d | grep product | cut -d: -f2 | while read -r line;执行echo $line | base64 -d;完成| grep过期

当然,对于HA节点,您可以通过UI删除过期的license,也可以使用以下REST接口

查看HA模式下的license信息。Curl -u admin localhost:8081/artifactory/api/system/licenses
{
{
“类型”:“企业+”;
validThrough:“2022年6月7日”,
“licensedTo”:“XXXXXX”,
“licenseHash”:“a86e7880c1b3xxxxxxxxxxxxxcec4”,
"nodeId":未使用,
"nodeUrl": "未使用",
expired: true
}, {
“类型”:“企业+”;
validThrough:“2022年9月5日”,
"licensedTo": "JFrog TEST";
“licenseHash”:“3ae60bd20dd5cxxxxxxxxxxxxxxxxxxxxe4”,
nodeId: art1;
nodeUrl: 172.100.11.4:8082/artifactory,
expired: false

….

使用licenseHash命令删除过期的license;curl -u admin -XDELETE localhost:8081/artifactory/api/system/licenses?licenseHash = a86e7880c1b3xxxxxxxxxxxxxcec4