Artifactory JFrog Backup失败,错误代码为401

时间:2018-04-24 12:34:48

标签: artifactory jfrog-cli jfrog-mission-control

如果有人可以指导或指导我调试Artifactory的备份问题,我们将不胜感激。每当执行备份时 - artifactory.log中的/ api / v1 / system / backup / export上总会出现401错误消息 备份存在于备份位置,但日志中包含错误消息。不确定如何在日志中调试此错误和影响。我可以在堆栈中看到其余的调用失败,尝试设置密码到不支持和其他多个事情,但错误仍然存​​在。还检查了Artifactory上的Jira无济于事。任何指针都将非常感激

更多详情

import cv2
...
cv2.imwrite(pic_name,item)

备份失败,并按照日志中的信息进行操作。

artifactory.version=5.9.3 artifactory.timestamp=1521564024289 artifactory.revision=50903900 artifactory.buildNumber=820 以下是artifactory.log中显示的完整堆栈

2018-04-24 11:59:24,620 [ajp-apr-8009-exec-9] [ERROR] (o.a.s.a.AccessServiceImpl:1070) - Error during access server backup org.jfrog.access.client.AccessClientHttpException: HTTP response status 401:Failed on executing /api/v1/system/backup/export, with response: {"errors":[{"code":"UNAUTHORIZED","detail":"Bad credentials","message":"HTTP 401 Unauthorized"}]} at org.jfrog.access.client.http.AccessHttpClient.createRestResponse(AccessHttpClient.java:154) at org.jfrog.access.client.http.AccessHttpClient.restCall(AccessHttpClient.java:113) ...

3 个答案:

答案 0 :(得分:4)

感谢您的反馈。 我怀疑行为的原因是,对于更常见的操作,Artifactory使用Config Descriptor中的<adminToken>,但是其他一些操作使用$ARTIFACTORY_HOME/etc/security/access/access.creds中保存的凭据。

这些似乎很糟糕。

要重新启动这些,您应该:

  1. 创建以下文件:$ARTIFACTORY_HOME/access/etc/bootstrap.creds
  2. 文件内容应为:access-admin@*=password
  3. 文件的权限必须为 600
  4. 一旦该文件到位,重新启动Artifactory。

答案 1 :(得分:1)

从Artifactory版本5.4开始,Artifactory中有一个名为“Access”的单独服务,它管理权限和安全相关的配置。

使用在“Config Descriptor”中配置的访问令牌,Artifactory使用Access进行身份验证。

这个问题可能会通过简单的重启来解决,所以这就是我的开始。 如果这不起作用,或者我怀疑会发生Artifactory将无法启动,请做(当Artifactory关闭时):

  1. <adminToken>
  2. 中删除$ARTIFACTORY_HOME/etc/artifactory.config.latest.xml标记
  3. $ cp artifactory.config.latest.xml artifactory.config.import.xml
  4. 重新启动Artifactory。

答案 2 :(得分:0)

添加了bootstrap.creds

tomcat@XXXXXXXX:/home/bitnami/apps/artifactory/artifactory_home/etc$ ls -ltrh
   total 136K
  -rw-r--r-- 1 tomcat tomcat 5.5K Mar 20 16:41 mimetypes.xml
  -rw-r--r-- 1 tomcat tomcat  12K Mar 20 16:41 logback.xml
  -rw-r--r-- 1 tomcat tomcat  13K Mar 20 16:41 artifactory.system.properties
  -rw-r--r-- 1 tomcat tomcat  11K Mar 20 16:41 artifactory.config.bootstrap.xml
  -rw-rw-r-- 1 tomcat tomcat  145 Mar 21 13:36 db.properties
  drwxrwxr-x 2 tomcat tomcat 4.0K Mar 21 13:37 ui
  drwxrwxr-x 2 tomcat tomcat 4.0K Mar 21 13:37 plugins
  drwx------ 3 tomcat tomcat 4.0K Mar 21 13:37 security
  -rw-rw-r-- 1 tomcat tomcat  13K Mar 21 13:37 
   artifactory.config.latest.1521639475000.xml
  -rw-r--r-- 1 tomcat tomcat  199 Apr 24 18:50 binarystore.xml
  -rw-rw-r-- 1 tomcat tomcat  13K Apr 24 18:57 artifactory.config.latest.xml_bkp
  -rw-rw-r-- 1 tomcat tomcat  12K Apr 24 18:58 
   artifactory.config.latest.1524596291000.xml
  -rw-rw-r-- 1 tomcat tomcat  14K Apr 25 14:39 artifactory.config.latest.xml
  -rw------- 1 tomcat tomcat   24 Apr 25 15:09 bootstrap.creds
  -rw-rw-r-- 1 tomcat tomcat  864 Apr 25 15:12 artifactory.properties

bootstrap.creds的内容是 access-admin@*=password 并重新启动了arttifactory但仍然看到相同的错误消息

2018-04-25 15:14:29,607 [art-exec-1] [ERROR] (o.a.s.a.AccessServiceImpl:1070) - Error during access server backup: HTTP response status 401:Failed on executing /api/v1/system/backup/export, with response: {"errors":[{"code":"UNAUTHORIZED","detail":"Bad credentials","message":"HTTP 401 Unauthorized"}]}

我尝试使用access-admin以及来自gui的用户进行备份时出现相同的错误(两者都是管理员用户)。

当重新启动工件时,来自访问日志

