<commit_before>#!/bin/sh

if [ -z "$DOMAIN" ]; then
    echo "DOMAIN environment variable is required"
    exit 1
fi

if [ -z "$SELECTOR" ]; then
    echo "DOMAIN environment variable is required"
    exit 1
fi

if [ -z "$MAILNAME" ]; then
    MAILNAME="dkim_${SELECTOR}.${DOMAIN}"
fi

cat >> /etc/opendkim.conf <<EOF
UMask                   002
Syslog                  yes
SyslogSuccess           yes
LogWhy                  yes

Canonicalization        relaxed/simple

Domain                  ${DOMAIN}
Selector                ${SELECTOR}
KeyFile                 /etc/dkim.key

Mode                    sv
SignatureAlgorithm      rsa-sha256

# Always oversign From (sign using actual From and a null From to prevent
# malicious signatures header fields (From and/or others) between the signer
# and the verifier.  From is oversigned by default in the Debian pacakge
# because it is often the identity key used by reputation systems and thus
# somewhat security sensitive.
OversignHeaders     From

# Make our self available
Socket                  inet:12301
EOF
cat >> /etc/default/opendkim <<EOF
SOCKET="inet:12301"
EOF

ETCD_PORT=${ETCD_PORT:-4001}
HOST_IP=${HOST_IP:-172.17.42.1}
ETCD=$HOST_IP:$ETCD_PORT

#echo "waiting for confd to create primary configuration files"
#until /opt/confd -onetime -node $ETCD; do
#     sleep 1s
# done

# /opt/confd -watch -node $ETCD &
# echo "confd is now monitoring for changes in primary configuration files..."

echo "waiting for confd to create initial DKIM key"
until /opt/confd -onetime -node $ETCD -prefix "/services/dkim/$DOMAIN/$SELECTOR" -confdir /opt/confd-dkim; do
    sleep 1s
done

/opt/confd -watch -node $ETCD -prefix "/services/dkim/$DOMAIN/$SELECTOR" -confdir /opt/confd-dkim &
echo "confd is now monitoring DKIM key for changes..."


exec /usr/sbin/opendkim -f
<commit_msg>Remove MAILNAME references from start.sh<commit_after>#!/bin/sh

if [ -z "$DOMAIN" ]; then
    echo "DOMAIN environment variable is required"
    exit 1
fi

if [ -z "$SELECTOR" ]; then
    echo "DOMAIN environment variable is required"
    exit 1
fi

cat >> /etc/opendkim.conf <<EOF
UMask                   002
Syslog                  yes
SyslogSuccess           yes
LogWhy                  yes

Canonicalization        relaxed/simple

Domain                  ${DOMAIN}
Selector                ${SELECTOR}
KeyFile                 /etc/dkim.key

Mode                    sv
SignatureAlgorithm      rsa-sha256

# Always oversign From (sign using actual From and a null From to prevent
# malicious signatures header fields (From and/or others) between the signer
# and the verifier.  From is oversigned by default in the Debian pacakge
# because it is often the identity key used by reputation systems and thus
# somewhat security sensitive.
OversignHeaders     From

# Make our self available
Socket                  inet:12301
EOF
cat >> /etc/default/opendkim <<EOF
SOCKET="inet:12301"
EOF

ETCD_PORT=${ETCD_PORT:-4001}
HOST_IP=${HOST_IP:-172.17.42.1}
ETCD=$HOST_IP:$ETCD_PORT

#echo "waiting for confd to create primary configuration files"
#until /opt/confd -onetime -node $ETCD; do
#     sleep 1s
# done

# /opt/confd -watch -node $ETCD &
# echo "confd is now monitoring for changes in primary configuration files..."

echo "waiting for confd to create initial DKIM key"
until /opt/confd -onetime -node $ETCD -prefix "/services/dkim/$DOMAIN/$SELECTOR" -confdir /opt/confd-dkim; do
    sleep 1s
done

/opt/confd -watch -node $ETCD -prefix "/services/dkim/$DOMAIN/$SELECTOR" -confdir /opt/confd-dkim &
echo "confd is now monitoring DKIM key for changes..."


exec /usr/sbin/opendkim -f

{'fraction_non_alphanumeric': 0.09344760851534421, 'fraction_numerical': 0.017694221730716064, 'mean_word_length': 2.688073394495413, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '2663396', 'n_tokens_mistral': 1174, 'n_tokens_neox': 1108, 'n_words': 396}