> ## Documentation Index
> Fetch the complete documentation index at: https://cloudanix.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create files below dev

### Event Information

#### Meaning

* The "Create files below dev" event in a Kubernetes cluster indicates that a process running within a container has attempted to create files in the "/dev" directory.
* This event could be a potential security concern as the "/dev" directory contains device files that provide direct access to hardware devices. Creating files in this directory could be an attempt to gain unauthorized access or manipulate system resources.
* To investigate this event, you can use the following kubectl command to list the pods running in the cluster and check their logs for any suspicious activity:
  `kubectl get pods --all-namespaces`

#### Remediation

1. Use the Kubernetes API to create a Python script that generates a Kubernetes manifest file for creating a Pod with a volume mount to the "dev" directory.

```python theme={null}
import yaml

def generate_manifest():
    manifest = {
        "apiVersion": "v1",
        "kind": "Pod",
        "metadata": {
            "name": "remediation-pod",
            "labels": {
                "app": "remediation"
            }
        },
        "spec": {
            "containers": [
                {
                    "name": "remediation-container",
                    "image": "python:latest",
                    "command": ["python", "-m", "http.server", "8000"],
                    "volumeMounts": [
                        {
                            "name": "dev-volume",
                            "mountPath": "/dev"
                        }
                    ]
                }
            ],
            "volumes": [
                {
                    "name": "dev-volume",
                    "emptyDir": {}
                }
            ]
        }
    }

    with open("remediation.yaml", "w") as file:
        yaml.dump(manifest, file)

generate_manifest()
```

2. Apply the generated manifest file using kubectl to create the remediation Pod.

```bash theme={null}
kubectl apply -f remediation.yaml
```

3. Verify that the remediation Pod is running and the volume mount to the "dev" directory is successful.

```bash theme={null}
kubectl get pods -l app=remediation
kubectl exec -it <pod-name> -- ls /dev
```

Note: Replace `<pod-name>` with the actual name of the remediation Pod obtained from the previous command.
