Worklet Script Running Even It Should Need To Exit 0
Hey,
I’ve made this worklet condition script but it seems the Remediation Code even that there is no Docker0 interface and non of the IPs start with 172.x.x.x
Evaluation Code
#!/bin/bash
# Check if the docker0 interface exists
if ip addr show docker0 &> /dev/null; then
# Get the IP address of the docker0 interface
docker0_ip=$(ip addr show docker0 | awk '/inet / {split($2, a, "/"); print a[1]}')
# Check if the IP address starts with 172.x.x.x
if [[ $docker0_ip =~ ^172\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
echo "The docker0 interface has an IP address starting with 172.x.x.x."
exit 1
else
echo "The docker0 interface does not have an IP address starting with 172.x.x.x."
exit 0
fi
else
echo "The docker0 interface does not exist."
exit 0
fi
I would expect it to not run the script (Remediation Code) since non of the conditions are met but the activity log says: Created a new Docker default file at /etc/default/docker and checking the device the file was created.
Any chance to figure why?
This discussion is archived and closed to replies. Continue it in the Automox Community Slack.
Discuss on Slack