이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 5. Managing authorizations by using external files


To automate Red Hat Developer Hub maintenance, you can configure permissions and roles in external files, before starting Developer Hub.

5.1. Defining authorizations in external files by using the operator

To automate Red Hat Developer Hub maintenance, you can define permissions and roles in external files, before starting Developer Hub. You need to prepare your files, upload them to your OpenShift Container Platform project, and configure Developer Hub to use the external files.

Procedure

  1. Define your policies in a rbac-policies.csv CSV file by using the following format:

    1. Define role permissions:

      p, <role_entity_reference>, <permission>, <action>, <allow_or_deny>
      <role_entity_reference>
      Role entity reference, such as: role:default/guest.
      <permission>

      Permission, such as: bulk.import, catalog.entity.read, or catalog.entity.refresh, or permission resource type, such as: bulk-import or catalog-entity.

      See: Permission policies reference.

      <action>
      Action type, such as: use, read, create, update, delete.
      <allow_or_deny>
      Access granted: allow or deny.
    2. Assign the role to a group or a user:

      g, <group_or_user>, <role_entity_reference>
      <group_or_user>

      Group, such as: user:default/mygroup, or user, such as: user:default/myuser.

      Sample rbac-policies.csv

      p, role:default/guests, catalog-entity, read, allow
      p, role:default/guests, catalog.entity.create, create, allow
      g, user:default/my-user, role:default/guests
      g, group:default/my-group, role:default/guests

  2. Define your conditional policies in a rbac-conditional-policies.yaml YAML file by using the following format:

    result: CONDITIONAL
    roleEntityRef: <role_entity_reference>
    pluginId: <plugin_id>
    permissionMapping:
      - read
      - update
      - delete
    conditions: <conditions>

    See: Conditional policies reference.

  3. Upload your rbac-policies.csv and rbac-conditional-policies.yaml files to a rbac-policies config map in your OpenShift Container Platform project containing Developer Hub.

    $ oc create configmap rbac-policies \
         --from-file=rbac-policies.csv \
         --from-file=rbac-conditional-policies.yaml
  4. Update your Developer Hub Backstage custom resource to mount in the Developer Hub filesystem your files from the rbac-policies config map:

    Backstage Custom resource fragment

    apiVersion: rhdh.redhat.com/v1alpha1
    kind: Backstage
    spec:
      application:
        extraFiles:
          mountPath: /opt/app-root/src
          configMaps:
            - name: rbac-policies

  5. Update your Developer Hub app-config.yaml configuration file to use the rbac-policies.csv and rbac-conditional-policies.yaml external files:

    app-config.yml fragment

    permission:
      enabled: true
      rbac:
        conditionalPoliciesFile: /opt/app-root/src/rbac-conditional-policies.yaml
        policies-csv-file: /opt/app-root/src/rbac-policies.csv
        policyFileReload: true

5.2. Defining authorizations in external files by using Helm

To automate Red Hat Developer Hub maintenance, you can define permissions and roles in external files, before starting Developer Hub. You need to prepare your files, upload them to your OpenShift Container Platform project, and configure Developer Hub to use the external files.

Procedure

  1. Define your policies in a rbac-policies.csv CSV file by using the following format:

    1. Define role permissions:

      p, <role_entity_reference>, <permission>, <action>, <allow_or_deny>
      <role_entity_reference>
      Role entity reference, such as: role:default/guest.
      <permission>

      Permission, such as: bulk.import, catalog.entity.read, or catalog.entity.refresh, or permission resource type, such as: bulk-import or catalog-entity.

      See: Permission policies reference.

      <action>
      Action type, such as: use, read, create, update, delete.
      <allow_or_deny>
      Access granted: allow or deny.
    2. Assign the role to a group or a user:

      g, <group_or_user>, <role_entity_reference>
      <group_or_user>

      Group, such as: user:default/mygroup, or user, such as: user:default/myuser.

      Sample rbac-policies.csv

      p, role:default/guests, catalog-entity, read, allow
      p, role:default/guests, catalog.entity.create, create, allow
      g, user:default/my-user, role:default/guests
      g, group:default/my-group, role:default/guests

  2. Define your conditional policies in a rbac-conditional-policies.yaml YAML file by using the following format:

    result: CONDITIONAL
    roleEntityRef: <role_entity_reference>
    pluginId: <plugin_id>
    permissionMapping:
      - read
      - update
      - delete
    conditions: <conditions>

    See: Conditional policies reference.

  3. Upload your rbac-policies.csv and rbac-conditional-policies.yaml files to a rbac-policies config map in your OpenShift Container Platform project containing Developer Hub.

    $ oc create configmap rbac-policies \
         --from-file=rbac-policies.csv \
         --from-file=rbac-conditional-policies.yaml
  4. Update your Developer Hub Backstage Helm chart to mount in the Developer Hub filesystem your files from the rbac-policies config map:

    1. In the Developer Hub Helm Chart, go to Root Schema Backstage chart schema Backstage parameters Backstage container additional volume mounts.
    2. Select Add Backstage container additional volume mounts and add the following values:

      mountPath
      /opt/app-root/src
      Name
      rbac-policies
    3. Add the RBAC policy to the Backstage container additional volumes in the Developer Hub Helm Chart:

      name
      rbac-policies
      configMap
      defaultMode
      420
      name
      rbac-policies
  5. Update your Developer Hub app-config.yaml configuration file to use the rbac-policies.csv and rbac-conditional-policies.yaml external files:

    app-config.yml fragment

    permission:
      enabled: true
      rbac:
        conditionalPoliciesFile: /opt/app-root/src/rbac-conditional-policies.yaml
        policies-csv-file: /opt/app-root/src/rbac-policies.csv
        policyFileReload: true

Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.