Postfix: Unterschied zwischen den Versionen

Aus Info-Theke
Zur Navigation springen Zur Suche springen
Zeile 8: Zeile 8:
= DKIM =
= DKIM =
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
apt install opendkim
apt install opendkim opendkim-tools
mkdir /etc/opendkim
mkdir /etc/opendkim/keys
chown -R opendkim:opendkim /etc/opendkim
chmod go-rw /etc/opendkim/keys
</syntaxhighlight>
* /etc/opendkim.conf
<pre>
# Folgendes aktivieren durch Kommentar entfernen
Mode sv
InternalHosts          refile:/etc/opendkim/trusted
ExternalIgnoreList      refile:/etc/opendkim/trusted
SigningTable            refile:/etc/opendkim/signing.table
KeyTable                /etc/opendkim/key.table     
# Selektor als Zeitangabe:
Selector                20230603
Domain hamatoma.de
 
# Neu ans Ende:
RequireSafeKeys False
</pre>
 
* /etc/opendkim/trusted
<pre>
127.0.0.1
::1
localhost
hamatoma.de
f-r-e-i.de
bug.hamatoma.de
</pre>
 
* /etc/openkim/signing.table. Schlüsselname: bug
<pre>
*@hamatoma.de bug
</pre>
* /etc/opendkim/key.table
<pre>
bug hamatoma.de:20230603:/etc/opendkim/keys/bug.private
</pre>
 
* Schlüssel generieren:
<syntaxhighlight lang="bash">
cd /etc/opendkim/keys
opendkim-genkey -d hamatoma.de -b 2048 -r -s 20230603
mv 20230603.key bug.key
mv 20230603.txt bug.txt
</syntaxhighlight>
</syntaxhighlight>



Version vom 3. Juni 2023, 17:19 Uhr


Vorarbeiten

  • Domain einrichten, z.B. "dromedar.hamatoma.de"
  • DNS-PTR-Record der IP-Adresse auf dromedar.hamatoma.de setzen
  • Hostname auf "dromedar.hamatoma.de" setzen

DKIM

apt install opendkim opendkim-tools
mkdir /etc/opendkim
mkdir /etc/opendkim/keys
chown -R opendkim:opendkim /etc/opendkim
chmod go-rw /etc/opendkim/keys
  • /etc/opendkim.conf
# Folgendes aktivieren durch Kommentar entfernen
Mode sv
InternalHosts           refile:/etc/opendkim/trusted
ExternalIgnoreList      refile:/etc/opendkim/trusted
SigningTable            refile:/etc/opendkim/signing.table
KeyTable                /etc/opendkim/key.table       
# Selektor als Zeitangabe:
Selector                20230603
Domain hamatoma.de

# Neu ans Ende:
RequireSafeKeys False
  • /etc/opendkim/trusted
127.0.0.1
::1
localhost
hamatoma.de
f-r-e-i.de
bug.hamatoma.de
  • /etc/openkim/signing.table. Schlüsselname: bug
*@hamatoma.de bug
  • /etc/opendkim/key.table
bug hamatoma.de:20230603:/etc/opendkim/keys/bug.private
  • Schlüssel generieren:
cd /etc/opendkim/keys
opendkim-genkey -d hamatoma.de -b 2048 -r -s 20230603
mv 20230603.key bug.key
mv 20230603.txt bug.txt

Installation

apt install postfix
# "Internet-Site" wählen

Konfiguration

  • Minimalkonfiguration für Weiterleitung: /etc/postfix/main.cf
...
mydestination = $myhostname, localhost.hamatoma.de, localhost, hamatoma.de
...
# == wk config:
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination

# Format maildir (statt mailbox):
home_mailbox = Maildir/

virtual_alias_maps = hash:/etc/postfix/virtual
virtual_alias_domains = f-r-e-i.de
  • Aktivierung mit "postmap /etc/postfix/virtual"
  • /etc/aliases
# /etc/aliases
# See man 5 aliases for format
postmaster:    root
devnull: /dev/null
mailer-daemon: postmaster
webmaster: root
www: root
security: root

# Weiterleitung an externe Adresse:
root: hamatoma@gmx.de
  • Aktivieren:
newaliases
  • /etc/postfix/virtual
  • Aktivierung mit "postmap /etc/postfix/virtual"
hm hm.neutral@gmx.de
@hamatoma.de jonny@example.com
# Blacklist:
zimmer2@hm.f-r-e-i.de	devnull