Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add information about securing access to Cilium pods and provide a single page security reference #23599

Merged
merged 3 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion Documentation/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ The documentation is divided into the following sections:
* :ref:`dev_guide` : Gives background to those looking to develop and contribute
modifications to the Cilium code or documentation.

* :ref:`security_root` : Provides a one-page resource of best practices for securing Cilium.

A `hands-on tutorial <https://cilium.io/enterprise/#trainings>`_
in a live environment is also available for users looking for a way to quickly
get started and experiment with Cilium.
Expand Down Expand Up @@ -88,9 +90,10 @@ get started and experiment with Cilium.
:maxdepth: 2
:caption: Security

security/index
security/network/index
security/policy/index
security/tutorial-toc
zacharysarah marked this conversation as resolved.
Show resolved Hide resolved
security/restrict-pod-access
zacharysarah marked this conversation as resolved.
Show resolved Hide resolved

.. toctree::
:maxdepth: 2
Expand Down
2 changes: 0 additions & 2 deletions Documentation/security/cassandra.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
Please use the official rendered version released here:
https://docs.cilium.io

.. _gs_cassandra:

*****************************
Securing a Cassandra Database
*****************************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
Please use the official rendered version released here:
https://docs.cilium.io

.. _security_tutorial_root:
.. _security_root:

Network Policy Security Tutorials
---------------------------------
Securing Networks with Cilium
-----------------------------

.. toctree::
:maxdepth: 2
Expand All @@ -24,3 +24,4 @@ Network Policy Security Tutorials
aws
policy-creation
host-firewall
restrict-pod-access
zacharysarah marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 2 additions & 3 deletions Documentation/security/network/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
https://docs.cilium.io

.. _concepts_security:
.. _security_root:
zacharysarah marked this conversation as resolved.
Show resolved Hide resolved

Network Security
----------------
Overview of Network Security
----------------------------

.. toctree::
:maxdepth: 2
Expand Down
6 changes: 3 additions & 3 deletions Documentation/security/policy/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
.. _Network Policies:
.. _Network Policy:

Network Policy
--------------
Overview of Network Policy
--------------------------

This chapter documents the policy language used to configure network policies
This page documents the policy language used to configure network policies
in Cilium. Security policies can be specified and imported via the following
mechanisms:

Expand Down
53 changes: 53 additions & 0 deletions Documentation/security/restrict-pod-access.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.. only:: not (epub or latex or html)

WARNING: You are looking at unreleased Cilium documentation.
Please use the official rendered version released here:
https://docs.cilium.io

.. _security_restrict_pod_access:

========================================
Restricting privileged Cilium pod access
========================================

This page shows you how to restrict privileged access to Cilium pods by limiting access from the Kubernetes API, specifically from `kubernetes exec pod`_.

.. include:: gsg_requirements.rst

Background
----------

The Cilium agent needs some specific Linux capabilities to perform essential system and network operations.

Cilium relies on Kubernetes and containers to set up the environment and mount the corresponding volumes. Cilium doesn't perform any extra operations that could result in an unsafe volume mount.

Cilium needs kernel interfaces to properly configure the environment. Some kernel interfaces are part of the ``/proc`` filesystem, which includes host and machine configurations that can't be virtualized or namespaced.
zacharysarah marked this conversation as resolved.
Show resolved Hide resolved

If ``pod exec`` operations aren't restricted, then remote `exec into pods`_ and containers defeats Linux namespace restrictions.

The Linux kernel restricts joining other namespaces by default. To enter the Cilium container, the ``CAP_SYS_ADMIN`` capability is required in both the current user namespace and in the Cilium user namespace (the initial namespace). If both namespaces have the ``CAP_SYS_ADMIN`` capability, then this is already a privileged access.

To prevent privileged access to Cilium pods, restrict access to the Kubernetes API and arbitrary ``pod exec`` operations.

Restrict authorization for ``kubernetes exec pod``
--------------------------------------------------

To restrict access to Cilium pods through ``kubernetes exec pod``:

1. Configure `RBAC authorization`_ in Kubernetes.

2. Limit `access to the proxy subresource of Nodes`_.

References
----------

For more information about namespace security, visit:
zacharysarah marked this conversation as resolved.
Show resolved Hide resolved

- https://man7.org/linux/man-pages/man7/user_namespaces.7.html
- https://man7.org/linux/man-pages/man1/nsenter.1.html
- https://man7.org/linux/man-pages/man2/setns.2.html

.. _kubernetes exec pod: https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/
.. _exec into pods: https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/
.. _RBAC authorization: https://kubernetes.io/docs/reference/access-authn-authz/rbac/
.. _access to the proxy subresource of Nodes: https://kubernetes.io/docs/concepts/security/rbac-good-practices/#access-to-proxy-subresource-of-nodes
1 change: 1 addition & 0 deletions Documentation/spelling_wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,7 @@ virtIO
virtio
virtualbox
virtualization
virtualized
vlan
vlanBypass
vmlinux
Expand Down