Go to file
2024-03-22 01:54:45 +01:00
BAK Backup current version of 'upgrade_roundcube.sh' script. 2019-05-29 02:16:10 +02:00
conf install_amavis.sh: fix error in writing 'master.cf' in case of SASL AUTH enabled. 2023-11-21 21:03:14 +01:00
DOC Add 'README.postfwd-example.conf', a slightly more extensive configuration for the Postfix firewall. 2023-01-02 13:27:26 +01:00
helpers Add some helper scripts. 2018-12-06 15:00:30 +01:00
.gitignore Add Documentation /README files) for dovecot. 2018-10-22 15:03:46 +02:00
convert_dovecot_pfa_password.sh Some changes on script output. 2017-10-30 17:30:56 +01:00
create-update-postfix-pcre-chek-files.sh create-update-postfix-pcre-chek-files.sh: some monor changes at script output. 2021-06-27 17:13:42 +02:00
dovecot_convert_to_lmtp.sh dovecot_convert_to_lmtp.sh,install_update_dovecot.sh: fix error in changing to lmtp service.. 2021-04-25 17:12:47 +02:00
install_all_needed_resources.sh Add script to install all needed debian packages and perl modules. Usefull after upgrading the Operating System (OS). 2017-11-24 16:57:22 +01:00
install_amavis.sh install_amavis.sh: fix error on data input. 2023-12-08 18:09:12 +01:00
install_opendkim.sh Initial commit - merge old projekts 'amavisd-new/', 'dovecot/', 'postfix', 'postfixadmin' and 'roundcube'. 2017-10-22 12:11:03 +02:00
install_opendmarc.sh install_opendmarc.sh: change loaction of 'HistoryFile' and also the pid file. 2021-04-29 19:49:51 +02:00
install_perl_modules_mailserver.sh Add script 'install_perl_modules_mailserver.sh'. 2018-05-08 02:25:44 +02:00
install_postfix_advanced.sh install_postfix_advanced.sh: add support for allowing extra hosts (ip-addresses) for relaying. 2024-03-22 01:54:45 +01:00
install_postfix_base.sh install_postfix_base.sh: change function dectec_os to dectect_os_1. 2023-11-15 18:36:51 +01:00
install_postfixadmin.sh install_postfixadmin.sh: change '$CONF['password_expiration']' to 'NO'. 2024-01-03 22:37:41 +01:00
install_postfwd.sh Add Readme file adn comments for/in postfwd2 resources. 2022-09-17 12:56:45 +02:00
install_roundcube.sh install_roundcube.sh: change location of php-socket to directory '/run/php/'. 2023-12-08 23:57:00 +01:00
install_schleuder3.sh Add template for 'install_schleuder3.sh'. At time, noting is implemented! 2018-04-30 03:09:34 +02:00
install_update_dovecot.sh install_update_dovecot.sh: creating DH parameter changes if debian version is 12 or above. 2023-12-08 18:53:30 +01:00
install_vacation.sh Add script 'install_vacation.sh'. 2019-10-14 00:22:45 +02:00
README.debian_packages Add script to install all needed debian packages and perl modules. Usefull after upgrading the Operating System (OS). 2017-11-24 16:57:22 +01:00
README.disable-smpt-auth-25 Add Readme 'force-ssl' and 'diasble smtp-auth on port 25'. 2018-05-01 15:20:35 +02:00
README.dovecot.systemd Initial commit - merge old projekts 'amavisd-new/', 'dovecot/', 'postfix', 'postfixadmin' and 'roundcube'. 2017-10-22 12:11:03 +02:00
README.force-ssl Add Readme 'force-ssl' and 'diasble smtp-auth on port 25'. 2018-05-01 15:20:35 +02:00
README.install New installation script for OpenDMARC: 'install_opendmarc.sh'. 2021-04-29 16:54:35 +02:00
README.perl_modules Add script to install all needed debian packages and perl modules. Usefull after upgrading the Operating System (OS). 2017-11-24 16:57:22 +01:00
README.smtp-over-tor-hidden-services add 'README.smtp-over-tor-hidden-services'. 2023-04-27 00:02:13 +02:00
README.smtpd-restrictons add README.smtpd-restrictons 2018-11-29 14:00:27 +01:00
README.virtual-do-not-reply README.virtual-do-not-reply: minor changes. 2024-02-28 18:28:08 +01:00
update_clamav-unofficial-sigs.sh Add script 'update_clamav-unofficial-sigs.sh'. 2022-10-26 18:15:40 +02:00
update_postfix_dh_parameters.sh update_postfix_dh_parameters.sh: change function dectec_os to dectect_os_1. 2023-11-15 18:35:48 +01:00
upgrade_roundcube.sh upgrade_roundcube.sh: fix error using internal field separator IFS. 2024-03-17 18:34:07 +01:00
vacation.pl.pfa-3.1 Add 'vacation.pl.pfa-3.1'. Notice: vacation script from postfixadmin version 3.2 does NOT work. 2018-07-04 22:48:54 +02:00

# ====================
# Forward E-Mails to 'do-not-reply@..' address to (file) /dev/null
# ====================

