56 lines
2.2 KiB
Bash
56 lines
2.2 KiB
Bash
print_config_title 'CHECK POSTFIX BASIC CONFIG'
|
|
|
|
# Check /etc/postfix/main.cf config file mail_owner/inet_protocols parameters
|
|
|
|
|
|
conf_file_to_test="/etc/postfix/main.cf"
|
|
|
|
# Check if conf file exist
|
|
if [[ ! -f "${conf_file_to_test}" ]]
|
|
then
|
|
echo -e "${RED}ERROR : file ${conf_file_to_test} NOT FOUND.${NC}\n"
|
|
POSTFIX_CONFIG_CHECK_FAILED=${POSTFIX_CONFIG_CHECK_FAILED}" Error, file ${conf_file_to_test} not found;"
|
|
else
|
|
|
|
|
|
# mail_owner
|
|
check_value_in_conf_file "POSTFIX" "${conf_file_to_test}" "mail_owner" "postfix"
|
|
|
|
case ${?} in
|
|
0) # OK, nothing to do
|
|
;;
|
|
1) # Error (wrong number of param or other)
|
|
POSTFIX_CONFIG_CHECK_FAILED=${POSTFIX_CONFIG_CHECK_FAILED}" Error during mail_owner check with function check_value_in_conf_file, maybe incorrect number of parameter or file not found;"
|
|
;;
|
|
2) # Unexpected value is set
|
|
POSTFIX_CONFIG_CHECK_FAILED=${POSTFIX_CONFIG_CHECK_FAILED}" mail_owner is not well configured or has other value, set 'mail_owner = postfix';"
|
|
;;
|
|
3) # All expected values are NOT configured
|
|
POSTFIX_CONFIG_CHECK_FAILED=${POSTFIX_CONFIG_CHECK_FAILED}" mail_owner is not well configured, set 'mail_owner = postfix';"
|
|
;;
|
|
*) # Unknown return code...
|
|
POSTFIX_CONFIG_CHECK_FAILED=${POSTFIX_CONFIG_CHECK_FAILED}" Error, unknown return code when calling check_value_in_conf_file to check mail_owner;"
|
|
;;
|
|
esac
|
|
|
|
|
|
# inet_protocols
|
|
check_value_in_conf_file "POSTFIX" "${conf_file_to_test}" "inet_protocols" "all"
|
|
|
|
case ${?} in
|
|
0) # OK, nothing to do
|
|
;;
|
|
1) # Error (wrong number of param or other)
|
|
POSTFIX_CONFIG_CHECK_FAILED=${POSTFIX_CONFIG_CHECK_FAILED}" Error during inet_protocols check with function check_value_in_conf_file, maybe incorrect number of parameter or file not found;"
|
|
;;
|
|
2) # Unexpected value is set
|
|
POSTFIX_CONFIG_CHECK_FAILED=${POSTFIX_CONFIG_CHECK_FAILED}" inet_protocols are not well configured or has other value, set 'inet_protocols = all';"
|
|
;;
|
|
3) # All expected values are NOT configured
|
|
POSTFIX_CONFIG_CHECK_FAILED=${POSTFIX_CONFIG_CHECK_FAILED}" inet_protocols are not well configured, set 'inet_protocols = all';"
|
|
;;
|
|
*) # Unknown return code...
|
|
POSTFIX_CONFIG_CHECK_FAILED=${POSTFIX_CONFIG_CHECK_FAILED}" Error, unknown return code when calling check_value_in_conf_file to check inet_protocols;"
|
|
;;
|
|
esac
|
|
fi
|