ARTIFACTORY: How can I extract the expiration date in license key

David Shin
2022-05-22 11:18

Affected Versions

Artifactory 7.x
 

Descrtiption

Sometime, after adding a new Artifactory licese key for the replacement of the old license, you may see the "Your Artifactory license has expired" 
It is because Artifactory has the expired license key still in artifactory.lic or artifactory.cluster.license file
You may confused how you can know which one is valid or expired one.
 

Resolution

Aritfactory license key is encrypted by Base64.
You can use base64 –decode basically.  You may use the following command to see the expiration date for each license key.
echo "license_strings_xxx" | base64 -d | grep license | cut -d: -f2 | base64 -d | grep product | cut -d: -f2 | while read -r line; do echo $line | base64 -d; done | grep expires

For HA node, of course, you can delete the expired license through UI or You can use the following REST APIs

To see the license information in HA mde,curl -u admin localhost:8081/artifactory/api/system/licenses
{
  {
    "type" : "Enterprise Plus",
    "validThrough" : "Jun 7, 2022",
    "licensedTo" : "XXXXXX",
    "licenseHash" : "a86e7880c1b3xxxxxxxxxxxxxcec4",
    "nodeId" : "Not in use",
    "nodeUrl" : "Not in use",
    "expired" : true
  }, {
    "type" : "Enterprise Plus",
    "validThrough" : "Sep 5, 2022",
    "licensedTo" : "JFrog TEST",
    "licenseHash" : "3ae60bd20dd5cxxxxxxxxxxxxxxxxe4",
    "nodeId" : "art1",
    "nodeUrl" : "172.100.11.4:8082/artifactory",
    "expired" : false
  }
   ....
}

To delete the expired license with licenseHash;curl -u admin -XDELETE localhost:8081/artifactory/api/system/licenses?licenseHash=a86e7880c1b3xxxxxxxxxxxxxcec4