devopshq/artifactory-cleanup

on prime - auth issue " 401 Client Error "

xsalahdinX opened this issue · 3 comments

hello guys

i am really so impressed with this work a huge effort and great support for artifactory , we are hosting a jfrog in our server https://artifactory.XXX.com:443/artifactory , when i tried to use the docker version of it

command
docker run --rm -v "$(pwd)":/app -e ARTIFACTORY_USERNAME -e ARTIFACTORY_PASSWORD devopshq/artifactory-cleanup artifactory-cleanup --config artifactory-cleanup.yaml

after exporting

export ARTIFACTORY_USERNAME=XXXXX@XXXX.com  (my mail)
export ARTIFACTORY_PASSWORD=(Token) --as we use dont use password we only have that admin Token 

i always got this


WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Command to execute: artifactory-cleanup --config artifactory-cleanup.yaml
The " docker-local "repository does not exist!********************************************************************************
Verbose MODE
Checking 'docker-local' repository exists.
401 Client Error:  for url: https://artifactory-pp.XXX.com:443/artifactory/api/storage/docker-local

i tried hundreds of times by replacing tokens or using reference token but only got Error 401 or 403

what can I do ? i tried it with a private cloud jfrog subscription https://XXXX.jfrog.io/ and it worked

is it only supports the cloud version ?

thanks in advance <3

is it only supports the cloud version ?

It's not, should work fine on on-premise instances too

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

It means that you're running the command on ARM CPU. You should try using linux based x86 CPU for the image, or you can build your own image with the Dockerfile https://github.com/devopshq/artifactory-cleanup/tree/master/docker

i finally addressed the problem , it was the option "internal_password_disabled" : false, it has to be "true"

when

curl -H 'Authorization: Bearer TOKEN' https://artifactory.XXXXXXX.com/access/api/v2/users/XXXX@XXX.com -k
it will return


{
  "username" : "XXXX@XXXXXX.com",
  "email" : "XXXXX@XXXXXX.com",
  "admin" : true,
  "profile_updatable" : true,
  "disable_ui_access" : false,
  **"internal_password_disabled" : false,** ---- here is the problem 
  "last_logged_in" : "2023-10-23T15:42:09.844+02:00",
  "realm" : "XXXX",
  "groups" : [ "XXXXXXXX" ],
  "status" : "enabled"

when i went to the jfrog portal into my user setting and made it true everything authenticated fine

@xsalahdinX thank you for sharing the solution!