Hello, Everybody
I have an instance of NXRM OSS version 3.28.1-01 for which I want to set ‘read-only’ status for the purpose of blob storage back-up. I can set this through NXRM web interface (/#admin/system/api) but I would like to do this from command shell. When I try to call API with curl command the following results produced:
- Call without user/password:
console output
sudo curl -w "\n%{http_code}\n" -o nxrm-freeze.resp --dump-header nxrm.hdr -X POST http://nsatlnx01:8381/nx3/service/rest/v1/read-only/freeze" -H "accept: application/json"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
403
response headers
HTTP/1.1 403 Forbidden
Date: Wed, 11 Aug 2021 10:04:24 GMT
Server: Nexus/3.28.1-01 (OSS)
X-Content-Type-Options: nosniff
X-Siesta-FaultId: bd35ef94-bb71-4e42-b971-846ce63451e1
Content-Length: 0
NXRM log
2021-08-11 13:04:24,094+0300 WARN [qtp24045129-179] *UNKNOWN org.sonatype.nexus.siesta.internal.AuthorizationExceptionMapper - (ID bd35ef94-bb71-4e42-b971-846ce63451e1) Response: [403] (no entity/body); mapped from: org.apache.shiro.authz.AuthorizationException: User is not permitted: nexus:*
- Call with user/password
console output
sudo curl -u "ns.admin:\***********" -w "\n%{http_code}\n" -o nxrm-freeze.resp --dump-header nxrm.hdr -X POST "http://nsatlnx01:8381/nx3/service/rest/v1/read-only/freeze" -H "accept: application/json"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
401
response headers
HTTP/1.1 401 Unauthorized
Date: Wed, 11 Aug 2021 10:10:11 GMT
Server: Nexus/3.28.1-01 (OSS)
X-Content-Type-Options: nosniff
WWW-Authenticate: BASIC realm="Sonatype Nexus Repository Manager"
Content-Length: 0
NXRM log does not record this attempt, NXRM request log has
192.168.1.204 - - [11/Aug/2021:13:15:49 +0300] "POST /nx3/service/rest/v1/read-only/freeze HTTP/1.1" 401 - 0 100 "curl/7.64.0" [qtp24045129-179]
I will be very grateful for explanation were I’m wrong and any help pointing me to correct solution.
With best regards,
Nick Sorokin