37 lines
1.6 KiB
Bash
37 lines
1.6 KiB
Bash
echo "-------------------------------------------------"
|
|
echo -e "----------- ${BLUE}CHECK POSTFIX BASIC CONFIG${NC} ----------"
|
|
echo -e "-------------------------------------------------\n"
|
|
|
|
# This script just check the parameter inet_protocols
|
|
echo -e "Check ${BLUE}Postfix${NC} config file /etc/postfix/main.cf (parameter inet_protocols)"
|
|
|
|
# Check if inet_protocols exist but different than expected (success if return code = 1)
|
|
grep "^[[:space:]]*inet_protocols" /etc/postfix/main.cf \
|
|
| grep -q -v -e "^[[:space:]]*inet_protocols[[:space:]]*=[[:space:]]*all[[:space:]]*$"
|
|
|
|
# Return Code
|
|
RC=$?
|
|
|
|
# inet_protocols has other value than expected
|
|
if [ $RC -eq 0 ]
|
|
then
|
|
POSTFIX_CONFIG_CHECK_FAILED="${POSTFIX_CONFIG_CHECK_FAILED} Postfix inet_protocols is not configured as expected, expected : 'inet_protocols = all'"
|
|
echo -e "${RED}Postfix inet_protocols is NOT CONFIGURED as EXPECTED : check KO${NC}\n"
|
|
# inet_protocols hasn't unexpected value
|
|
else
|
|
# Check if ALL protocols (IPv4 and IPv6) are configured (success if return code = 0)
|
|
grep -q "^[[:space:]]*inet_protocols[[:space:]]*=[[:space:]]*all[[:space:]]*$" /etc/postfix/main.cf
|
|
|
|
# Return Code
|
|
RC=$?
|
|
|
|
# All protocols not configured
|
|
if [ $RC -ne 0 ]
|
|
then
|
|
POSTFIX_CONFIG_CHECK_FAILED="${POSTFIX_CONFIG_CHECK_FAILED} Postfix inet_protocols is not configured as expected, expected : 'inet_protocols = all'"
|
|
echo -e "${RED}Postfix inet_protocols is NOT CONFIGURED as EXPECTED : check KO${NC}\n"
|
|
# All protocols configured
|
|
else
|
|
echo -e "${GREEN}POSTFIX inet_protocols is CONFIGURED as expected : check OK${NC}\n"
|
|
fi
|
|
fi
|