-
Notifications
You must be signed in to change notification settings - Fork 350
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
AppArmor not working with lenient policies #1119
Comments
It seems like a blocker at Apparmor's side it's related to how Apparmor works when it comes to transition to a sub-profile for a process to gain more privileges/permissions. for a process to gain more (file) capability than it's parent process the process must have when a pod container is configured with i asked it on apparmor gitlab repo by creating an issue and according to a reply on this issue currently it's not possible to achieve implementation of such apparmor profile if the |
this issue is not limited to the lenient policies, in a runtime env with for example:
apiVersion: apps/v1
kind: Deployment
metadata:
name: ubuntu-deployment
namespace: default
labels:
deployment: ubuntu
spec:
replicas: 1
selector:
matchLabels:
group: group-1
container: ubuntu
template:
metadata:
labels:
group: group-1
container: ubuntu
spec:
containers:
- name: ubuntu-container
image: kubearmor/ubuntu-w-utils:0.1
securityContext:
allowPrivilegeEscalation: false
apiVersion: security.kubearmor.com/v1
kind: KubeArmorPolicy
metadata:
name: ksp-ubuntu-allow-file-path-owner-readonly-from-source-path
namespace: default
spec:
severity: 10
message: "a critical file was accessed"
tags:
- WARNING
selector:
matchLabels:
container: ubuntu
group: group-1
process: # base whitelisting rules
matchPaths:
- path: /home/user1/readwrite
fromSource:
- path: /bin/su
matchDirectories:
- dir: /bin/ # required to change root to user1 / try 'su - user1'
recursive: true
- dir: /usr/bin/ # used in changing accounts
recursive: true
file:
matchPaths:
- path: /home/user1/secret_data1.txt
readOnly: true
ownerOnly: true
fromSource:
- path: /readwrite
- path: /bin/su
- path: /root/.bashrc # used by root
- path: /root/.bash_history # used by root
- path: /home/user1/.profile # used by user1
- path: /home/user1/.bashrc # used by user1
- path: /run/utmp # required to change root to user1
- path: /dev/tty
matchDirectories:
- dir: /etc/ # required to change root to user1 (coarse-grained way)
recursive: true
- dir: /proc/ # required to change root to user1 (coarse-grained way)
recursive: true
action:
Allow
|
To conclude on this issue, at this point it is not possible/feasible to (full) support enforcement leveraging |
Can you add a document explaining this as part of wiki? Then we can close the issue. Thanks a lot @rksharma95 |
@rksharma95 some points:
|
updated the wiki, PTAL @daemon1024 thanks |
LGTM, Thanks a lot for seeing this through 🙌🏽 |
General Information
k3s
uname -a
):5.15.0-56-generic
kubectl version
, ...)vault-
Apparmor
To Reproduce
/vault/
inside vault-0 pod, i.e.Expected behavior
as per the applied policy any access to the
/vault/
directory should be blocked except access by the/bin/vault
binary.The text was updated successfully, but these errors were encountered: