Prisma Cloud Compute: How to add a feature flag to remove stale assets vulnerabilities result
3392
Created On 12/11/24 01:20 AM - Last Modified 11/03/25 18:43 PM
Objective
To remove the vulnerability scan results for stale hosts and images.
Environment
- Prisma Cloud Compute Edition
Procedure
For Docker Container:
- SSH into the host where the console container is running.
- Edit the twistlock.cfg file. It is available on the following default path: /var/lib/twistlock/sripts.
- Open the twistlock.cfg file by using the following command: nano twistlock.cfg.
- Add the following environment variable:
- CORE_DELETE_STALE_ASSETS_ENABLED=true
- CORE_DELETE_STALE_IMAGES_ENABLED=true
- Save the file and exit.
- Restart the console container.
- If onebox installation:
- sudo ./twistlock.sh -syj onebox
- If standalone console:
- sudo ./twistlock.sh -syj console
- If Kubernetes environment
- kubectl apply -f twistlock_console.yaml
- If onebox installation:
Example of twistlock.cfg file with the environment variable
For Kubernetes Console:
- Edit the console yaml file as follows:
spec:
...
containers:
...
env:
- name: CORE_DELETE_STALE_ASSETS_ENABLED
value: "true"
- name: CORE_DELETE_STALE_IMAGES_ENABLED
value: "true"
2. Run the following to apply the updated yaml file:
- kubectl apply -f twistlock_console.yaml
3. Verify that the change took place by running:
- kubectl get pod <console-pod-name> -o yaml -n <twistlock-namespace>
Additional Information
Once these F.Fs are enabled the cleanup tasks will run periodically (for hosts cleanup once every 1 hour and for images cleanup once every day). But basically after the first run (of the hosts/images cleanup task) the cleanup should be completed (so in the next run if no more stale hosts/images were added during this time the tasks won’t do anything).