# ---
# Example for this readme:
#
# Create a forwarding to /dev/null for the address no-reply@cloud-01.oopen.de
# ---

DOMAIN=""cloud-01.oopen.de
E_MAIL="no-reply@cloud-01.oopen.de"

# see also:
#     https://www.postfix.org/VIRTUAL_README.html
#
#     https://think.unblog.ch/weiterleiten-von-postfix-alias-an-dev-null/
#     https://think.unblog.ch/en/forward-postfix-alias-to-dev-null/
#
#     https://www.serverwatch.com/guides/forwarding-a-postfix-virtual-alias-to-dev-null/


# Notice:
#     the usual solution is to forward to (file) /dev/null. In a local-only setup you could do 
#     that in /etc/aliases.
#
#     However, if your're using Postfix virtual domains, it gets a little more complicated. With 
#     virtual domains/users, you can't forward mail to a file (like /dev/null). 


# ---
# 1. Set up an alias user 'do-not-reply'that forwards incoming e-mails to /dev/null.
# ---

# Add to file '/etc/aliases' a line like:
#     do-not-reply: /dev/null

if ! $(grep -q -E "^\s*do-not-reply:" /etc/aliases 2>/devnull) ; then
   cat <<EOF >> /etc/aliases

do-not-reply: /dev/null
EOF
fi

# Renew alias database:
#
newaliases


# ---
# 2. Set up the domain (domain part of not-reply address)
# ---

# Create file '/etc/postfix/virtual_alias_domains' and add your domain '@cloud-01.oopen.de'
#
#  ${DOMAIN}         OK
#
if [[ ! -f "/etc/postfix/virtual_alias_domains" ]] ; then

   cat <<EOF >> /etc/postfix/virtual_alias_domains
# - File: /etc/postfix/virtual_alias_domains
# -
# - Note:
# -  a mapping file always has two columns. In such a 'one-dimensional' mapping (list of domains) 
# -  Postfix does not care about your second column. It does not even have to be 'OK', it can be
# -  anything.
# -
# - Example:
# -      <domain>            OK

${DOMAIN}    OK
EOF
else
   if ! $(grep -q -E "^\s*${DOMAIN}" /etc/postfix/virtual_alias_domains 2> /dev/null) ; then
      cat <<EOF >> /etc/postfix/virtual_alias_domains

${DOMAIN}    OK
EOF
   fi
fi


# Create Postfix lookup table (database file) from '/etc/postfix/virtual_alias_domains'
#
postmap btree:/etc/postfix/virtual_alias_domains


# Add virtual_alias_domains to Postfix main Configuration
#
#  ...
#  virtual_alias_domains =
#     btree:/etc/postfix/virtual_alias_domains
#  ...
#
if ! $(grep -q -E "^\s*virtual_alias_domains\s*=\s*btree:/etc/postfix/virtual_alias_domains" /etc/postfix/main.cf) \
      && ! $(grep -q -E "^\s*btree:/etc/postfix/virtual_alias_domains" /etc/postfix/main.cf); then
   perl -i -n -p -e "s#^(\s*virtual_alias_domains\s*=.*)#\1\n   btree:/etc/postfix/virtual_alias_domains#" /etc/postfix/main.cf
fi



# ---
# 3. Set up adress mapping
# ---

# - Create file '/etc/postfix/virtual_alias_maps' and add your address mapping
# -
# -      ${E_MAIL}         do-not-reply
# -
if [[ ! -f "/etc/postfix/virtual_alias_maps" ]] ; then

   cat <<EOF >> /etc/postfix/virtual_alias_maps
# - File: /etc/postfix/virtual_alias_maps
# -
# - Redirect mail for one address to one or more addresses.
# -
# - Example:
# -   # incomming address 'no-reply@cloud-01.oopen.de' to local 'do-not-reply' address
# -   no-reply@cloud-01.oopen.de    do-not-reply
# -

${E_MAIL}      do-not-reply
EOF
else
   if ! $(grep -q -E "^\s*${E_MAIL}" /etc/postfix/virtual_alias_maps 2> /dev/null) ; then
      cat <<EOF >> /etc/postfix/virtual_alias_maps

${E_MAIL}      do-not-reply
EOF
   fi
fi


# Create Postfix lookup table (database file) from '/etc/postfix/virtual_alias_maps'
#
postmap btree:/etc/postfix/virtual_alias_maps




# Add virtual_alias_maps to Postfix main Configuration
#
#  ...
#  virtual_alias_maps =
#     btree:/etc/postfix/virtual_alias_maps
#  ...
#
if ! $(grep -q -E "^\s*virtual_alias_maps\s*=\s*btree:/etc/postfix/virtual_alias_maps" /etc/postfix/main.cf) \
      && ! $(grep -q -E "^\s*btree:/etc/postfix/virtual_alias_maps" /etc/postfix/main.cf); then
   perl -i -n -p -e "s#^(\s*virtual_alias_maps\s*=.*)#\1\n   btree:/etc/postfix/virtual_alias_maps#" /etc/postfix/main.cf
fi


# ---
# 4. Reload Postfix
# ---

systemctl reload postfix