You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by "Deepak Sharma (Jira)" <ji...@apache.org> on 2020/08/24 08:33:00 UTC

[jira] [Created] (RANGER-2964) creating policy with passing serviceType as id is failing

Deepak Sharma created RANGER-2964:
-------------------------------------

             Summary: creating policy with passing serviceType as id is failing
                 Key: RANGER-2964
                 URL: https://issues.apache.org/jira/browse/RANGER-2964
             Project: Ranger
          Issue Type: Bug
          Components: Ranger
    Affects Versions: ranger-2.0
            Reporter: Deepak Sharma


we are creating ranger policies with "serviceType": "3", but it is failing due to following error:

curl -i  -k  -u admin:admin123 -H "Accept: application/json" -H "Content-Type: multipart/form-data" -X POST -F 'file=@test.json' "https://<ranger_host>:6182/service/plugins/policies/importPoliciesFromFile?isOverride=true&serviceType=hive"
{code}
HTTP/1.1 100 Continue


HTTP/1.1 400 Bad Request
Set-Cookie: RANGERADMINSESSIONID=777A04534D04521931753508FB7681B5; Path=/; Secure; HttpOnly
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
Strict-Transport-Security: max-age=31536000 ; includeSubDomains
Content-Security-Policy: default-src 'none'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; connect-src 'self'; img-src 'self'; style-src 'self' 'unsafe-inline';font-src 'self'
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Content-Type-Options: nosniff
Content-Type: application/json
Transfer-Encoding: chunked
Date: Mon, 24 Aug 2020 06:24:34 GMT
Connection: close
Server: Apache Ranger


{"statusCode":1,"msgDesc":"(0) Validation failure: error code[4009], reason[ Invalid service type [3] provided for service [cm_hive]], field[service type], subfield[null], type[semantically incorrect] "}  
{code}

*Policy content:*
{code}
{
      "service": "cm_hive",
      "name": "policy for db create",
      "policyType": 0,
      "policyPriority": 0,
      "description": "",
      "resourceSignature": "053c490e396ce264ff786bfe7e305c391cdee05b8a9e42e4fc969643119bdbb3",
      "isAuditEnabled": true,
      "resources": {
        "database": {
          "values": [
            "org"
          ],
          "isExcludes": false,
          "isRecursive": false
        }
      },
      "policyItems": [
        {
          "accesses": [
            {
              "type": "select",
              "isAllowed": true
            },
            {
              "type": "update",
              "isAllowed": true
            },
            {
              "type": "create",
              "isAllowed": true
            },
            {
              "type": "drop",
              "isAllowed": true
            },
            {
              "type": "alter",
              "isAllowed": true
            },
            {
              "type": "index",
              "isAllowed": true
            },
            {
              "type": "lock",
              "isAllowed": true
            },
            {
              "type": "all",
              "isAllowed": true
            },
            {
              "type": "read",
              "isAllowed": true
            },
            {
              "type": "write",
              "isAllowed": true
            },
            {
              "type": "repladmin",
              "isAllowed": true
            },
            {
              "type": "serviceadmin",
              "isAllowed": true
            },
            {
              "type": "tempudfadmin",
              "isAllowed": true
            },
            {
              "type": "refresh",
              "isAllowed": true
            }
          ],
          "users": [
            "hrt_21"
          ],
          "groups": [],
          "roles": [],
          "conditions": [],
          "delegateAdmin": false
        }
      ],
      "denyPolicyItems": [],
      "allowExceptions": [],
      "denyExceptions": [],
      "dataMaskPolicyItems": [],
      "rowFilterPolicyItems": [],
      "serviceType": "3",
      "options": {},
      "validitySchedules": [],
      "policyLabels": [],
      "zoneName": "",
      "isDenyAllElse": false,
      "id": 416,
      "guid": "d551b570-d81b-4df2-9b5e-0c405164e3ae",
      "isEnabled": true,
      "createdBy": "Admin",
      "updatedBy": "Admin",
      "version": 1
    } 
{code}
though after specifying serviceType as "hive" policy creation goes through.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)