2018-04-25 15:10:54,396 [localhost-startStop-1] [INFO ] (o.j.a.c.AccessApplicationContextInitializer:46) - Using JFrog Access home at '/opt/bitnami/apps/artifactory/artifactory_home/access' 2018-04-25 15:10:54,413 [localhost-startStop-1] [INFO ] (o.j.a.AccessApplication:48) - Starting AccessApplication v3.2.2 on ip-10-51-35-238 with PID 16169 (/opt/bitnami/apache-tomcat/webapps/access/WEB-INF/lib/access-application-3.2.2.jar started by tomcat in /opt/bitnami/apache-tomcat/bin) 2018-04-25 15:10:54,414 [localhost-startStop-1] [INFO ] (o.j.a.AccessApplication:597) - The following profiles are active: production,grpc 2018-04-25 15:11:11,402 [localhost-startStop-1] [INFO ] (o.j.a.s.d.u.AccessJdbcHelperImpl:129) - Database: Apache Derby 10.11.1.1 - (1616546). Driver: Apache Derby Embedded JDBC Driver 10.11.1.1 - (1616546) 2018-04-25 15:11:11,410 [localhost-startStop-1] [INFO ] (o.j.a.s.d.u.AccessJdbcHelperImpl:132) - Connection URL: jdbc:derby:/opt/bitnami/apps/artifactory/artifactory_home/data/derby 2018-04-25 15:11:16,127 [localhost-startStop-1] [INFO ] (o.j.a.s.s.c.InternalConfigurationServiceImpl:94) - Loading configuration from db finished successfully 2018-04-25 15:11:18,035 [localhost-startStop-1] [INFO ] (o.j.a.s.s.AccessStartupServiceImpl:79) - Found master.key file at /opt/bitnami/apps/artifactory/artifactory_home/etc/security/master.key, using it as master.key 2018-04-25 15:11:19,486 [localhost-startStop-1] [INFO ] (o.j.a.s.s.t.TokenServiceImpl:100) - Scheduling task for revoking expired tokens using cron expression: 0 0 0/1 * * ? 2018-04-25 15:11:19,651 [localhost-startStop-1] [INFO ] (o.j.a.s.r.c.RpcServiceInvoker:86) - Added service: sync 2018-04-25 15:11:20,764 [localhost-startStop-1] [INFO ] (o.j.a.s.AccessServerBootstrapImpl:93) - [ACCESS BOOTSTRAP] Starting JFrog Access bootstrap... 2018-04-25 15:11:23,381 [localhost-startStop-1] [INFO ] (o.j.a.s.AccessServerBootstrapImpl:146) - [ACCESS BOOTSTRAP] Updating server '509b68e8-48e5-4bba-8ea7-6564c65d5b37' private key finger print to: 63c2f42824ead3169fc13eab66d3d254d25c659ceef5cdeed21c3110f47ee0d3 2018-04-25 15:11:24,164 [localhost-startStop-1] [INFO ] (o.j.a.s.AccessServerBootstrapImpl:108) - [ACCESS BOOTSTRAP] JFrog Access bootstrap finished. 2018-04-25 15:11:30,624 [localhost-startStop-1] [INFO ] (o.j.a.s.s.s.RefreshableScheduledJob:56) - Scheduling heartbeat task to run every 5 seconds 2018-04-25 15:11:43,339 [localhost-startStop-1] [INFO ] (o.j.a.AccessApplication:57) - Started AccessApplication in 53.93 seconds (JVM running for 93.388) 2018-04-25 15:11:47,756 [localhost-startStop-1] [WARN ] (o.a.t.u.s.StandardJarScanner:311) - Failed to scan [file:/opt/bitnami/apache-tomcat/lib/derbyLocale_cs.jar] from classloader hierarchy enter code here

另外我在日志上启用了跟踪。以下是我在

中看到的内容

/home/bitnami/apps/artifactory/artifactory_home/access/logs/request.log。似乎备份呼叫被标记为来自匿名vs | jfrt @ 01c94cf2cpdmx60xvtsf8j1jy4用于其他呼叫。

2018-04-25T15:49:03.906+0000|127.0.0.1|jfrt@01c94cf2cpdmx60xvtsf8j1jy4|GET|http://127.0.0.1/access/api/v1/groups/|200|0|198|JFrog Access Java Client/3.2.2
2018-04-25T15:50:17.553+0000|127.0.0.1|anonymous|POST|http://127.0.0.1/access/api/v1/system/backup/export|401|0|188|JFrog Access Java Client/3.2.2
2018-04-25T15:50:18.657+0000|127.0.0.1|jfrt@01c94cf2cpdmx60xvtsf8j1jy4|GET|http://127.0.0.1/access/api/v1/users/|200|0|84|JFrog Access Java Client/3.2.2
2018-04-25T15:50:18.733+0000|127.0.0.1|jfrt@01c94cf2cpdmx60xvtsf8j1jy4|GET|http://127.0.0.1/access/api/v1/groups/|200|0|73|JFrog Access Java Client/3.2.2
2018-04-25T15:50:42.823+0000|127.0.0.1|anonymous|POST|http://127.0.0.1/access/api/v1/system/backup/export|401|0|134|JFrog Access Java Client/3.2.2
2018-04-25T15:50:42.995+0000|127.0.0.1|jfrt@01c94cf2cpdmx60xvtsf8j1jy4|GET|http://127.0.0.1/access/api/v1/users/|200|0|114|JFrog Access Java Client/3.2.2
2018-04-25T15:50:43.086+0000|127.0.0.1|jfrt@01c94cf2cpdmx60xvtsf8j1jy4|GET|http://127.0.0.1/access/api/v1/groups/|200|0|64|JFrog Access Java Client/3.2.2

如果我能提供其他相关信息,请告知我们,以便我们更深入地了解我的资料。再次感谢您的帮助