Created
September 14, 2012 08:48
-
-
Save hcooper/3720840 to your computer and use it in GitHub Desktop.
Remove any access restrictions for xinetd services
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## 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