postgres-operator icon indicating copy to clipboard operation
postgres-operator copied to clipboard

Security issue of Postgres Operator user having access to security of many namespaces

Open fanzhang15 opened this issue 7 years ago • 5 comments

**What is the motivation or use case for the change? ** Postgres Operator has RBAC at ClusterRole level. It allows get, list and create secrets. This poses a security issue when pgouser1 who has access to the Operator, also has full access to the security of pgouser2. This is similar to Tiller user having access to the security of different namespaces.

kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1beta1 metadata: name: pgopclusterrolesecret rules:

  • verbs:
    • get
    • list
    • create apiGroups:
    • '*' resources:
    • secrets

Describe the solution you'd like A clear and concise description of what you want to happen. I want Operator to NOT have access to security.

Please tell us about your environment: Environment irrelevant

  • Operating System:
  • Where is this running ( Local, Cloud Provider)
  • Storage being used (NFS, Hostpath, Gluster, etc):
  • Container Image Tag:
  • PostgreSQL Version:
  • Platform (Docker, Kubernetes, OpenShift):
  • Platform Version:

Additional context Add any other context or screenshots about the enhancement request here.

fanzhang15 avatar Jun 25 '19 16:06 fanzhang15

Hi,

the operator has create permissions on the namespaces it watches because it is creating Secrets in those namespaces...users only have access to the Operator API that are known and registered in pgouser and have rights defined by pgorole...pgo users are also restricted as to what namespaces they have access to by pgorole definitions.

maybe I'm not following your concern however, if so, please elaborate and I'll try to address.

regards.

jmccormick2001 avatar Jun 26 '19 22:06 jmccormick2001

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 25 '19 23:08 stale[bot]

@fanzhang15 please let us know if Jeff explanation addresses your concern or if you have any further questions.

prlaurence avatar Aug 27 '19 13:08 prlaurence

This issue is similar/ the same as https://github.com/CrunchyData/postgres-operator/issues/905 operator service account should not have access to all secrets on cluster. Ideally managing the operator does not require cluster admin.

ghost avatar Dec 03 '19 01:12 ghost

Hi @leigh-j,

Which version of the Operator are you using? Operator 4.1 does not require any ClusterAdmin except for the installation, and the only ClusterRole permissions are as such and only required for dynamic namespacing:

kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: pgo-cluster-role
rules:
  - verbs:
      - '*'
    apiGroups:
      - '*'
    resources:
      - namespaces
      - serviceaccounts
      - roles
      - rolebindings

If you do not wish to use the dynamic namespace feature, you can add the namespaces manually, using the scripts available in the "deploy" directory, e.g. add-targeted-namespace.sh

jkatz avatar Dec 03 '19 18:12 jkatz