<commit_before>#!/bin/bash

# Disable SMTPUTF8, because libraries (ICU) are missing in alpine
postconf -e smtputf8_enable=no

# Update aliases database. It's not used, but postfix complains if the .db file is missing
postalias /etc/postfix/aliases

# Disable local mail delivery
postconf -e mydestination=
# Don't relay for any domains
postconf -e relay_domains=

# Reject invalid HELOs
postconf -e smtpd_delay_reject=yes
postconf -e smtpd_helo_required=yes
postconf -e "smtpd_helo_restrictions=permit_mynetworks,reject_invalid_helo_hostname,permit"

# Set up host name
if [[ ! -z "$HOSTNAME" ]]; then
	postconf -e myhostname=$HOSTNAME
else
	postconf -# myhostname
fi

# Set up a relay host, if needed
if [[ ! -z "$RELAYHOST" ]]; then
	postconf -e relayhost=$RELAYHOST
else
	postconf -# relayhost
fi

# Set up my networks to list only networks in the local loopback range
#network_table=/etc/postfix/network_table
#touch $network_table
#echo "127.0.0.0/8    any_value" >  $network_table
#echo "10.0.0.0/8     any_value" >> $network_table
#echo "172.16.0.0/12  any_value" >> $network_table
#echo "192.168.0.0/16 any_value" >> $network_table
## Ignore IPv6 for now
##echo "fd00::/8" >> $network_table
#postmap $network_table
#postconf -e mynetworks=hash:$network_table

if [[ ! -z "$MYNETWORKS" ]]; then
        postconf -e relayhost=$MYNETWORKS
else
        postconf -e "mynetworks=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
fi

# Split with space
if [[ ! -z "$ALLOWED_SENDER_DOMAINS" ]]; then
	echo "Setting up allowed SENDER domains:"
	allowed_senders=/etc/postfix/allowed_senders
	rm -f $allowed_senders $allowed_senders.db > /dev/null
	touch $allowed_senders
	for i in $ALLOWED_SENDER_DOMAINS; do<commit_msg>Fixed issue where relayhost was set instead of mynetworks. (#3)<commit_after>#!/bin/bash

# Disable SMTPUTF8, because libraries (ICU) are missing in alpine
postconf -e smtputf8_enable=no

# Update aliases database. It's not used, but postfix complains if the .db file is missing
postalias /etc/postfix/aliases

# Disable local mail delivery
postconf -e mydestination=
# Don't relay for any domains
postconf -e relay_domains=

# Reject invalid HELOs
postconf -e smtpd_delay_reject=yes
postconf -e smtpd_helo_required=yes
postconf -e "smtpd_helo_restrictions=permit_mynetworks,reject_invalid_helo_hostname,permit"

# Set up host name
if [[ ! -z "$HOSTNAME" ]]; then
	postconf -e myhostname=$HOSTNAME
else
	postconf -# myhostname
fi

# Set up a relay host, if needed
if [[ ! -z "$RELAYHOST" ]]; then
	postconf -e relayhost=$RELAYHOST
else
	postconf -# relayhost
fi

# Set up my networks to list only networks in the local loopback range
#network_table=/etc/postfix/network_table
#touch $network_table
#echo "127.0.0.0/8    any_value" >  $network_table
#echo "10.0.0.0/8     any_value" >> $network_table
#echo "172.16.0.0/12  any_value" >> $network_table
#echo "192.168.0.0/16 any_value" >> $network_table
## Ignore IPv6 for now
##echo "fd00::/8" >> $network_table
#postmap $network_table
#postconf -e mynetworks=hash:$network_table

if [[ ! -z "$MYNETWORKS" ]]; then
        postconf -e mynetworks=$MYNETWORKS
else
        postconf -e "mynetworks=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
fi

# Split with space
if [[ ! -z "$ALLOWED_SENDER_DOMAINS" ]]; then
	echo "Setting up allowed SENDER domains:"
	allowed_senders=/etc/postfix/allowed_senders
	rm -f $allowed_senders $allowed_senders.db > /dev/null
	touch $allowed_senders
	for i in $ALLOWED_SENDER_DOMAINS; do
{'fraction_non_alphanumeric': 0.11680503864872602, 'fraction_numerical': 0.040366447180074434, 'mean_word_length': 4.519747235387046, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 16, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2515133', 'n_tokens_mistral': 1390, 'n_tokens_neox': 1317, 'n_words': 352}