Compare commits

..

8 Commits

3 changed files with 142 additions and 124 deletions

View File

@@ -396,8 +396,13 @@ while [[ "$SASL_AUTH_ENABLED" != "yes" &&
SASL_AUTH_ENABLED=${SASL_AUTH_ENABLED,,}
fi
if [[ "$SASL_AUTH_ENABLED" != "yes" && "$SASL_AUTH_ENABLED" != "no" ]] ; then
_SASL_AUTH_ENABLED=""
[[ -z "${SASL_AUTH_ENABLED}" ]] && SASL_AUTH_ENABLED=${_SASL_AUTH_ENABLED}
if [[ "$SASL_AUTH_ENABLED" != "yes" &&
"$SASL_AUTH_ENABLED" != "true" &&
"$SASL_AUTH_ENABLED" != "false" &&
"$SASL_AUTH_ENABLED" != "no" ]] ; then
SASL_AUTH_ENABLED=""
echo -e "\n\t\033[33m\033[1mWrong entry!\033[m\n Type 'yes' or 'no'"
fi

View File

@@ -2731,7 +2731,7 @@ EOF
if [[ -n "$(which postfwd)" ]] ; then
cat <<EOF >> /etc/postfix/main.cf
127.0.0.1:10040_time_limit = 3600
#127.0.0.1:10040_time_limit = 3600
EOF
else
cat <<EOF >> /etc/postfix/main.cf
@@ -2749,7 +2749,7 @@ if [[ -n "$(which policyd-spf)" ]] ; then
# policyd-spf unix - n n - 0 spawn
# user=policyd-spf argv=/usr/bin/policyd-spf
#
policyd-spf_time_limit = 3600
#policyd-spf_time_limit = 3600
EOF
fi
@@ -3049,7 +3049,7 @@ else
EOF
fi
if ${IS_SYMPA_LIST_SERVER} ; then
if ${IS_SYMPA_LIST_SERVER} || ${IS_RELAY_HOST}; then
cat <<EOF >> /etc/postfix/main.cf
@@ -4147,6 +4147,14 @@ else
dmarc_pipe_present=false
fi
if ${LISTEN_ON_ADDITIONAL_RELAY_PORT} ; then
if grep -iq -E "^${ADDITIONAL_RELAY_LISTEN_PORT}\s+" $postfix_master_cf > /dev/null 2>&1 ; then
additional_relay_port_present=true
else
additional_relay_port_present=false
fi
fi
_found=false
echononl " Create new file \"${postfix_master_cf}\""
if [[ -f "${postfix_master_cf}.$backup_date" ]]; then
@@ -4176,9 +4184,11 @@ smtps inet n - y - - smtpd
EOF
fi
elif $LISTEN_ON_ADDITIONAL_RELAY_PORT ; then
cat >> $postfix_master_cf << EOF
if ! ${additional_relay_port_present} ; then
cat >> $postfix_master_cf << EOF
${ADDITIONAL_RELAY_LISTEN_PORT} inet n - y - - smtpd
EOF
fi
fi
continue
fi

View File

@@ -389,7 +389,7 @@ if [[ -z "$APACHE_VHOST_DIR" ]] ; then
fi
fi
[[ -n "${COMPOSER}" ]] || COMPOSER=${DEFAULT_COMPOSER}
[[ -n "${COMPOSER}" ]] || COMPOSER=${DEFAULT_COMPOSER}
[[ -n "$POSTFIX_DB_TYPE" ]] || fatal "Database Type of Postfix Database (POSTFIX_DB_TYPE) not present!"
[[ -n "$POSTFIX_DB_HOST_MYSQL" ]] || POSTFIX_DB_HOST_MYSQL="$DEFAULT_POSTFIX_DB_HOST_MYSQL"
@@ -430,7 +430,7 @@ if [[ "$POSTFIX_DB_TYPE" = "mysql" ]] ; then
fi
else
echononl "\tGet MySQL command.."
mysql_command="$(which mysql)"
if [[ $? -eq 0 ]]; then
@@ -453,9 +453,9 @@ if [[ "$POSTFIX_DB_TYPE" = "mysql" ]] ; then
elif [[ -f "/etc/mysql/debian.cnf" ]] ; then
MYSQL_CREDENTIALS="--defaults-file=/etc/mysql/debian.cnf"
else
fatal "Parameter 'MYSQL_CREDENTIALS' cannot be determined automated.
fatal "Parameter 'MYSQL_CREDENTIALS' cannot be determined automated.
Use configuration file "$conf_file" to set
Use configuration file "$conf_file" to set
parameter manually."
fi
fi
@@ -475,7 +475,7 @@ fi
if [[ "$ENCRYPTION_METHOD" =~ dovecot ]]; then
[[ -n "$DOVEADM_PW" ]] || DOVEADM_PW=$DEFAULT_DOVEADM_PW
fi
fi
[[ -n "$DELETED_MAILBOX_DIR" ]] || DELETED_MAILBOX_DIR=$DEFAULT_DELETED_MAILBOX_DIR
[[ -n "$DELETED_DOMAINS_DIR" ]] || DELETED_DOMAINS_DIR=$DEFAULT_DELETED_DOMAINS_DIR
@@ -767,7 +767,7 @@ fi
if ! $database_exists ; then
echononl "\tCreate Postfix Database '$POSTFIX_DB_NAME'"
if [ "$POSTFIX_DB_TYPE" = "mysql" ]; then
if [ "$POSTFIX_DB_TYPE" = "mysql" ]; then
echo -n " (MySQL).."
mysql $MYSQL_CREDENTIALS -N -s -e \
"CREATE DATABASE IF NOT EXISTS $POSTFIX_DB_NAME CHARACTER SET utf8 COLLATE utf8_general_ci" >> $log_file 2>&1
@@ -817,7 +817,7 @@ else
else
_db_backup_file_name="${POSTFIX_DB_NAME}-pfa.${backup_date}.sql"
fi
if [[ "$POSTFIX_DB_TYPE" = "mysql" ]]; then
if [[ "$POSTFIX_DB_TYPE" = "mysql" ]]; then
echo -n " (MySQL).."
mysqldump $MYSQL_CREDENTIALS --opt $POSTFIX_DB_NAME > ${WEBSITE_BASEDIR}/${_db_backup_file_name} 2> $log_file
if [[ $? -eq 0 ]]; then
@@ -1011,7 +1011,7 @@ else
fi
echo -e "\n\n\t\033[37m\033[1mBase install Postfixadmin..\033[m\n"
@@ -1358,13 +1358,13 @@ if [[ "$PHP_TYPE" = "fcgid" ]] ; then
#!/bin/sh
export PHPRC="${WEBSITE_BASEDIR}/conf/"
export TMPDIR="${WEBSITE_BASEDIR}/tmp"
# PHP child process management (PHP_FCGI_CHILDREN) should
# always be disabled with mod_fcgid, which will only route one
# request at a time to application processes it has spawned;
# thus, any child processes created by PHP will not be used
# effectively. (Additionally, the PHP child processes may not
# be terminated properly.) By default, and with the environment
# variable setting PHP_FCGI_CHILDREN=0, PHP child process
# PHP child process management (PHP_FCGI_CHILDREN) should
# always be disabled with mod_fcgid, which will only route one
# request at a time to application processes it has spawned;
# thus, any child processes created by PHP will not be used
# effectively. (Additionally, the PHP child processes may not
# be terminated properly.) By default, and with the environment
# variable setting PHP_FCGI_CHILDREN=0, PHP child process
# management is disabled.
PHP_FCGI_CHILDREN=0
export PHP_FCGI_CHILDREN
@@ -1697,17 +1697,17 @@ EOF
# - X-Frame-Options
# -
# - The X-Frame-Options header (RFC), or XFO header, protects your visitors
# - against clickjacking attacks. An attacker can load up an iframe on their
# - site and set your site as the source, it's quite easy:
# - The X-Frame-Options header (RFC), or XFO header, protects your visitors
# - against clickjacking attacks. An attacker can load up an iframe on their
# - site and set your site as the source, it's quite easy:
# -
# - <iframe src="https://scotthelme.co.uk"></iframe>
# -
# - Using some crafty CSS they can hide your site in the background and create some
# - genuine looking overlays. When your visitors click on what they think is a harmless
# - link, they're actually clicking on links on your website in the background. That
# - might not seem so bad until we realise that the browser will execute those requests
# - in the context of the user, which could include them being logged in and authenticated
# - Using some crafty CSS they can hide your site in the background and create some
# - genuine looking overlays. When your visitors click on what they think is a harmless
# - link, they're actually clicking on links on your website in the background. That
# - might not seem so bad until we realise that the browser will execute those requests
# - in the context of the user, which could include them being logged in and authenticated
# - to your site!
# -
# - Troy Hunt has a great blog on 'Clickjack attack the hidden threat right in front :
@@ -1715,49 +1715,49 @@ EOF
# -
# - http://www.troyhunt.com/2013/05/clickjack-attack-hidden-threat-right-in.html
# -
# - Valid values include DENY meaning your site can't be framed, SAMEORIGIN which allows
# - you to frame your own site or ALLOW-FROM https://example.com/ which lets you specify
# - Valid values include DENY meaning your site can't be framed, SAMEORIGIN which allows
# - you to frame your own site or ALLOW-FROM https://example.com/ which lets you specify
# -sites that are permitted to frame your own site.
# -
Header always set X-Frame-Options "SAMEORIGIN"
# - X-Xss-Protection
# -
# - This header is used to configure the built in reflective XSS protection found
# - in Internet Explorer, Chrome and Safari (Webkit). Valid settings for the header
# - are 0, which disables the protection, 1 which enables the protection
# - and 1; mode=block which tells the browser to block the response if it
# - This header is used to configure the built in reflective XSS protection found
# - in Internet Explorer, Chrome and Safari (Webkit). Valid settings for the header
# - are 0, which disables the protection, 1 which enables the protection
# - and 1; mode=block which tells the browser to block the response if it
# - detects an attack rather than sanitising the script.
# -
Header always set X-Xss-Protection "1; mode=block"
# - X-Content-Type-Options
# -
# - Nice and easy to configure, this header only has one valid value, nosniff.
# - It prevents Google Chrome and Internet Explorer from trying to mime-sniff
# - the content-type of a response away from the one being declared by the server.
# - It reduces exposure to drive-by downloads and the risks of user uploaded content
# - that, with clever naming, could be treated as a different content-type, like
# - Nice and easy to configure, this header only has one valid value, nosniff.
# - It prevents Google Chrome and Internet Explorer from trying to mime-sniff
# - the content-type of a response away from the one being declared by the server.
# - It reduces exposure to drive-by downloads and the risks of user uploaded content
# - that, with clever naming, could be treated as a different content-type, like
# - an executable.
# -
Header always set X-Content-Type-Options "nosniff"
# - Content Security Policy
# -
# - The CSP header allows you to define a whitelist of approved sources of content
# - for your site. By restricting the assets that a browser can load for your site,
# - like js and css, CSP can act as an effective countermeasure to XSS attacks. I
# - have covered CSP in a lot more detail in my blog Content Security Policy - An
# - Introduction (https://scotthelme.co.uk/content-security-policy-an-introduction/).
# - The CSP header allows you to define a whitelist of approved sources of content
# - for your site. By restricting the assets that a browser can load for your site,
# - like js and css, CSP can act as an effective countermeasure to XSS attacks. I
# - have covered CSP in a lot more detail in my blog Content Security Policy - An
# - Introduction (https://scotthelme.co.uk/content-security-policy-an-introduction/).
# -
# - Here is a basic policy to enforce TLS on all assets and prevent
# - Here is a basic policy to enforce TLS on all assets and prevent
# - mixed content warnings.
# -
# - Allow Google Analytics, Google AJAX CDN and Same Origin
# - script-src 'self' www.google-analytics.com ajax.googleapis.com;
# -
# - Emmbedding Google Fonts
# - style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;
# - style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;
# -
# - Allow YouTube Videos (iframe embedded)
# - frame-src 'self' https://www.youtube.com
@@ -1767,9 +1767,9 @@ EOF
# - Referrer-Policy
# -
# - The HTTP referer (originally a misspelling of referrer[1]) is an HTTP header
# - field that identifies the address of the webpage (i.e. the URI or IRI) that
# - linked to the resource being requested. By checking the referrer, the new
# - The HTTP referer (originally a misspelling of referrer[1]) is an HTTP header
# - field that identifies the address of the webpage (i.e. the URI or IRI) that
# - linked to the resource being requested. By checking the referrer, the new
# - webpage can see where the request originated.
# -
Header set Referrer-Policy "strict-origin-when-cross-origin"
@@ -1889,7 +1889,7 @@ fi
echononl "\tCreate system user '$VACATION_USER'"
if ! grep -q "$VACATION_USER" /etc/passwd > /dev/null 2>&1 ; then
adduser --system --home /var/spool/vacation --no-create-home --uid 65501 --gid 65501 --shell /usr/sbin/nologin $VACATION_USER > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat $log_file)"
@@ -1960,7 +1960,7 @@ fi
# -
#echononl "\tWorkaround, because encoding does not work as exspected."
## - Vacation script changed. Since Version 3.2 we need another perl regexp.
## - The old one was:
## - The old one was:
## - perl -i -n -p -e "s/(\s*\'ctype\'\s* =>\s*)\'text\/plain.*$/\1\'text\/plain; charset=iso-8859-1\',/" \
## -
##perl -i -n -p -e "s/(\s*\'Content-Type\'\s* =>\s*)\"text\/plain.*$/\1\"text\/plain; charset=iso-8859-1\",/" \
@@ -1995,7 +1995,7 @@ fi
# - /etc/mail/postfixadmin/vacation.conf
# - /etc/postfixadmin/vacation.conf
# -
# - Instead of changing this script, we put the needed entries
# - Instead of changing this script, we put the needed entries
# - to file /etc/postfixadmin/vacation.conf:
# -
echononl "\tCreate directory '/etc/postfixadmin' "
@@ -2101,15 +2101,15 @@ fi
# - Create an entry in /etc/hosts for the (non-existant domain)
# - $AUTOREPLY_HOSTNAME
# -
# - $AUTOREPLY_HOSTNAME
# -
# - add:
# -
# - 127.0.0.1 $AUTOREPLY_HOSTNAME
# -
echononl "\tCreate entry in /etc/hosts for '$AUTOREPLY_HOSTNAME'"
if ! grep -q "$AUTOREPLY_HOSTNAME" /etc/hosts > $log_file 2>&1 ; then
perl -i -n -p -e"s#(^\s*127.0.0.1\s+localhost.*)#\1\n\n127.0.0.1 ${AUTOREPLY_HOSTNAME}#" /etc/hosts > $log_file 2>&1
perl -i -n -p -e"s#(^\s*127.0.0.1\s+localhost.*)#\1\n\n127.0.0.1 ${AUTOREPLY_HOSTNAME}#" /etc/hosts > $log_file 2>&1
if [[ $? -eq 0 ]] ; then
echo_ok
else
@@ -2120,7 +2120,7 @@ else
echo_skipped
fi
# - Define the transport type in the Postfix master file
# - Define the transport type in the Postfix master file
# - /etc/postfix/master.cf
# -
# - vacation unix - n n - - pipe
@@ -2208,15 +2208,18 @@ fi
echo -e "\n\n\t\033[37m\033[1mConfigure Postfix Admin\033[m\n"
if [[ $MAJOR_VERSION -gt 3 ]] || [[ $MAJOR_VERSION -eq 3 ]] && [[ $MINOR_VERSION -gt 0 ]]; then
if [[ $MAJOR_VERSION -gt 3 ]] ; then
pfa_conf_file="${WEBSITE_BASEDIR}/postfixadmin-${PF_ADMIN_VERSION}/config.local.php"
cp -a "${WEBSITE_BASEDIR}/postfixadmin-${PF_ADMIN_VERSION}/config.inc.php" "$pfa_conf_file"
elif [[ $MAJOR_VERSION -eq 3 ]] && [[ $MINOR_VERSION -gt 0 ]] ; then
pfa_conf_file="${WEBSITE_BASEDIR}/postfixadmin-${PF_ADMIN_VERSION}/config.local.php"
cp -a "${WEBSITE_BASEDIR}/postfixadmin-${PF_ADMIN_VERSION}/config.inc.php" "$pfa_conf_file"
else
pfa_conf_file="${WEBSITE_BASEDIR}/postfixadmin-${PF_ADMIN_VERSION}/config.inc.php"
cp -a "$pfa_conf_file" "${pfa_conf_file}.ORIG"
fi
# - Use 'Re: $SUBJECT' as the default subject template for vacation
# - in postfixadmin
@@ -2277,26 +2280,26 @@ else
fi
> $log_file
perl -i -n -p -e "s#^(\s*\\\$CONF\['default_language'\]\s*=.*)#//!\1\n\\\$CONF['default_language'] = 'de';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['database_type'\]\s*=.*)#//!\1\n\\\$CONF['database_type'] = '$_database_type';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['database_host'\]\s*=.*)#//!\1\n\\\$CONF['database_host'] = 'localhost';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['database_user'\]\s*=.*)#//!\1\n\\\$CONF['database_user'] = '$POSTFIX_DB_USER';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['database_password'\]\s*=.*)#//!\1\n\\\$CONF['database_password'] = '$POSTFIX_DB_PASS';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['database_name'\]\s*=.*)#//!\1\n\\\$CONF['database_name'] = '$POSTFIX_DB_NAME';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['database_prefix'\]\s*=.*)#//!\1\n\\\$CONF['database_prefix'] = '';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['admin_email'\]\s*=.*)#//!\1\n\\\$CONF['admin_email'] = '$WEBMASTER_EMAIL';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['encrypt'\]\s*=.*)#//!\1\n\\\$CONF['encrypt'] = '$ENCRYPTION_METHOD';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
if grep -q -E "^\\\$CONF\['dovecotpw'\]\s*=.*" "$pfa_conf_file" 2> /dev/null ; then
perl -i -n -p -e "s#^(\\\$CONF\['dovecotpw'\]\s*=.*)#//!\1\n\\\$CONF['dovecotpw'] = '$DOVEADM_PW';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
else
cat <<EOF >> $pfa_conf_file
@@ -2335,7 +2338,7 @@ echononl "\tAdjust Postfix Admin's Configuration - Part 2"
_failed=false
> $log_file
perl -i -n -p -e "s#^(\s*\\\$CONF\['default_aliases'\]\s*=.*)#//\n//! 'default_aliases' will be overridden - see end of configfile\n//\n\1#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
cat <<EOF >> $pfa_conf_file 2> $log_file
@@ -2355,10 +2358,10 @@ EOF
perl -i -n -p -e "s#^(\s*\\\$CONF\['language_hook'\]\s*=.*)#//\n//! 'language_hook' will be overridden - see end of configfile\n//\n\1#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['password_validation'\]\s*=.*)#//\n//! 'password_validation' will be overridden - see end of configfile\n//\n\1#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
cat <<EOF >> $pfa_conf_file 2> $log_file
// Password validation
@@ -2384,19 +2387,19 @@ cat <<EOF >> $pfa_conf_file 2> $log_file
);
/*
language_hook example function
language_hook example function
Called if \$CONF['language_hook'] == '<name_of_the_function>'
Allows to add or override \$PALANG interface texts.
If you add new texts, please always prefix them with 'x_' (for example
If you add new texts, please always prefix them with 'x_' (for example
\$PALANG['x_mytext'] = 'foo') to avoid they clash with texts that might be
added to languages/*.lang in future versions of PostfixAdmin.
Please also make sure that all your added texts are included in all
sections - that includes all 'case "XY":' sections and the 'default:'
section (for users that don't have any of the languages specified
in the 'case "XY":' section).
in the 'case "XY":' section).
Usually the 'default:' section should contain english text.
If you modify an existing text/translation, please consider to report it
@@ -2442,23 +2445,23 @@ EOF
perl -i -n -p -e "s#^(\s*\\\$CONF\['domain_path'\]\s*=.*)#//!\1\n\\\$CONF['domain_path'] = 'YES';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['domain_in_mailbox'\]\s*=.*)#//!\1\n\\\$CONF['domain_in_mailbox'] = 'NO';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['aliases'\]\s*=.*)#//!\1\n\\\$CONF['aliases'] = '100';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['mailboxes'\]\s*=.*)#//!\1\n\\\$CONF['mailboxes'] = '100';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['maxquota'\]\s*=.*)#//!\1\n\\\$CONF['maxquota'] = '0';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['domain_quota_default'\]\s*=.*)#//!\1\n\\\$CONF['domain_quota_default'] = '0';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['quota'\]\s*=.*)#//!\1\n\\\$CONF['quota'] = 'YES';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['domain_quota'\]\s*=.*)#//!\1\n\\\$CONF['domain_quota'] = 'YES';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['quota_multiplier'\]\s*=.*)#//!\1\n\\\$CONF['quota_multiplier'] = '1048576';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
if $_failed ; then
echo_failed
error "$(cat $log_file)"
@@ -2536,8 +2539,8 @@ cat <<EOF >> $pfa_conf_file 2> $log_file
// ReplyType options
// If you want to define additional reply options put them in array below.
// The array has the format seconds between replies => $PALANG text
// Special values for seconds are:
// 0 => only reply to the first mail while on vacation
// Special values for seconds are:
// 0 => only reply to the first mail while on vacation
// 1 => reply on every mail
// 60*60*24*7 => Reply if last autoreply was at least a week ago
//
@@ -2570,8 +2573,8 @@ fi
## - EOM;
## -
echononl "\tCreate welcome message.."
if [[ -n "$WELCOME_MESSAGE" ]] ; then
cat <<EOF >> $pfa_conf_file 2> $log_file
if [[ -n "$WELCOME_MESSAGE" ]] ; then
cat <<EOF >> $pfa_conf_file 2> $log_file
// Welcome Message
// This message is send to every newly created mailbox.
@@ -2614,35 +2617,35 @@ echononl "\tAdjust Postfix Admin's Configuration - Part 5"
_failed=false
> $log_file
perl -i -n -p -e "s#^(\s*\\\$CONF\['alias_control_admin'\]\s+=.*)#//!\1\n\\\$CONF['alias_control_admin'] = 'YES';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['alias_control'\]\s*=.*)#//!\1\n\\\$CONF['alias_control'] = 'YES';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['special_alias_control'\]\s*=.*)#//!\1\n\\\$CONF['special_alias_control'] = 'NO';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['backup'\]\s*=.*)#//!\1\n\\\$CONF['backup'] = 'YES';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['fetchmail'\]\s*=.*)#//!\1\n\\\$CONF['fetchmail'] = 'NO';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['user_footer_link'\]\s+=.*)#//!\1\n\\\$CONF['user_footer_link'] = 'https://${WEBSITE_NAME}/main.php';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['footer_text'\]\s+=.*)#//!\1\n\\\$CONF['footer_text'] = 'Main Menu';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['footer_link'\]\s+=.*)#//!\1\n\\\$CONF['footer_link'] = 'http://${WEBSITE_NAME}/main.php';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['emailcheck_resolve_domain'\]\s*=.*)#//!\1\n\\\$CONF['emailcheck_resolve_domain'] = 'NO';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['show_status'\]\s*=.*)#//!\1\n\\\$CONF['show_status'] = 'YES';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['show_status_key'\]\s*=.*)#//!\1\n\\\$CONF['show_status_key'] = 'YES';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['show_undeliverable'\]\s*=.*)#//!\1\n\\\$CONF['show_undeliverable'] = 'NO';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['show_popimap'\]\s*=.*)#//!\1\n\\\$CONF['show_popimap'] = 'NO';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['used_quotas'\]\s*=.*)#//!\1\n\\\$CONF['used_quotas'] = 'NO';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['new_quota_table'\]\s*=.*)#//!\1\n\\\$CONF['new_quota_table'] = 'YES';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
$pfa_conf_file >> $log_file 2>&1 || _failed=true
if $_failed ; then
echo_failed
error "$(cat $log_file)"
@@ -2675,7 +2678,7 @@ fi
# - $CONF['configured'] = true;
echononl "\tSet '\$CONF['configured'] = true'"
perl -i -n -p -e "s#^(\s*\\\$CONF\['configured'\]\s*=.*)#//!\1\n\\\$CONF['configured'] = true;#" \
$pfa_conf_file > $log_file 2>&1
$pfa_conf_file > $log_file 2>&1
if [[ $? -eq 0 ]] ; then
echo_ok
else
@@ -2736,7 +2739,7 @@ echo ""
# - AFTER DELETION MAILBOX
# -
# -
# - activate script for moving a mailbox from the mailboxdirectory
# - and save it to the backupb directory /var/deleted-maildirs
# -
@@ -2745,7 +2748,7 @@ echononl "\tCreate folder '${DELETED_MAILBOX_DIR}"
if [[ ! -d "${DELETED_MAILBOX_DIR}" ]] ; then
mkdir $DELETED_MAILBOX_DIR > $log_file 2>&1
if [[ $? -eq 0 ]] ; then
echo_ok
echo_ok
else
echo_failed
error "$(cat $log_file)"
@@ -2799,11 +2802,11 @@ else
fi
# - Change the posdeletion scripts to your needs:
# -
# -
# - set:
# - basedir=/var/vmail
# - trashbase=$DELETED_MAILBOX_DIR
# -
# -
# - trashdir="${trashbase}/$2/`date +%F_$H-%M`_${subdir}"
# -
echononl "\tAdjust 'postfixadmin-mailbox-postdeletion.sh'"
@@ -2825,9 +2828,9 @@ fi
# - Edit ${WEBSITE_BASEDIR}/htdocs/config.inc.php
# -
# - in section add line
# - in section add line
# - $CONF['mailbox_postdeletion_script']='sudo -u vmail /usr/local/bin/postfixadmin-mailbox-postdeletion.sh';
# -
# -
echononl "\tAdjust 'config.inc.php' to make script available"
perl -i -n -p -e "s#^(\s*[/*]?\s*\\\$CONF\['mailbox_postdeletion_script'\]\s*=.*)#//!\1\n\\\$CONF['mailbox_postdeletion_script'] = 'sudo -u vmail /usr/local/bin/postfixadmin-mailbox-postdeletion.sh';#" \
$pfa_conf_file > $log_file 2>&1
@@ -2890,7 +2893,7 @@ fi
# - AFTER DELETION MAILDOMIAN
# -
# -
# - activate script for moving a mailbox from the mailboxdirectory
# - and save it to the backupb directory $DELETED_DOMAINS_DIR
# -
@@ -2899,7 +2902,7 @@ echononl "\tCreate folder '${DELETED_DOMAINS_DIR}"
if [[ ! -d "${DELETED_DOMAINS_DIR}" ]] ; then
mkdir $DELETED_DOMAINS_DIR > $log_file 2>&1
if [[ $? -eq 0 ]] ; then
echo_ok
echo_ok
else
echo_failed
error "$(cat $log_file)"
@@ -2956,11 +2959,11 @@ fi
# - Change the posdeletion scripts to your needs:
# -
# -
# - set:
# - basedir=/var/vmail
# - trashbase=$DELETED_DOMAINS_DIR
# -
# -
# - trashdir="${trashbase}/`date +%F_%H-%M`_$1"
# -
echononl "\tAdjust 'postfixadmin-domain-postdeletion.sh'"
@@ -2981,9 +2984,9 @@ fi
# - edit ${WEBSITE_BASEDIR}/htdocs/config.inc.php
# -
# - in section add line
# - in section add line
# - $CONF['domain_postdeletion_script']='sudo -u vmail /usr/local/bin/postfixadmin-domain-postdeletion.sh';
# -
# -
echononl "\tAdjust 'config.inc.php' to make script available"
perl -i -n -p -e "s#^(\s*[/*]?\s*\\\$CONF\['domain_postdeletion_script'\]\s*=.*)#//!\1\n\\\$CONF['domain_postdeletion_script'] = 'sudo -u vmail /usr/local/bin/postfixadmin-domain-postdeletion.sh';#" \
$pfa_conf_file >> $log_file 2>&1
@@ -3050,9 +3053,9 @@ fi
## - specified database.
## -
## - Now you have to setup Postfix to recognize all these entries. To do so,
## - you must specify database requests (in different files) and load them
## - you must specify database requests (in different files) and load them
## - into Postfix configuration. In particular that are the following files:
## -
## -
## - pgsql_relay-domain-maps.cf
## - pgsql_sender_login_maps.cf
## - pgsql_transport_maps.cf
@@ -3494,7 +3497,7 @@ echononl "\tCreate file '/etc/postfix/${POSTFIX_DB_TYPE}_virtual_alias_address_r
if [ "$POSTFIX_DB_TYPE" = "pgsql" ]; then
cat <<EOF > /etc/postfix/${POSTFIX_DB_TYPE}_virtual_alias_address_rewriting.cf
## - this address rewriting acts as address extension
## - this address rewriting acts as address extension
## - with delimeter "-"
## -
hosts = $POSTFIX_DB_HOST_PGSQL
@@ -3686,14 +3689,14 @@ info "Browse to \033[1mhttps://${WEBSITE_NAME}/setup.php\033[m to create a 'setu
\t Instructions on how to do this are pointed out at the setup site, maybe like this:
\t - Generate setup_password hash and set \033[1m$CONF['setup_password']\033[m
\t - Generate setup_password hash and set \033[1m$CONF['setup_password']\033[m
\t in file \033[1mconfig.local.php\033[m as printed out.
\t - Browse to \033[1mhttp://${WEBSITE_NAME}/setup.php\033[m once again to update
\t the database
\t Browse to \033[1mhttp://${WEBSITE_NAME}\033[m and login using an existent admin account
\t Browse to \033[1mhttp://${WEBSITE_NAME}\033[m and login using an existent admin account
\t[ \033[33m\033[1mNotice\033[m ]: \033[1mScroll back to see if all seems to be fine!\033[m
@@ -3747,7 +3750,7 @@ dbname = postfix
query = SELECT quota FROM mailbox WHERE username='%s' AND active = true
EOF
## - add configuration parameter virtual_mailbox_limit_maps
## - add configuration parameter virtual_mailbox_limit_maps
## - in Postfix /etc/postfix/main.cf
## -
## - add: