ARTIFACTORY: How to restore your remote repository password?

ARTIFACTORY: How to restore your remote repository password?

AuthorFullName__c
Roi Niv
articleNumber
000005356
ft:sourceType
Salesforce
FirstPublishedDate
2022-08-03T11:18:48Z
lastModifiedDate
2022-08-03
VersionNumber
3

All your remote repositories passwords can be found inside the artifactory.config.latest.xml file (under $JFROG_HOME/artifactory/var/etc/artifactory/artifactory.config.latest.xml).
 
The passwords are encrypted inside the artifactory.config.latest.xml file, and we need to be able to decode them so we can find the relevant password.
 
This can be achieved by using the Deactivate Artifactory Key Encryption REST API , once the REST API is executed, all the passwords in the artifactory.config.latest.xml file will be displayed as plain text. 
For example :

<remoteRepository>
   <key>my-remote-repository</key>
   <type>generic</type>
....
   <username>USER</username>
   <password>PLAIN_TEXT_PASSWORD</password>
....
 </remoteRepository>

The command should look like this:
curl -u<username>:<password> -XPOST $JFROG_URL/artifactory/api/system/decrypt

Note that a valid admin user is required to run the REST API.

To encrypt the passwords again, run the Activate Artifactory Key Encryption REST API.

For example:
curl -u<username>:<password> -XPOST $JFROG_URL/artifactory/api/system/encrypt