Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
centos:mail_c7:dovecot_3 [04.08.2014 21:34. ] – [20-managesieve.conf] djangocentos:mail_c7:dovecot_3 [12.03.2024 12:31. ] (aktuell) – [Installation] typofixing django
Zeile 1: Zeile 1:
 ====== Dovecot, Nachrichten auf dem Server mit SIEVE filtern ====== ====== Dovecot, Nachrichten auf dem Server mit SIEVE filtern ======
-{{:centos:mail_c7:dovecot_logo.png?nolink&225 |Dovecot-Logo}} Zur Filtern von E-Mails auf IMAP-Servern wurde die Programmiersprache **SIEVE** konzipiert - die genaue Spezifikationen erfolgten hierzu im RFC 5228 und vielen Erweiterungen/Ergänzungen in weiteen **RFC**s. Das Hauptaugenmerk von **SIEVE** liegt auf Einfachheit, Erweiterbarkeit, sowie auf Unabhängigkeit von der verwendeten Zugriffsart und Architektur wie auch dem verwendeten Betriebssystem. Sieve wurde spezifiziert, um den Usern die Möglichkeit zu beiten, bereits serverseitig auf einfache Art und Weise eigene Regeln zur Filterung von E-Mails zu definieren. Sieve-Scripte werden bereits während der Zustellung der eMail am IMAP-Server ausgeführt.+{{:centos:mail_c7:dovecot-pigeonhole-logo.png?nolink&182 |BILD: Dovecot Pigeonhole Logo}}  
 +Zur Filtern von E-Mails auf IMAP-Servern wurde die Programmiersprache **SIEVE** konzipiert - die genaue Spezifikationen erfolgten hierzu im RFC 5228 und vielen Erweiterungen/Ergänzungen in weiteren **RFC**s. Das Hauptaugenmerk von **SIEVE** liegt auf Einfachheit, Erweiterbarkeit, sowie auf Unabhängigkeit von der verwendeten Zugriffsart und Architektur wie auch dem verwendeten Betriebssystem. Sieve wurde spezifiziert, um den Usern die Möglichkeit zu bieten, bereits serverseitig auf einfache Art und Weise eigene Regeln zur Filterung von E-Mails zu definieren. Sieve-Scripte werden bereits während der Zustellung der eMail am IMAP-Server ausgeführt.
  
 Weitere Hintergrundinformationen finden man unter anderem in dem [[http://de.wikipedia.org/wiki/Sieve|Wikipedia-Artikel zu SIEVE]]. Weitere Hintergrundinformationen finden man unter anderem in dem [[http://de.wikipedia.org/wiki/Sieve|Wikipedia-Artikel zu SIEVE]].
- +\\
-{{:centos:mail_c7:dovecot-pigeonhole-logo.png?nolink&182 |BILD: Dovecot Pigeonhole Logo}} \\+
 Die Unterstützung und Implementierung von **SIEVE** erfolgt über das Projekt **managesieve** von //Stefan Bosch//. Detaillierte Informationen zum Protokoll **Managesieve** sowie zum RFC 5228 und den zahlreichen Erweiterungen RFCs findet man auf der [[http://pigeonhole.dovecot.org/|Projektseite]] von Stefan Bosch. Die Unterstützung und Implementierung von **SIEVE** erfolgt über das Projekt **managesieve** von //Stefan Bosch//. Detaillierte Informationen zum Protokoll **Managesieve** sowie zum RFC 5228 und den zahlreichen Erweiterungen RFCs findet man auf der [[http://pigeonhole.dovecot.org/|Projektseite]] von Stefan Bosch.
  
 ===== Installation ===== ===== Installation =====
-Am Einfachsten bedienen wir uns zur Installation des Paketes **dovecot-pigeonhole** eines aktuell gepflegten Dovecot-Repositories, wie z.B. dem Repository **[[http://repo.mailserver.guru/7/|mailserver.guru]]**. Das dort enthaltene Paket wurde für den aktuellen Dovecot-release **//2.2.13//**((Stand Juli 2014)) gebaut. Die Intstallation und Integration des **[[http://repo.mailserver.guru/7/|Repositories mailserver.guru]]** ist im Kapitel **[[centos:mailserver.guru|mailserver.guru unter CentOS 6 und CentOS 7 einbinden]]** erklärt.+Am Einfachsten bedienen wir uns zur Installation des Paketes **dovecot-pigeonhole** eines aktuell gepflegten Dovecot-Repositories, wie z.B. dem Repository **[[http://repo.mailserver.guru/7/|mailserver.guru]]**. Das dort enthaltene Paket wurde für den aktuellen Dovecot-release **//2.2.13//**((Stand Juli 2014)) gebaut. Die Installation und Integration des **[[http://repo.mailserver.guru/7/|Repositories mailserver.guru]]** ist im Kapitel **[[centos:mailserver.guru|mailserver.guru unter CentOS 6 und CentOS 7 einbinden]]** erklärt.
  
 Die Installation des Paketes geht dank des Repositories **[[http://repo.mailserver.guru/7/|mailserver.guru]]** leicht von statten, benötigen wir hierzu lediglich den Befehl **yum**. Die Installation des Paketes geht dank des Repositories **[[http://repo.mailserver.guru/7/|mailserver.guru]]** leicht von statten, benötigen wir hierzu lediglich den Befehl **yum**.
Zeile 161: Zeile 161:
  
 ==== 90-sieve-extprograms.conf ==== ==== 90-sieve-extprograms.conf ====
 +Mit Hilfe der Datei //**/etc/dovecot/conf.d/90-sieve-extprograms.conf**// könnte man noch externe Programme einbinden. Da wir aber darauf verzichten, brauchen wir keinerlei Änderungen vornehmen.
 +   # cat /etc/dovecot/conf.d/90-sieve-extprograms.conf
 +<file bash /etc/dovecot/conf.d/90-sieve-extprograms.conf># Sieve Extprograms plugin configuration
 +
 +# Don't forget to add the sieve_extprograms plugin to the sieve_plugins setting.
 +# Also enable the extensions you need (one or more of vnd.dovecot.pipe,
 +# vnd.dovecot.filter and vnd.dovecot.execute) by adding these   to the
 +# sieve_extensions or sieve_global_extensions settings. Restricting these
 +# extensions to a global context using sieve_global_extensions is recommended.
 +
 +plugin {
 +
 +  # The directory where the program sockets are located for the
 +  # vnd.dovecot.pipe, vnd.dovecot.filter and vnd.dovecot.execute extension
 +  # respectively. The name of each unix socket contained in that directory
 +  # directly maps to a program-name referenced from the Sieve script.
 +  #sieve_pipe_socket_dir = sieve-pipe
 +  #sieve_filter_socket_dir = sieve-filter
 +  #sieve_execute_socket_dir = sieve-execute
 +
 +  # The directory where the scripts are located for direct execution by the
 +  # vnd.dovecot.pipe, vnd.dovecot.filter and vnd.dovecot.execute extension
 +  # respectively. The name of each script contained in that directory
 +  # directly maps to a program-name referenced from the Sieve script.
 +  #sieve_pipe_bin_dir = /usr/lib/dovecot/sieve-pipe
 +  #sieve_filter_bin_dir = /usr/lib/dovecot/sieve-filter
 +  #sieve_execute_bin_dir = /usr/lib/dovecot/sieve-execute
 +}
 +
 +# An example program service called 'do-something' to pipe messages to
 +#service do-something {
 +  # Define the executed script as parameter to the sieve service
 +  #executable = script /usr/lib/dovecot/sieve-pipe/do-something.sh
 +
 +  # Use some unprivileged user for executing the program
 +  #user = dovenull
 +
 +  # The unix socket located in the sieve_pipe_socket_dir (as defined in the 
 +  # plugin {} section above)
 +  #unix_listener sieve-pipe/do-something {
 +    # LDA/LMTP must have access
 +  #  user = vmail  
 +  #  mode = 0600
 +  #}
 +#}
 +</file>
  
 ==== 90-sieve.conf ==== ==== 90-sieve.conf ====
 +Die Einstellungen des Sieve-Plugins erfolgen mit Hilfe der Datei //**/etc/dovecot/conf.d/90-sieve.conf**//. Die Standard-Werte dort braucht man in aller Regel nicht abändern, somit begnügen wir uns mit der Ansicht der Datei.
 +   # less /etc/dovecot/conf.d/90-sieve.conf
  
 +<file bash /etc/dovecot/conf.d/90-sieve.conf>##
 +## Settings for the Sieve interpreter
 +##
  
 +# Do not forget to enable the Sieve plugin in 15-lda.conf and 20-lmtp.conf
 +# by adding it to the respective mail_plugins= settings.
 +
 +plugin {
 +  # The path to the user's main active script. If ManageSieve is used, this the
 +  # location of the symbolic link controlled by ManageSieve.
 +  sieve = ~/.dovecot.sieve
 +
 +  # The default Sieve script when the user has none. This is a path to a global
 +  # sieve script file, which gets executed ONLY if user's private Sieve script
 +  # doesn't exist. Be sure to pre-compile this script manually using the sievec
 +  # command line tool.
 +  # --> See sieve_before fore executing scripts before the user's personal
 +  #     script.
 +  #sieve_default = /var/lib/dovecot/sieve/default.sieve
 +
 +  # Directory for :personal include scripts for the include extension. This
 +  # is also where the ManageSieve service stores the user's scripts.
 +  sieve_dir = ~/sieve
 +
 +  # Directory for :global include scripts for the include extension.
 +  #sieve_global_dir =
 +
 +  # Path to a script file or a directory containing script files that need to be
 +  # executed before the user's script. If the path points to a directory, all
 +  # the Sieve scripts contained therein (with the proper .sieve extension) are
 +  # executed. The order of execution within a directory is determined by the
 +  # file names, using a normal 8bit per-character comparison. Multiple script
 +  # file or directory paths can be specified by appending an increasing number.
 +  #sieve_before =
 +  #sieve_before2 =
 +  #sieve_before3 = (etc...)
 +
 +  # Identical to sieve_before, only the specified scripts are executed after the
 +  # user's script (only when keep is still in effect!). Multiple script file or
 +  # directory paths can be specified by appending an increasing number.
 +  #sieve_after =
 +  #sieve_after2 =
 +  #sieve_after2 = (etc...)
 +
 +  # Which Sieve language extensions are available to users. By default, all
 +  # supported extensions are available, except for deprecated extensions or
 +  # those that are still under development. Some system administrators may want
 +  # to disable certain Sieve extensions or enable those that are not available
 +  # by default. This setting can use '+' and '-' to specify differences relative
 +  # to the default. For example `sieve_extensions = +imapflags' will enable the
 +        # deprecated imapflags extension in addition to all extensions were already
 +  # enabled by default.
 +  #sieve_extensions = +notify +imapflags
 +
 +  # Which Sieve language extensions are ONLY available in global scripts. This
 +  # can be used to restrict the use of certain Sieve extensions to administrator
 +  # control, for instance when these extensions can cause security concerns.
 +  # This setting has higher precedence than the `sieve_extensions' setting
 +  # (above), meaning that the extensions enabled with this setting are never
 +  # available to the user's personal script no matter what is specified for the
 +  # `sieve_extensions' setting. The syntax of this setting is similar to the
 +  # `sieve_extensions' setting, with the difference that extensions are
 +  # enabled or disabled for exclusive use in global scripts. Currently, no
 +  # extensions are marked as such by default.
 +  #sieve_global_extensions =
 +
 +  # The Pigeonhole Sieve interpreter can have plugins of its own. Using this
 +  # setting, the used plugins can be specified. Check the Dovecot wiki
 +  # (wiki2.dovecot.org) or the pigeonhole website
 +  # (http://pigeonhole.dovecot.org) for available plugins.
 +        # The sieve_extprograms plugin is included in this release.
 +  #sieve_plugins =
 +
 +  # The separator that is expected between the :user and :detail
 +  # address parts introduced by the subaddress extension. This may
 +  # also be a sequence of characters (e.g. '--'). The current
 +  # implementation looks for the separator from the left of the
 +  # localpart and uses the first one encountered. The :user part is
 +  # left of the separator and the :detail part is right. This setting
 +  # is also used by Dovecot's LMTP service.
 +  #recipient_delimiter = +
 +
 +  # The maximum size of a Sieve script. The compiler will refuse to compile any
 +  # script larger than this limit. If set to 0, no limit on the script size is
 +  # enforced.
 +  #sieve_max_script_size = 1M
 +
 +  # The maximum number of actions that can be performed during a single script
 +  # execution. If set to 0, no limit on the total number of actions is enforced.
 +  #sieve_max_actions = 32
 +
 +  # The maximum number of redirect actions that can be performed during a single
 +  # script execution. If set to 0, no redirect actions are allowed.
 +  #sieve_max_redirects = 4
 +
 +  # The maximum number of personal Sieve scripts a single user can have. If set
 +  # to 0, no limit on the number of scripts is enforced.
 +  # (Currently only relevant for ManageSieve)
 +  #sieve_quota_max_scripts = 0
 +
 +  # The maximum amount of disk storage a single user's scripts may occupy. If
 +  # set to 0, no limit on the used amount of disk storage is enforced.
 +  # (Currently only relevant for ManageSieve)
 +  #sieve_quota_max_storage = 0
 +}
 +</file>
  
 ==== dovecot.conf ==== ==== dovecot.conf ====
Zeile 314: Zeile 467:
 } }
 </file> </file>
 +
 +===== Horde-Framework's Ingo =====
 +Die notwendigen Konfigurationseinstellungen bei der Applikation **[[http://www.horde.org/apps/ingo|ingo]]** ist auf folgenden [[centos:mail_c6:horde_8#konfiguration_des_backend-_imap-server|Seite]] ausführlich beschrieben.
 +===== Paketfilter / Firewall =====
 +Damit unsere Kunden mit Ihren Mailclients Verbindungen zum geöffneten Ports **4190** unseres Dovecot-Server aufbauen können, müssen wir für diese noch Änderungen am Paketfilter **firewalld** vornehmen.
 +   # firewall-cmd --permanent --zone=public --add-port=4190/tcp
 +
 +   success
 +
 +Anschließend können wir den Firewall-Daemon einmal durchstarten und anschließend überprüfen, ob die Regeln auch entsprechend unserer Definition, gezogen haben. 
 +   # firewall-cmd --reload
 +
 +   success
 +
 +Abschließend prüfen wir noch, ob die Erweiterung unseres Paketfilter aktiv ist. 
 +   # iptables -nvL IN_public_allow
 +<code>Chain IN_public_allow (1 references)
 + pkts bytes target     prot opt in     out     source               destination         
 +    0     0 ACCEPT     tcp  --  *      *       10.0.0.80            10.0.0.70            tcp dpt:24 ctstate NEW
 +    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/           0.0.0.0/           tcp dpt:22 ctstate NEW
 +    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/           0.0.0.0/           tcp dpt:110 ctstate NEW
 +    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/           0.0.0.0/           tcp dpt:143 ctstate NEW
 +    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/           0.0.0.0/           tcp dpt:995 ctstate NEW
 +    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/           0.0.0.0/           tcp dpt:4190 ctstate NEW
 +    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/           0.0.0.0/           tcp dpt:993 ctstate NEW
 +</code>
 +
 ===== Aktivierung ==== ===== Aktivierung ====
 +Zum Aktivieren unserer Änderungen starten wir den Daemon nun einmal durch.
 +   # systemctl restart dovecot
 +
 +Im Maillog wurde der Restart entsprechend dokumentiert.
 +   # tail -n4 /var/log/maillog
 +<code>Aug  4 23:41:47 vml000070 dovecot: anvil: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
 +Aug  4 23:41:47 vml000070 dovecot: log: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
 +Aug  4 23:41:47 vml000070 dovecot: master: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
 +Aug  4 23:41:47 vml000070 dovecot: master: Dovecot v2.2.13 starting up for imap, pop3, lmtp, sieve (core dumps disabled)
 +</code>
 +
 +Fragen wir den Serverstatus ab, finden wir nun auch den Dienst **sieve** bei den Protokollen.
 +   # systemctl status dovecot
 +<code>dovecot.service - Dovecot IMAP/POP3 email server
 +   Loaded: loaded (/usr/lib/systemd/system/dovecot.service; disabled)
 +   Active: active (running) since Mon 2014-08-04 23:41:47 CEST; 2min 42s ago
 +  Process: 4156 ExecStartPre=/usr/libexec/dovecot/prestartscript (code=exited, status=0/SUCCESS)
 + Main PID: 4161 (dovecot)
 +   CGroup: /system.slice/dovecot.service
 +           ├─4161 /usr/sbin/dovecot -F
 +           ├─4165 dovecot/anvil [0 connections]
 +           ├─4166 dovecot/log
 +           └─4168 dovecot/config
 +
 +Aug 04 23:41:47 vml000070.dmz.nausch.org systemd[1]: Started Dovecot IMAP/POP3 email server.
 +Aug 04 23:41:47 vml000070.dmz.nausch.org dovecot[4161]: master: Dovecot v2.2.13 starting up for imap, pop3, lmtp, sieve (core dumps disabled)
 +</code>
 +
 +Fragen wir mit **netstat** die geöffneten Ports ab, sehen wir auch dort, dass unser Dovecot-Server nun auch auf Port **4190** bei der IP-Adresse **10.0.0.70** lauscht.
 +   # netstat -tulpen | grep dovecot
 +
 +   tcp        0      0 10.0.0.70:4190          0.0.0.0:              LISTEN      0          44593      4161/dovecot        
 +   tcp        0      0 10.0.0.70:993           0.0.0.0:              LISTEN      0          44656      4161/dovecot        
 +   tcp        0      0 10.0.0.70:995           0.0.0.0:              LISTEN      0          44619      4161/dovecot        
 +   tcp        0      0 10.0.0.70:110           0.0.0.0:              LISTEN      0          44618      4161/dovecot        
 +   tcp        0      0 10.0.0.70:143           0.0.0.0:              LISTEN      0          44655      4161/dovecot        
 +   tcp        0      0 10.0.0.70:24            0.0.0.0:              LISTEN      0          44628      4161/dovecot
  
 ===== Test ===== ===== Test =====
 +Unser ersten Funktionstest werden wir nun mit **SIEVE** via LMTP durchführen. Bei diesem folgenden Test nutzen wir die Authentifikations-Methode **PLAIN**. Die Anmeldedaten müssen dabei zum einen Base64 codiert werden und das Format **"\0<username>\0<password"** (mit **\0** als ASCII **NULL** Zeichen). 
 +   AUTHENTICATE "PLAIN" "<BASE64 codierte Anmeldedaten>"
  
 +Zum Erstellen dieses Anmeldestrings nutzen wir einfach das script **sieve-auth-command.pl** von //Stephan Bosch//.
 +   # vim /usr/local/bin/sieve-auth-command.pl
 +<file perl /usr/local/bin/sieve-auth-command.pl>#!/usr/bin/perl
 +#
 +# sieve-auth-command.pl
 +# ---------------------
 +#
 +# Generates ManageSieve AUTHENTICATE command for manually testing the protocol 
 +# using telnet or gnutls-cli (TLS)
 +#
 +# Usage:
 +#   sieve-auth-command.pl <username> <password>
 +#
 +# Prints the AUTHENTICATE "PLAIN" "<encoded>" command on standard out. 
 +#
 +# --
 +# Stephan Bosch, stephan@rename-it.nl
 +#
  
 +use MIME::Base64;
 +
 +use strict;
 +
 +my $username = shift;
 +my $password = shift;
 +
 +my $userpass = "\x00".$username."\x00".$password."";
 +my $encode=encode_base64($userpass);
 +
 +$encode =~ s/^\s+//;
 +$encode =~ s/\s+$//;
 +
 +print "AUTHENTICATE \"PLAIN\" \"$encode\"\r\n";
 +</file>
 +
 +Um das Script einfach ausführen zu können versehen wir nun noch die Datei-Rechte mit  einem **x**.
 +   # chmod +x /usr/local/bin/sieve-auth-command.pl
 +
 +Für unseren User **django@nausch.org** mit dem Passwort **Dj4n90_d3r_G33k!** erstellen wir nun unseren Anmeldestring.
 +   $ sieve-auth-command.pl django@nausch.org Dj4n90_d3r_G33k!
 +
 +   AUTHENTICATE "PLAIN" "AGRqYW5nb0BuYXVzY2gub3JnAERqNG45MF9kM3JfRzMzayE="
 +
 +Diesen Anmeldestring verwenden wir nun bei unserem ersten Test. Bei diesem SIEVE-Test via **telnet** sind die Eingaben am testenden Client in der Farbe <html><font style="color: rgb(0, 0, 255)">blau</font></html> und die Rückmeldungen unseres Dovecot-Servers in der Farbe <html><font style="color: rgb(0, 255, 0)">grün</font></html> gekennzeichnet. Die Ausgaben des Befehls **telnet** sind in der Farbe <html><font style="color: rgb(0, 0, 0)">schwarz</font></html> eingefärbt.
 +
 +Als erstes bauen wir eine Verbindung zu unserem Dovecot-Server zum **ManageSieve-Port** **4190** auf und melden uns mit unserem zuvor generierten Anmeldestring am Server an.
 +
 +<html><pre class="code">
 +<font style="color: rgb(0, 0, 255)">$ telnet 10.0.0.70 4190</font>
 +<font style="color: rgb(0, 0, 0)">Trying 10.0.0.70...
 +Connected to 10.0.0.70.
 +Escape character is '^]'.</font>
 +<font style="color: rgb(0, 255, 0)">&nbsp;"IMPLEMENTATION" "Dovecot Pigeonhole"
 +&nbsp;"SIEVE" "fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave"
 +&nbsp;"NOTIFY" "mailto"
 +&nbsp;"SASL" "PLAIN LOGIN DIGEST-MD5 CRAM-MD5"
 +&nbsp;"STARTTLS"
 +&nbsp;"VERSION" "1.0"
 +&nbsp;OK "Dovecot ready."</font>
 +<font style="color: rgb(0, 0, 255)">AUTHENTICATE "PLAIN" "AGRqYW5nb0BuYXVzY2gub3JnAERqNG45MF9kM3JfRzMzayE="</font>
 +<font style="color: rgb(0, 255, 0)">&nbsp;OK "Logged in."</font>
 +</pre></html>
 +
 +Als erste Aktion fragen wir ab, welche SIEVE-Scruipte auf dem Server vorhanden sind. Da bis dato noch keine Scripte hinterlegt wurden, sit die Antwort des Servers natürlich etwas spartanisch, nämlich leer.
 +
 +<html><pre class="code">
 +<font style="color: rgb(0, 0, 255)">LISTSCRIPTS</font>
 +<font style="color: rgb(0, 255, 0)">&nbsp;OK "Listscripts completed."</font>
 +</pre></html>
 +
 +Nun wollen wir unser erstes SIEVE Script anlegen. Mit Hilfe dieses Scriptes werden alle Nachrichten sofort gelöscht, sobald diese im Betreff das Wörtchen **p0rn** enthält und der Postfix-MTA die Nachricht via **LMTP** an unseren Backend-server Dovecot übergibt. Das entsprechende Script könnte nun wie folgt aussehen.
 +
 +<code>if header :comparator "i;ascii-casemap" :contains "Subject" "p0rn"  {
 +    discard;
 +    stop;
 +}
 +</code>
 +
 +Das script hat insgesamt 96-Zeichen (gefolgt von einem abschließendem **CR**). Zusammen ergibt das also 97 Zeichen. Mit dem Befehl **PUTSCRIPT** laden wir nun dieses script zum Server hoch.
 +
 +<html><pre class="code">
 +<font style="color: rgb(0, 0, 255)">PUTSCRIPT "erste_sieve-regel_zum_testen" {97+}
 +if header :comparator "i;ascii-casemap" :contains "Subject" "p0rn"  {
 +    discard;
 +    stop;
 +}</font>
 +<font style="color: rgb(0, 255, 0)">&nbsp;OK "PUTSCRIPT completed."</font>
 +</pre></html>
 +
 +Fragen wir nun erneut ab, welche Scripte auf dem Server vorliegen, sehen wir auch unser erstes Testscript **erste_sieve-regel_zum_testen**.
 +
 +<html><pre class="code">
 +<font style="color: rgb(0, 0, 255)">LISTSCRIPTS</font>
 +<font style="color: rgb(0, 255, 0)">&nbsp;"erste_sieve-regel_zum_testen"
 +&nbsp;OK "Listscripts completed."</font>
 +</pre></html>
 +
 +Zum Scharfschalten des Scripts wird der Befehl **SETACTIVE** verwendet.
 +
 +<html><pre class="code">
 +<font style="color: rgb(0, 0, 255)">SETACTIVE "erste_sieve-regel_zum_testen"</font>
 +<font style="color: rgb(0, 255, 0)">&nbsp;OK "Setactive completed."</font>
 +</pre></html>
 +
 +Fragen wir nun erneut die Liste des SIEVE-Scripte ab, sehen wir ein **ACTIVE** hinter dem Scriptnamen **erste_sieve-regel_zum_testen**; d.h. dieses Script ist nunmehr aktiv.
 +
 +<html><pre class="code">
 +<font style="color: rgb(0, 0, 255)">LISTSCRIPTS</font>
 +<font style="color: rgb(0, 255, 0)">&nbsp;"erste_sieve-regel_zum_testen" ACTIVE
 +&nbsp;OK "Listscripts completed."</font>
 +</pre></html>
 +
 +Wollen wir ein script Herunterladen verwenden wir den Befehl **GETSCRIPT**.
 +
 +<html><pre class="code">
 +<font style="color: rgb(0, 0, 255)">GETSCRIPT "erste_sieve-regel_zum_testen"</font>
 +<font style="color: rgb(0, 255, 0)">&nbsp;{97}
 +&nbsp;if header :comparator "i;ascii-casemap" :contains "Subject" "p0rn"  {
 +     discard;
 +     stop;
 +&nbsp;}
 +&nbsp;OK "Getscript completed."</font>
 +</pre></html>
 +
 +Zu guter Letzt melden wir uns nun von unserem Server mit dem Befehl **LOGOUT** wieder ab.
 +
 +
 +<html><pre class="code">
 +<font style="color: rgb(0, 0, 255)">LOGOUT</font>
 +<font style="color: rgb(0, 255, 0)">&nbsp;OK "Logout completed."</font>
 +<font style="color: rgb(0, 0, 0)">Connection closed by foreign host.</font>
 +</pre></html>
 +
 +Im Verzeischnis des Users **django@nausch.org** finden wir nun auch das Verzeichnis //**/srv/vmail/nausch.org/django/sieve**// in dem die SIEVE-Scripte abgelegt werden. 
 +
 +<code>/srv/vmail/nausch.org/django/
 +├── .dovecot.sieve -> sieve/erste_sieve-regel_zum_testen.sieve
 +├── Maildir/
 +│   ├── cur/
 +│   │   └── 1407189625.M304698P4532.vml000070.dmz.nausch.org,S=409,W=422:2,
 +│   ├── dovecot.index.cache
 +│   ├── dovecot.index.log
 +│   ├── dovecot.mailbox.log
 +│   ├── dovecot-uidlist
 +│   ├── dovecot-uidvalidity
 +│   ├── dovecot-uidvalidity.53dfa2ad
 +│   ├── .Drafts/
 +│   │   ├── cur/
 +│   │   ├── dovecot.index.log
 +│   │   ├── dovecot-uidlist
 +│   │   ├── maildirfolder
 +│   │   ├── new/
 +│   │   └── tmp/
 +│   ├── new/
 +│   ├── .Sent/
 +│   │   ├── cur/
 +│   │   ├── dovecot.index.log
 +│   │   ├── dovecot-uidlist
 +│   │   ├── maildirfolder
 +│   │   ├── new/
 +│   │   └── tmp/
 +│   ├── subscriptions
 +│   └── tmp/
 +└── sieve/
 +    ├── erste_sieve-regel_zum_testen.sieve
 +    └── tmp/
 +</code>
 +
 +Das aktive Script erkennen wir an dem symlink //**.dovecot.sieve**// im **HOME**-Verzeichnis des Users.
 +   # ll /srv/vmail/nausch.org/django/.dovecot.sieve 
 +
 +   lrwxrwxrwx 1 vmail vmail 40 Aug  5 13:01 /srv/vmail/nausch.org/django/.dovecot.sieve -> sieve/erste_sieve-regel_zum_testen.sieve
 +
 +Im Maillog wurden unsere SIEVE-Script Aktivitäten mit Hilfe des Mail-Plugins **ManageSieve** dokumentiert.
 +<code>Aug  5 12:58:29 vml000070 dovecot: managesieve-login: Login: user=<django@nausch.org>, method=PLAIN, rip=10.0.0.70, mpid=5212, secured, session=<4sFTvN//sAAKAABG>
 +Aug  5 12:58:29 vml000070 dovecot: managesieve(django@nausch.org): Debug: Effective uid=10000, gid=10000, home=/srv/vmail/nausch.org/django
 +Aug  5 12:58:29 vml000070 dovecot: managesieve(django@nausch.org): Debug: Namespace inbox: type=private, prefix=INBOX/, sep=/, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/srv/vmail/nausch.org/django/Maildir
 +Aug  5 12:58:29 vml000070 dovecot: managesieve(django@nausch.org): Debug: maildir++: root=/srv/vmail/nausch.org/django/Maildir, index=, indexpvt=, control=, inbox=/srv/vmail/nausch.org/django/Maildir, alt=
 +Aug  5 12:58:29 vml000070 dovecot: managesieve(django@nausch.org): Debug: Namespace : type=private, prefix=, sep=, inbox=no, hidden=yes, list=no, subscriptions=no location=fail::LAYOUT=none
 +Aug  5 12:58:29 vml000070 dovecot: managesieve(django@nausch.org): Debug: none: root=, index=, indexpvt=, control=, inbox=, alt=
 +Aug  5 12:58:29 vml000070 dovecot: managesieve(django@nausch.org): Debug: sieve: Pigeonhole version 0.4.2 initializing
 +Aug  5 12:58:29 vml000070 dovecot: managesieve(django@nausch.org): Debug: sieve: include: sieve_global_dir is not set; it is currently not possible to include `:global' scripts.
 +Aug  5 12:58:29 vml000070 dovecot: managesieve(django@nausch.org): Debug: sieve-storage: using active sieve script path: /srv/vmail/nausch.org/django/.dovecot.sieve
 +Aug  5 12:58:29 vml000070 dovecot: managesieve(django@nausch.org): Debug: sieve-storage: using sieve script storage directory: /srv/vmail/nausch.org/django/sieve
 +Aug  5 12:58:29 vml000070 dovecot: managesieve(django@nausch.org): Debug: sieve-storage: using permissions from /srv/vmail/nausch.org/django/sieve: mode=0700 gid=-1
 +Aug  5 12:58:29 vml000070 dovecot: managesieve(django@nausch.org): Debug: sieve-storage: relative path to sieve storage in active link: sieve/
 +Aug  5 12:59:09 vml000070 dovecot: managesieve(django@nausch.org): Disconnected: Logged out bytes=6/41
 +Aug  5 12:59:25 vml000070 dovecot: master: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
 +Aug  5 12:59:25 vml000070 dovecot: imap-login: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
 +Aug  5 12:59:25 vml000070 dovecot: anvil: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
 +Aug  5 12:59:25 vml000070 dovecot: log: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
 +Aug  5 13:00:00 vml000070 dovecot: master: Dovecot v2.2.13 starting up for imap, pop3, lmtp, sieve (core dumps disabled)
 +Aug  5 13:00:18 vml000070 dovecot: managesieve-login: Login: user=<django@nausch.org>, method=PLAIN, rip=10.0.0.70, mpid=5262, secured, session=<4prRwt//sQAKAABG>
 +Aug  5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): Debug: Effective uid=10000, gid=10000, home=/srv/vmail/nausch.org/django
 +Aug  5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): Debug: Namespace inbox: type=private, prefix=INBOX/, sep=/, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/srv/vmail/nausch.org/django/Maildir
 +Aug  5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): Debug: maildir++: root=/srv/vmail/nausch.org/django/Maildir, index=, indexpvt=, control=, inbox=/srv/vmail/nausch.org/django/Maildir, alt=
 +Aug  5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): Debug: Namespace : type=private, prefix=, sep=, inbox=no, hidden=yes, list=no, subscriptions=no location=fail::LAYOUT=none
 +Aug  5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): Debug: none: root=, index=, indexpvt=, control=, inbox=, alt=
 +Aug  5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): Debug: sieve: Pigeonhole version 0.4.2 initializing
 +Aug  5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): Debug: sieve: include: sieve_global_dir is not set; it is currently not possible to include `:global' scripts.
 +Aug  5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): Debug: sieve-storage: using active sieve script path: /srv/vmail/nausch.org/django/.dovecot.sieve
 +Aug  5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): Debug: sieve-storage: using sieve script storage directory: /srv/vmail/nausch.org/django/sieve
 +Aug  5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): Debug: sieve-storage: permission lookup failed from /srv/vmail/nausch.org/django/sieve
 +Aug  5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): Debug: sieve-storage: created storage directory /srv/vmail/nausch.org/django/sieve/tmp
 +Aug  5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): Debug: sieve-storage: relative path to sieve storage in active link: sieve/
 +Aug  5 13:02:09 vml000070 dovecot: managesieve(django@nausch.org): Disconnected: Logged out bytes=276/385
 +</code>
 +
 +Zum Abschluß unseres Tests liefern wir nun eine Nachricht via **LMTP** bei unserem Dovecot-Server ein.
 +
 +<html><pre class="code">
 +<font style="color: rgb(0, 0, 255)">$ telnet 10.0.0.70 24</font>
 +<font style="color: rgb(0, 0, 0)">Trying 10.0.0.70...
 +Connected to 10.0.0.70.
 +Escape character is '^]'.</font>
 +<font style="color: rgb(0, 255, 0)">&nbsp;220 imap.nausch.org Dovecot ready.</font>
 +<font style="color: rgb(0, 0, 255)">LHLO mx01.nausch.org</font>
 +<font style="color: rgb(0, 255, 0)">&nbsp;250-imap.nausch.org
 +&nbsp;250-8BITMIME
 +&nbsp;250-ENHANCEDSTATUSCODES
 +&nbsp;250 PIPELINING</font>
 +<font style="color: rgb(0, 0, 255)">mail from:&lt;michael@nausch.org&gt;</font>
 +<font style="color: rgb(0, 255, 0)">&nbsp;250 2.1.0 OK</font>
 +<font style="color: rgb(0, 0, 255)">rcpt to:&lt;django@nausch.org&gt;</font>
 +<font style="color: rgb(0, 255, 0)">&nbsp;250 2.1.5 OK</font>
 +<font style="color: rgb(0, 0, 255)">DATA</font>
 +<font style="color: rgb(0, 255, 0)">&nbsp;354 OK</font>
 +<font style="color: rgb(0, 0, 255)">From: Michael Nausch <michael@nausch.org>
 +To: Django [BOfH] <django@nausch.org>
 +Subject: Haben Du Interesse an p0rn?
 +Date: Mon, 21 Jul 2014 09:00:36 -0000
 +
 +HI,     
 +wenn Du haben willst lot of p0rn, Du mir sagen.
 +Ich habe sehr viel davon.
 +
 +ttyl
 +Bazibua
 +.</font>
 +<font style="color: rgb(0, 255, 0)">&nbsp;250 2.0.0 <django@nausch.org> fs6GLxrC4FO0FAAAOs1BfA Saved</font>
 +<font style="color: rgb(0, 0, 255)">quit</font>
 +<font style="color: rgb(0, 255, 0)">&nbsp;221 2.0.0 OK</font>
 +<font style="color: rgb(0, 0, 0)">Connection closed by foreign host.</font>
 +</pre></html>
 +
 +
 +Im Maillog sehen wir nun, dass die Nachricht nicht zugestellt, sonder gelöscht wurde **marked message to be discarded if not explicitly delivered (discard action)**.
 +
 +<code>Aug  5 13:38:02 vml000070 dovecot: lmtp(5300): Debug: none: root=, index=, indexpvt=, control=, inbox=, alt=
 +Aug  5 13:38:02 vml000070 dovecot: lmtp(5300): Connect from 10.0.0.80
 +Aug  5 13:38:24 vml000070 dovecot: lmtp(5300): Debug: Loading modules from directory: /usr/lib64/dovecot
 +Aug  5 13:38:24 vml000070 dovecot: lmtp(5300): Debug: Module loaded: /usr/lib64/dovecot/lib90_sieve_plugin.so
 +Aug  5 13:38:24 vml000070 dovecot: lmtp(5300): Debug: auth input: django@nausch.org uid=10000 gid=10000 home=/srv/vmail/nausch.org/django
 +Aug  5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): Debug: Effective uid=10000, gid=10000, home=/srv/vmail/nausch.org/django
 +Aug  5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): Debug: Namespace inbox: type=private, prefix=INBOX/, sep=/, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/srv/vmail/nausch.org/django/Maildir
 +Aug  5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): Debug: maildir++: root=/srv/vmail/nausch.org/django/Maildir, index=, indexpvt=, control=, inbox=/srv/vmail/nausch.org/django/Maildir, alt=
 +Aug  5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): Debug: Namespace : type=private, prefix=, sep=, inbox=no, hidden=yes, list=no, subscriptions=no location=fail::LAYOUT=none
 +Aug  5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): Debug: none: root=, index=, indexpvt=, control=, inbox=, alt=
 +Aug  5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): Debug: sieve: Pigeonhole version 0.4.2 initializing
 +Aug  5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): Debug: sieve: include: sieve_global_dir is not set; it is currently not possible to include `:global' scripts.
 +Aug  5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): Debug: fs6GLxrC4FO0FAAAOs1BfA: sieve: using the following location for user's Sieve script: /srv/vmail/nausch.org/django/.dovecot.sieve;name=main script
 +Aug  5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): Debug: fs6GLxrC4FO0FAAAOs1BfA: sieve: loading script /srv/vmail/nausch.org/django/.dovecot.sieve;name=main script
 +Aug  5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): Debug: fs6GLxrC4FO0FAAAOs1BfA: sieve: script `main script' from /srv/vmail/nausch.org/django/.dovecot.sieve;name=main script successfully compiled
 +Aug  5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): Debug: fs6GLxrC4FO0FAAAOs1BfA: sieve: executing script from /srv/vmail/nausch.org/django/.dovecot.sieve;name=main script
 +Aug  5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): fs6GLxrC4FO0FAAAOs1BfA: sieve: msgid=unspecified: marked message to be discarded if not explicitly delivered (discard action)
 +Aug  5 13:40:03 vml000070 dovecot: lmtp(5300): Disconnect from 10.0.0.80: Successful quit
 +</code>
 +
 +
 +
 +
 +
 +
 +
 +Im Verzeichnis des Users **django@nausch.org** sehen wir keine neue Nachricht, da diese mit Hilfe des SIEVE-scriptes sofort gelöscht wurde.
 +<code>/srv/vmail/nausch.org/django/
 +├── .dovecot.sieve -> sieve/erste_sieve-regel_zum_testen.sieve
 +├── .dovecot.svbin
 +├── Maildir/
 +│   ├── cur/
 +│   │   └── 1407189625.M304698P4532.vml000070.dmz.nausch.org,S=409,W=422:2,
 +│   ├── dovecot.index.cache
 +│   ├── dovecot.index.log
 +│   ├── dovecot.mailbox.log
 +│   ├── dovecot-uidlist
 +│   ├── dovecot-uidvalidity
 +│   ├── dovecot-uidvalidity.53dfa2ad
 +│   ├── .Drafts/
 +│   │   ├── cur/
 +│   │   ├── dovecot.index.log
 +│   │   ├── dovecot-uidlist
 +│   │   ├── maildirfolder
 +│   │   ├── new/
 +│   │   └── tmp/
 +│   ├── new/
 +│   ├── .Sent/
 +│   │   ├── cur/
 +│   │   ├── dovecot.index.log
 +│   │   ├── dovecot-uidlist
 +│   │   ├── maildirfolder
 +│   │   ├── new/
 +│   │   └── tmp/
 +│   ├── subscriptions
 +│   └── tmp/
 +└── sieve/
 +    ├── erste_sieve-regel_zum_testen.sieve
 +    └── tmp/
 +</code>
 +
 +===== Test =====
 +//... in Bearbeitung (Vorankündigung)! ...//
 ====== Links ====== ====== Links ======
   * **[[centos:mail_c7:start|Zurück zum Kapitel >>Mailserverinstallation unter CentOS 7<<]]**   * **[[centos:mail_c7:start|Zurück zum Kapitel >>Mailserverinstallation unter CentOS 7<<]]**
   * **[[wiki:start|Zurück zu >>Projekte und Themenkapitel<<]]**   * **[[wiki:start|Zurück zu >>Projekte und Themenkapitel<<]]**
   * **[[http://dokuwiki.nausch.org/doku.php/|Zurück zur Startseite]]**   * **[[http://dokuwiki.nausch.org/doku.php/|Zurück zur Startseite]]**
- 
-~~DISCUSSION~~ 
  
  
  • centos/mail_c7/dovecot_3.1407188051.txt.gz
  • Zuletzt geändert: 04.08.2014 21:34.
  • von django