Skip to content

Instantly share code, notes, and snippets.

@hcooper
Created September 14, 2012 08:48
Show Gist options
  • Select an option

  • Save hcooper/3720840 to your computer and use it in GitHub Desktop.

Select an option

Save hcooper/3720840 to your computer and use it in GitHub Desktop.
Remove any access restrictions for xinetd services
## Remove any access restrictions for xinetd services
# Our list of services
SERVICES="nrpe check_mk"
# $RUN determines is we need to do a restart afterwards
RUN=0
for service in $SERVICES; do
# If the service config file exists, check we've not already commented the config.
if [ -f /etc/xinetd.d/$service ]; then
egrep -q '#.*only_from' /etc/xinetd.d/$service
# If it's not already commented out, do it.
if [ $? == 1 ]; then
echo "Commenting out only_from in $service config."
sed -i 's/only_from/#only_from/g' /etc/xinetd.d/$service
RUN=1
else
echo "$service config up to date."
fi
fi
done
# If any of our config files changed, restart xinetd
if [ $RUN == 1 ]; then
service xinetd restart
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment