Skip to content

Security requirements #705

Closed
Closed

Description

@vaikas

This issue tracks the requirements and design for the security of the data plane.
@evankanderson assigning to you as I know you were looking at the various aspects of this.

Activity

  1. added this to the v0.3.0 milestone on Jan 7, 2019
  2. evankanderson commented on Jan 7, 2019

    @evankanderson
    Member

    A few short thoughts and some doc links:

    We started a doc here, but I don't think I was able to get anyone else to add their requirements. We also have some interesting internal requirements which I'll try to synthesize into public form, though they may boil down to "custom admission control may be needed here".

    For data plane access control, I see four options:

    1. Limit access by using DNS -- restrict who can resolve the DNS name of the channel, possibly including a nonce in the actual expected hostname to reduce ability to guess at the endpoint.
      Cons: probably technically infeasible with kubernetes or other off the shelf resolvers (DNS does not have strong mechanisms for authenticating DNS clients). A name resolution leak (i.e. by passing results from one container to another) is an access control compromise. Feels like this is building a house of cards.

    2. Limit access by using IP level controls, i.e. kubernetes NetworkPolicy.
      Pros: probably widely available via CNI providers: Calico/Canal, Weave, kube-router, Cilium, or Romana support NetworkPolicy. No need for service mesh installation.
      Cons: No fine-grained support for distinguishing below the IP level (hostname, path). May be difficult to support cross-cluster integrations. Encryption support dependent on CNI provider (maybe only Calico, Weave?)

    3. Embrace the use of Istio/service mesh, and use layer-7 access control and policy to control access.
      Pros: Supports fine-grained control (path-level and hostname-level) access control. Supports access control based on application-level identity which should work from off-cluster. Support for encryption provided by the service mesh.
      Cons: Requires running Istio in sidecar mode, which adds cold-start latency for Serving. Adds a hard dependency on Istio.

    4. Implement access control in application software.
      Cons: Requires all application software to implement access control: via shared libraries in multiple languages, or via sidecar (see item 3 for sidecar approach). Introduces versioning and possible security issues when libraries are inconsistently applied. Still needs a mechanism to push access control policy to all participating nodes. This basically ignores the problem and pushes it on developers rather than solving it.

  3. evankanderson commented on Jan 7, 2019

    @evankanderson
    Member

    Options 2 and 3 seem the most feasible. One possible additional option (suggested by @Harwayne) was to have an abstract access control interface which would determine the concrete source/destination which should be allowed and then multiple implementations of the access control interface for different option 2 or option 3 providers.

    Note that doing this would either require that we think carefully about IP-level segregation of channel ingresses (and possibly also sinks) or that running in option 2 mode would be only a partial security solution.

  4. grantr commented on Jan 8, 2019

    @grantr
    Contributor

    Punting this to 0.4. We have a start but nothing that could be called a design proposal.
    /milestone v0.4.0

  5. modified the milestones: v0.4.0, v0.5.0 on Mar 6, 2019
  6. vaikas commented on Mar 25, 2019

    @vaikas
    ContributorAuthor

    Let's break this down to Generic Security Requirements for now, then gather the requirements and then generate more fine grained issues to track.

  7. changed the title [-]Security design & requirements[/-] [+]Security requirements[/+] on Mar 25, 2019
  8. evankanderson commented on Mar 25, 2019

    @evankanderson
    Member

    This needs to be broken down into smaller steps. It may be worth using a Project to track this. Some sample stories/steps:

    • List of minimal "allowable" sharing cases.
    • Implementation of TLS between data plane components.
    • Peer-to-peer authentication technology between data plane components (recommend OAuth?)
    • Decision about how to perform authz between data plane components (i.e. which identity can send events). Possibly define new objects to describe the allowed connections.
    • Implementation of authz given decision above.
  9. lindydonna commented on Mar 27, 2019

    @lindydonna

    /milestone 0.6

  10. 15 remaining items

  11. evankanderson commented on May 28, 2019

    @evankanderson
    Member

    I think Mike assumed one item that isn't clear here -- standardizing on OpenID / JWTs with sub and aud claims (and targets verifying the aud claims).

    Rationale for preferring JWTs over something like x509 certs:

    1. JWTs are well-understood and widely supported (>80 libraries and >15 languages at jwt.io)
    2. JWTs are more easily supported by Kubernetes (using x509 certs requires automating CSR APIs vs simply calling existing APIs)
    3. Many other providers already use JWTs, and most users already have an OpenID infrastructure (for supporting off/cross-cluster calls).
    4. The identity model for JWTs is clearer and better-understood for most users than x509.
  12. mikehelmick commented on May 29, 2019

    @mikehelmick
    Contributor

    Thanks @evankanderson

    Those comments veer into the detailed design bit. To enable the point-to-point auth, we are proposing to use the workload identity/service account and JWTs. In addition to the sub and aud claims, receivers will need a configuration back to the issuer (iss) to verify the token.

    It is easy to map cluster generated tokens that are automatically refreshed at half their expiry period.

    Implementations like the AAD Pod Identity referenced above allow those identities to be identities that can be used off cluster or for other managed services within a cloud provider. This allows for verifiable cross cluster communication.

    apiVersion: v1
    kind: Pod
    metadata:
      name: token-demo
    spec:
      containers:
      - name: demo-container
        image: demo-container
        volumeMounts:
        - name: token-vol
          mountPath: "/service-account"
          readOnly: true
      volumes:
      - name: token-vol
        projected:
          sources:
          - serviceAccountToken:
              audience: broker
              expirationSeconds: 3600
              path: broker-token
  13. alanconway commented on May 29, 2019

    @alanconway
    Contributor

    Are all connections in the diagram are TLS encrypted to avoid snooping and MITM attacks? Perhaps that should be explicitly stated.

  14. evankanderson commented on May 29, 2019

    @evankanderson
    Member

    Would requiring a CNI implementation with encryption support be acceptable for on-cluster networking?

    For off-cluster networking, TLS encryption (or equivalent, e.g. IPSec) would seem to be required.

  15. alanconway commented on May 30, 2019

    @alanconway
    Contributor

    Would requiring a CNI implementation with encryption support be acceptable for on-cluster networking?

    Not sure, I don't know how an encrypted CNI would work in terms of controlling keys, certs etc.

    TLS provides privacy and authentication, under the strict control of each endpoint - the connected entities establish trust and private comms with each other and don't have to trust anyone else. I guess Tokens would fill the authentication need, and a encrypted CNI could provide privacy, but now everybody has to trust the CNI implementation.

    For off-cluster networking, TLS encryption (or equivalent, e.g. IPSec) would seem to be required.

    I'm still getting my head around the on/off-cluster distinction, but I don't yet see why the security requirements are any different. The cluster is a shared network, potentially anyone with a credit card can get on it. Of course there are safeguards, like the real internet, but can you trust them?

  16. evankanderson commented on May 30, 2019

    @evankanderson
    Member

    Would requiring a CNI implementation with encryption support be acceptable for on-cluster networking?

    Not sure, I don't know how an encrypted CNI would work in terms of controlling keys, certs etc.

    An encrypted CNI establishes network encryption between Kubernetes Nodes (which are all assumed to be on a flat-topology (directly reachable by IP) network. The key distribution and encryption is handled by the cluster operator rather than by the individual components. This is often done using IPSec, but there are various IP encapsulation strategies available.

    TLS provides privacy and authentication, under the strict control of each endpoint - the connected entities establish trust and private comms with each other and don't have to trust anyone else. I guess Tokens would fill the authentication need, and a encrypted CNI could provide privacy, but now everybody has to trust the CNI implementation.

    The connected entities need some mechanism for introduction and identity proof. For TLS, this is usually a certificate signed by a CA that the caller trusts (and the caller may not need to provide a cert -- mutual TLS requires distributing signed certificates to both parties, rather than just the "server"). There are other possible introduction mechanisms, but managing CA keys and getting signed certs distributed to clusters is actually non-trivial. (There are also possible trust issues beyond this -- see SPIFFE for details about how different CAs may be limited to only signing for certain trust domains.)

    The two big challenges here are:

    1. Getting a signed key for the server
    2. Getting the CA key onto the client

    If you have a public internet IP or DNS name you control, ACME can be used to acquire item 1 from (for example) LetsEncrypt. Many useful installations don't want to be internet-exposed, and LetsEncrypt already has pretty hard rate limits (50/week requests per subdir).

    Kubernetes also offers a cert-signing API, but the approval mechanism is not automated, and introducing the cluster's CA key onto clients may also be challenging.

    For off-cluster networking, TLS encryption (or equivalent, e.g. IPSec) would seem to be required.

    I'm still getting my head around the on/off-cluster distinction, but I don't yet see why the security requirements are any different. The cluster is a shared network, potentially anyone with a credit card can get on it. Of course there are safeguards, like the real internet, but can you trust them?

    I'm not sure what your threat model here is -- you say "the cluster is a shared network, potentially anyone with a credit card can get on it".

    Most cloud providers are offering private per-customer VPC networks at this point; similarly, for a private network (home behind NAT or enterprise), presumably network access is controlled, and an encrypted CNI (providing a shared encryption key across the Kubernetes cluster) could further prevent tampering with packets if you trust the host administrators but not the network itself.

    If you don't trust the host administrators (who control the Node's kernel and container runtime), you're in a difficult position -- Linux containers won't prevent host-level root from just scanning for keys or data from /proc/<pid>/mem directly.

  17. alanconway commented on May 31, 2019

    @alanconway
    Contributor

    @evankanderson I think that makes sense. It is worthwhile spelling out the trust requirements.

    1. containers can't snoop on each others connections
    2. intruders with unauthorized network access can't snoop on connections
    3. trust: the cloud provider can snoop on or modify anything

    not sure what your threat model here is --
    My default threat model is "if I don't understand it, it's probably not safe :)"
    Thanks for taking the time to explain.

  18. evankanderson commented on May 31, 2019

    @evankanderson
    Member

    No problem -- it helps to know what you're trying to defend against.

    I think we have three or four different profiles of operators:

    1. Public Cloud Providers.
      We want to build something which can be shipped by cloud providers and work, but most cloud providers will go over everything and add their own integrations with the rest of their cloud products.

      Most public cloud providers will also have dedicated security experts who can evaluate many of these components in the context of the particular cloud provider's security system and threat model. Additionally, public cloud providers (by their nature) must assume that their customers are malicious and attempting to compromise both the cloud provider and the other tenants (the "anyone with a credit card" argument). Other profiles may not have this problem.

    2. Private Clouds.
      This covers a range of on-premises deployments with varying levels of skill. Some will be packaged deployments or set up by a professional services organization; others may be sophisticated environments managed by best-in-class experts; some will be forgotten experiments with no patches applied.

      One general feature of private cloud deployments is that all tenants eventually report up to the same organizational head, which means that security (to some extent) is a shared responsibility. Some organizations may choose to further segment tenants and clusters onto different infrastructure and clusters for additional security, but this is still a more-cooperative game than public cloud.

    3. Hobbyist setups.
      This is a special form of private clouds (possibly similar to the "forgotten experiment" case above), but the amount of stored business value is very low. They may also experience a high churn rate depending on the owner's free time, but the main security concern here is simply in preventing the resources from being harvested and re-used by attackers as jumping-off points for botnet operations.

    Summary:

    1. Public Cloud Provider -- don't fundamentally drop the ball and it will be fine.
    2. Private Cloud -- install out of the box with guard-rails, support a wide range of policy customization.
    3. Hobbyist -- prevent internet exposure. Consider auto-update if internet-exposed.
  19. grantr commented on Jun 24, 2019

    @grantr
    Contributor

    /milestone v0.8.0

  20. modified the milestones: v0.7.0, v0.8.0 on Jun 24, 2019
  21. mikehelmick commented on Aug 2, 2019

    @mikehelmick
    Contributor

    I think the requirements and principles outlined here give us enough to move forward. Future work will take place under #1449

    /close

  22. knative-prow-robot commented on Aug 2, 2019

    @knative-prow-robot
    Contributor

    @mikehelmick: Closing this issue.

    Details

    In response to this:

    I think the requirements and principles outlined here give us enough to move forward. Future work will take place under #1449

    /close

    Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions