Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| centos:mail_c7:dovecot_3 [04.08.2014 21:11. ] – django | centos:mail_c7:dovecot_3 [18.11.2024 07:08. ] (aktuell) – Externe Bearbeitung 127.0.0.1 | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| ====== Dovecot, Nachrichten auf dem Server mit SIEVE filtern ====== | ====== Dovecot, Nachrichten auf dem Server mit SIEVE filtern ====== | ||
| - | {{: | + | {{: |
| + | Zur Filtern von E-Mails auf IMAP-Servern wurde die Programmiersprache **SIEVE** konzipiert - die genaue Spezifikationen erfolgten hierzu im RFC 5228 und vielen Erweiterungen/ | ||
| Weitere Hintergrundinformationen finden man unter anderem in dem [[http:// | Weitere Hintergrundinformationen finden man unter anderem in dem [[http:// | ||
| - | + | \\ | |
| - | {{: | + | |
| 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:// | 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:// | ||
| ===== Installation ===== | ===== Installation ===== | ||
| - | Am Einfachsten bedienen wir uns zur Installation des Paketes **dovecot-pigeonhole** eines aktuell gepflegten Dovecot-Repositories, | + | Am Einfachsten bedienen wir uns zur Installation des Paketes **dovecot-pigeonhole** eines aktuell gepflegten Dovecot-Repositories, |
| - | Die Installation des Paketes geht dank des Repositories **[[http:// | + | Die Installation des Paketes geht Dank des Repositories **[[http:// |
| # yum install dovecot-pigeonhole -y | # yum install dovecot-pigeonhole -y | ||
| Zeile 29: | Zeile 29: | ||
| Build Host : vml000200.dmz.nausch.org | Build Host : vml000200.dmz.nausch.org | ||
| Relocations : (not relocatable) | Relocations : (not relocatable) | ||
| - | Packager | + | Packager |
| Vendor | Vendor | ||
| URL : http:// | URL : http:// | ||
| Zeile 74: | Zeile 74: | ||
| ===== Konfiguration ===== | ===== Konfiguration ===== | ||
| Die Konfiguration vom Managesieve-Plugin **dovecot-pigeonhole** erfolgt über die drei Konfigurationsdateien // | Die Konfiguration vom Managesieve-Plugin **dovecot-pigeonhole** erfolgt über die drei Konfigurationsdateien // | ||
| + | |||
| ==== 20-managesieve.conf ==== | ==== 20-managesieve.conf ==== | ||
| - | FIXME | + | Auf welchem Port und welcher Adresse unser Managesieve-Logindaemon horchen soll wird in der datei // |
| + | # vim / | ||
| + | <file bash / | ||
| + | ## ManageSieve specific settings | ||
| + | ## | ||
| + | |||
| + | # Uncomment to enable managesieve protocol: | ||
| + | #protocols = $protocols sieve | ||
| + | |||
| + | # Service definitions | ||
| + | |||
| + | # Django : 2014-08-04 | ||
| + | # default: unset | ||
| + | service managesieve-login { | ||
| + | inet_listener sieve { | ||
| + | address = 10.0.0.70 | ||
| + | port = 4190 | ||
| + | } | ||
| + | |||
| + | # | ||
| + | # port = 2000 | ||
| + | #} | ||
| + | |||
| + | # Number of connections to handle before starting a new process. Typically | ||
| + | # the only useful values are 0 (unlimited) or 1. 1 is more secure, but 0 | ||
| + | # is faster. < | ||
| + | # | ||
| + | |||
| + | # Number of processes to always keep waiting for more connections. | ||
| + | # | ||
| + | |||
| + | # If you set service_count=0, | ||
| + | #vsz_limit = 64M | ||
| + | } | ||
| + | |||
| + | #service managesieve { | ||
| + | # Max. number of ManageSieve processes (connections) | ||
| + | # | ||
| + | #} | ||
| + | |||
| + | # Service configuration | ||
| + | |||
| + | protocol sieve { | ||
| + | # Maximum ManageSieve command line length in bytes. ManageSieve usually does | ||
| + | # not involve overly long command lines, so this setting will not normally | ||
| + | # need adjustment | ||
| + | # | ||
| + | |||
| + | # Maximum number of ManageSieve connections allowed for a user from each IP | ||
| + | # address. | ||
| + | # NOTE: The username is compared case-sensitively. | ||
| + | # | ||
| + | |||
| + | # Space separated list of plugins to load (none known to be useful so far). | ||
| + | # Do NOT try to load IMAP plugins here. | ||
| + | # | ||
| + | |||
| + | # MANAGESIEVE logout format string: | ||
| + | # %i - total number of bytes read from client | ||
| + | # %o - total number of bytes sent to client | ||
| + | # | ||
| + | |||
| + | # To fool ManageSieve clients that are focused on CMU's timesieved you can | ||
| + | # specify the IMPLEMENTATION capability that Dovecot reports to clients. | ||
| + | # For example: 'Cyrus timsieved v2.2.13' | ||
| + | # | ||
| + | |||
| + | # Explicitly specify the SIEVE and NOTIFY capability reported by the server | ||
| + | # before login. If left unassigned these will be reported dynamically | ||
| + | # according to what the Sieve interpreter supports by default (after login | ||
| + | # this may differ depending on the user). | ||
| + | # | ||
| + | # | ||
| + | |||
| + | # The maximum number of compile errors that are returned to the client upon | ||
| + | # script upload or script verification. | ||
| + | # | ||
| + | |||
| + | # Refer to 90-sieve.conf for script quota configuration and configuration of | ||
| + | # Sieve execution limits. | ||
| + | } | ||
| + | </ | ||
| ==== 90-sieve-extprograms.conf ==== | ==== 90-sieve-extprograms.conf ==== | ||
| + | Mit Hilfe der Datei // | ||
| + | # cat / | ||
| + | <file bash / | ||
| + | |||
| + | # 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, | ||
| + | # respectively. The name of each unix socket contained in that directory | ||
| + | # directly maps to a program-name referenced from the Sieve script. | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | |||
| + | # The directory where the scripts are located for direct execution by the | ||
| + | # vnd.dovecot.pipe, | ||
| + | # respectively. The name of each script contained in that directory | ||
| + | # directly maps to a program-name referenced from the Sieve script. | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | } | ||
| + | |||
| + | # An example program service called ' | ||
| + | #service do-something { | ||
| + | # Define the executed script as parameter to the sieve service | ||
| + | #executable = script / | ||
| + | |||
| + | # 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) | ||
| + | # | ||
| + | # LDA/LMTP must have access | ||
| + | # user = vmail | ||
| + | # mode = 0600 | ||
| + | #} | ||
| + | #} | ||
| + | </ | ||
| ==== 90-sieve.conf ==== | ==== 90-sieve.conf ==== | ||
| + | Die Einstellungen des Sieve-Plugins erfolgen mit Hilfe der Datei // | ||
| + | # less / | ||
| + | |||
| + | <file bash / | ||
| + | ## 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 = ~/ | ||
| + | |||
| + | # 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' | ||
| + | # command line tool. | ||
| + | # --> See sieve_before fore executing scripts before the user's personal | ||
| + | # | ||
| + | # | ||
| + | |||
| + | # 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. | ||
| + | # | ||
| + | |||
| + | # 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. | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | |||
| + | # Identical to sieve_before, | ||
| + | # user's script (only when keep is still in effect!). Multiple script file or | ||
| + | # directory paths can be specified by appending an increasing number. | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | |||
| + | # 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 ' | ||
| + | # to the default. For example `sieve_extensions = +imapflags' | ||
| + | # deprecated imapflags extension in addition to all extensions were already | ||
| + | # enabled by default. | ||
| + | # | ||
| + | |||
| + | # 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' | ||
| + | # (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' | ||
| + | # `sieve_extensions' | ||
| + | # enabled or disabled for exclusive use in global scripts. Currently, no | ||
| + | # extensions are marked as such by default. | ||
| + | # | ||
| + | |||
| + | # 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:// | ||
| + | # The sieve_extprograms plugin is included in this release. | ||
| + | # | ||
| + | |||
| + | # 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. ' | ||
| + | # 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' | ||
| + | # | ||
| + | |||
| + | # 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. | ||
| + | # | ||
| + | |||
| + | # 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. | ||
| + | # | ||
| + | |||
| + | # The maximum number of redirect actions that can be performed during a single | ||
| + | # script execution. If set to 0, no redirect actions are allowed. | ||
| + | # | ||
| + | |||
| + | # 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) | ||
| + | # | ||
| + | |||
| + | # 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) | ||
| + | # | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== dovecot.conf ==== | ||
| + | Zu guter letzt fügen wir noch das Protokoll oder exakter formuliert die Script-Sprache **sieve** zu den Protokollen hinzu, die unser Dovecot-Server zur Verfügung stellen soll. Per Default bietet unser Dovecot-Server bisher folgende Protokolle an: | ||
| + | # doveconf protocols | ||
| + | |||
| + | | ||
| + | |||
| + | Die Erweiterung um **sieve** erfolgt in der Konfigurationsdatei // | ||
| + | # vim / | ||
| + | <file bash / | ||
| + | |||
| + | # If you're in a hurry, see http:// | ||
| + | |||
| + | # " | ||
| + | # instead of copy& | ||
| + | |||
| + | # '#' | ||
| + | # and tabs are ignored. If you want to use either of these explicitly, put the | ||
| + | # value inside quotes, eg.: key = "# char and trailing whitespace | ||
| + | |||
| + | # Most (but not all) settings can be overridden by different protocols and/or | ||
| + | # source/ | ||
| + | # protocol imap { }, local 127.0.0.1 { }, remote 10.0.0.0/8 { } | ||
| + | |||
| + | # Default values are shown for each setting, it's not required to uncomment | ||
| + | # those. These are exceptions to this though: No sections (e.g. namespace {}) | ||
| + | # or plugin settings are added by default, they' | ||
| + | # Paths are also just examples with the real defaults being based on configure | ||
| + | # options. The paths listed here are for configure --prefix=/ | ||
| + | # --sysconfdir=/ | ||
| + | |||
| + | # Protocols we want to be serving. | ||
| + | # Django : 2014-08-04 | ||
| + | # Erweiterung um die Scriptsprache/ | ||
| + | # default: #protocols = imap pop3 lmtp | ||
| + | protocols = imap pop3 lmtp sieve | ||
| + | |||
| + | # A comma separated list of IPs or hosts where to listen in for connections. | ||
| + | # " | ||
| + | # If you want to specify non-default ports or anything more complex, | ||
| + | # edit conf.d/ | ||
| + | # Django : 2014-08-04 | ||
| + | # IPv6-Adressen deaktivieren, | ||
| + | # bzw. einer IPv4-Addresse | ||
| + | # default: #listen = *, :: | ||
| + | # listen = 10.0.0.70 | ||
| + | |||
| + | # Base directory where to store runtime data. | ||
| + | #base_dir = / | ||
| + | |||
| + | # Name of this instance. In multi-instance setup doveadm and other commands | ||
| + | # can use -i < | ||
| + | # to -c < | ||
| + | # in ps output. | ||
| + | # | ||
| + | |||
| + | # Greeting message for clients. | ||
| + | # | ||
| + | |||
| + | # Space separated list of trusted network ranges. Connections from these | ||
| + | # IPs are allowed to override their IP addresses and ports (for logging and | ||
| + | # for authentication checks). disable_plaintext_auth is also ignored for | ||
| + | # these networks. Typically you'd specify your IMAP proxy servers here. | ||
| + | # | ||
| + | |||
| + | # Space separated list of login access check sockets (e.g. tcpwrap) | ||
| + | # | ||
| + | |||
| + | # With proxy_maybe=yes if proxy destination matches any of these IPs, don't do | ||
| + | # proxying. This isn't necessary normally, but may be useful if the destination | ||
| + | # IP is e.g. a load balancer' | ||
| + | # | ||
| + | |||
| + | # Show more verbose process titles (in ps). Currently shows user name and | ||
| + | # IP address. Useful for seeing who are actually using the IMAP processes | ||
| + | # (eg. shared mailboxes or if same uid is used for multiple accounts). | ||
| + | # Django : 2014-07-21 | ||
| + | # In der Prozessliste bei den POP3/ | ||
| + | # die Client-IP-Adresse und den ausgeführten IMAP-Befehl anzeigen. | ||
| + | # default: # | ||
| + | verbose_proctitle = yes | ||
| + | |||
| + | # Should all processes be killed when Dovecot master process shuts down. | ||
| + | # Setting this to " | ||
| + | # forcing existing client connections to close (although that could also be | ||
| + | # a problem if the upgrade is e.g. because of a security fix). | ||
| + | # | ||
| + | |||
| + | # If non-zero, run mail commands via this many connections to doveadm server, | ||
| + | # instead of running them directly in the same process. | ||
| + | # | ||
| + | # UNIX socket or host:port used for connecting to doveadm server | ||
| + | # | ||
| + | |||
| + | # Space separated list of environment variables that are preserved on Dovecot | ||
| + | # startup and passed down to all of its child processes. You can also give | ||
| + | # key=value pairs to always set specific settings. | ||
| + | # | ||
| + | |||
| + | ## | ||
| + | ## Dictionary server settings | ||
| + | ## | ||
| + | |||
| + | # Dictionary can be used to store key=value lists. This is used by several | ||
| + | # plugins. The dictionary can be accessed either directly or though a | ||
| + | # dictionary server. The following dict block maps dictionary names to URIs | ||
| + | # when the server is used. These can then be referenced using URIs in format | ||
| + | # " | ||
| + | |||
| + | dict { | ||
| + | #quota = mysql:/ | ||
| + | #expire = sqlite:/ | ||
| + | } | ||
| + | |||
| + | # Most of the actual configuration gets included below. The filenames are | ||
| + | # first sorted by their ASCII value and parsed in that order. The 00-prefixes | ||
| + | # in filenames are intended to make it easier to understand the ordering. | ||
| + | !include conf.d/ | ||
| + | # A config file can also tried to be included without giving an error if | ||
| + | # it's not found: | ||
| + | !include_try local.conf | ||
| + | </ | ||
| ==== 20-lmtp.conf ==== | ==== 20-lmtp.conf ==== | ||
| + | Da die definierten SIEVE-Regeln bei der Zustellung der Nachrichten ihre Arbeit verrichten, müssen wir bei den Konfigurationsparametern von **LMTP** das Plugin **sieve** mit aufnehmen. | ||
| + | # vim / | ||
| + | <file bash / | ||
| + | ## LMTP specific settings | ||
| + | ## | ||
| + | |||
| + | # Support proxying to other LMTP/SMTP servers by performing passdb lookups. | ||
| + | #lmtp_proxy = no | ||
| + | |||
| + | # When recipient address includes the detail (e.g. user+detail), | ||
| + | # the mail to the detail mailbox. See also recipient_delimiter and | ||
| + | # lda_mailbox_autocreate settings. | ||
| + | # | ||
| + | |||
| + | # Verify quota before replying to RCPT TO. This adds a small overhead. | ||
| + | # | ||
| + | |||
| + | protocol lmtp { | ||
| + | # Space separated list of plugins to load (default is global mail_plugins). | ||
| + | # Django : 2014-08-04 | ||
| + | # default: | ||
| + | mail_plugins = $mail_plugins sieve | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== Horde-Framework' | ||
| + | Die notwendigen Konfigurationseinstellungen bei der Applikation **[[http:// | ||
| + | ===== 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/ | ||
| + | |||
| + | | ||
| + | |||
| + | Anschließend können wir den Firewall-Daemon einmal durchstarten und anschließend überprüfen, | ||
| + | # firewall-cmd --reload | ||
| + | |||
| + | | ||
| + | |||
| + | Abschließend prüfen wir noch, ob die Erweiterung unseres Paketfilter aktiv ist. | ||
| + | # iptables -nvL IN_public_allow | ||
| + | < | ||
| + | pkts bytes target | ||
| + | 0 0 ACCEPT | ||
| + | 0 0 ACCEPT | ||
| + | 0 0 ACCEPT | ||
| + | 0 0 ACCEPT | ||
| + | 0 0 ACCEPT | ||
| + | 0 0 ACCEPT | ||
| + | 0 0 ACCEPT | ||
| + | </ | ||
| ===== 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 / | ||
| + | < | ||
| + | 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) | ||
| + | </ | ||
| + | |||
| + | Fragen wir den Serverstatus ab, finden wir nun auch den Dienst **sieve** bei den Protokollen. | ||
| + | # systemctl status dovecot | ||
| + | < | ||
| + | | ||
| + | | ||
| + | Process: 4156 ExecStartPre=/ | ||
| + | Main PID: 4161 (dovecot) | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | 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]: | ||
| + | </ | ||
| + | |||
| + | 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 | ||
| + | |||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| ===== 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 **" | ||
| + | | ||
| + | Zum Erstellen dieses Anmeldestrings nutzen wir einfach das script **sieve-auth-command.pl** von //Stephan Bosch//. | ||
| + | # vim / | ||
| + | <file perl / | ||
| + | # | ||
| + | # sieve-auth-command.pl | ||
| + | # --------------------- | ||
| + | # | ||
| + | # Generates ManageSieve AUTHENTICATE command for manually testing the protocol | ||
| + | # using telnet or gnutls-cli (TLS) | ||
| + | # | ||
| + | # Usage: | ||
| + | # | ||
| + | # | ||
| + | # Prints the AUTHENTICATE " | ||
| + | # | ||
| + | # -- | ||
| + | # Stephan Bosch, stephan@rename-it.nl | ||
| + | # | ||
| + | use MIME:: | ||
| + | |||
| + | use strict; | ||
| + | |||
| + | my $username = shift; | ||
| + | my $password = shift; | ||
| + | |||
| + | my $userpass = " | ||
| + | my $encode=encode_base64($userpass); | ||
| + | |||
| + | $encode =~ s/^\s+//; | ||
| + | $encode =~ s/\s+$//; | ||
| + | |||
| + | print " | ||
| + | </ | ||
| + | |||
| + | Um das Script einfach ausführen zu können versehen wir nun noch die Datei-Rechte mit einem **x**. | ||
| + | # chmod +x / | ||
| + | |||
| + | 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! | ||
| + | |||
| + | | ||
| + | |||
| + | Diesen Anmeldestring verwenden wir nun bei unserem ersten Test. Bei diesem SIEVE-Test via **telnet** sind die Eingaben am testenden Client in der Farbe < | ||
| + | |||
| + | 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. | ||
| + | |||
| + | < | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | Connected to 10.0.0.70. | ||
| + | Escape character is ' | ||
| + | <font style=" | ||
| + | & | ||
| + | & | ||
| + | & | ||
| + | & | ||
| + | & | ||
| + | & | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | </ | ||
| + | |||
| + | 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, | ||
| + | |||
| + | < | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | </ | ||
| + | |||
| + | 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. | ||
| + | |||
| + | < | ||
| + | discard; | ||
| + | stop; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | 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. | ||
| + | |||
| + | < | ||
| + | <font style=" | ||
| + | if header :comparator " | ||
| + | discard; | ||
| + | stop; | ||
| + | }</ | ||
| + | <font style=" | ||
| + | </ | ||
| + | |||
| + | Fragen wir nun erneut ab, welche Scripte auf dem Server vorliegen, sehen wir auch unser erstes Testscript **erste_sieve-regel_zum_testen**. | ||
| + | |||
| + | < | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | & | ||
| + | </ | ||
| + | |||
| + | Zum Scharfschalten des Scripts wird der Befehl **SETACTIVE** verwendet. | ||
| + | |||
| + | < | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | </ | ||
| + | |||
| + | Fragen wir nun erneut die Liste des SIEVE-Scripte ab, sehen wir ein **ACTIVE** hinter dem Scriptnamen **erste_sieve-regel_zum_testen**; | ||
| + | |||
| + | < | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | & | ||
| + | </ | ||
| + | |||
| + | Wollen wir ein script Herunterladen verwenden wir den Befehl **GETSCRIPT**. | ||
| + | |||
| + | < | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | & | ||
| + | | ||
| + | stop; | ||
| + | } | ||
| + | & | ||
| + | </ | ||
| + | |||
| + | Zu guter Letzt melden wir uns nun von unserem Server mit dem Befehl **LOGOUT** wieder ab. | ||
| + | |||
| + | |||
| + | < | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | </ | ||
| + | |||
| + | Im Verzeischnis des Users **django@nausch.org** finden wir nun auch das Verzeichnis // | ||
| + | |||
| + | < | ||
| + | ├── .dovecot.sieve -> sieve/ | ||
| + | ├── Maildir/ | ||
| + | │ ├── cur/ | ||
| + | │ │ └── 1407189625.M304698P4532.vml000070.dmz.nausch.org, | ||
| + | │ ├── 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/ | ||
| + | </ | ||
| + | |||
| + | Das aktive Script erkennen wir an dem symlink // | ||
| + | # ll / | ||
| + | |||
| + | | ||
| + | |||
| + | Im Maillog wurden unsere SIEVE-Script Aktivitäten mit Hilfe des Mail-Plugins **ManageSieve** dokumentiert. | ||
| + | < | ||
| + | Aug 5 12:58:29 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | Aug 5 12:58:29 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | Aug 5 12:58:29 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | Aug 5 12:58:29 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | Aug 5 12:58:29 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | Aug 5 12:58:29 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | Aug 5 12:58:29 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | Aug 5 12:58:29 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | Aug 5 12:58:29 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | Aug 5 12:58:29 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | Aug 5 12:58:29 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | Aug 5 12:59:09 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | 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: | ||
| + | Aug 5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | Aug 5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | Aug 5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | Aug 5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | Aug 5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | Aug 5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | Aug 5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | Aug 5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | Aug 5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | Aug 5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | Aug 5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | Aug 5 13:00:18 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | Aug 5 13:02:09 vml000070 dovecot: managesieve(django@nausch.org): | ||
| + | </ | ||
| + | |||
| + | Zum Abschluß unseres Tests liefern wir nun eine Nachricht via **LMTP** bei unserem Dovecot-Server ein. | ||
| + | |||
| + | < | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | Connected to 10.0.0.70. | ||
| + | Escape character is ' | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | & | ||
| + | & | ||
| + | & | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | To: Django [BOfH] < | ||
| + | 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 style=" | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | <font style=" | ||
| + | </ | ||
| + | |||
| + | |||
| + | 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)**. | ||
| + | |||
| + | < | ||
| + | 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: / | ||
| + | Aug 5 13:38:24 vml000070 dovecot: lmtp(5300): Debug: Module loaded: / | ||
| + | Aug 5 13:38:24 vml000070 dovecot: lmtp(5300): Debug: auth input: django@nausch.org uid=10000 gid=10000 home=/ | ||
| + | Aug 5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): | ||
| + | Aug 5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): | ||
| + | Aug 5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): | ||
| + | Aug 5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): | ||
| + | Aug 5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): | ||
| + | Aug 5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): | ||
| + | Aug 5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): | ||
| + | Aug 5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): | ||
| + | Aug 5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): | ||
| + | Aug 5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): | ||
| + | Aug 5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): | ||
| + | Aug 5 13:39:59 vml000070 dovecot: lmtp(5300, django@nausch.org): | ||
| + | Aug 5 13:40:03 vml000070 dovecot: lmtp(5300): Disconnect from 10.0.0.80: Successful quit | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | Im Verzeichnis des Users **django@nausch.org** sehen wir keine neue Nachricht, da diese mit Hilfe des SIEVE-scriptes sofort gelöscht wurde. | ||
| + | < | ||
| + | ├── .dovecot.sieve -> sieve/ | ||
| + | ├── .dovecot.svbin | ||
| + | ├── Maildir/ | ||
| + | │ ├── cur/ | ||
| + | │ │ └── 1407189625.M304698P4532.vml000070.dmz.nausch.org, | ||
| + | │ ├── 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/ | ||
| + | </ | ||
| + | |||
| + | ===== Test ===== | ||
| + | //... in Bearbeitung (Vorankündigung)! ...// | ||
| ====== Links ====== | ====== Links ====== | ||
| * **[[centos: | * **[[centos: | ||
| * **[[wiki: | * **[[wiki: | ||
| * **[[http:// | * **[[http:// | ||
| - | |||
| - | ~~DISCUSSION~~ | ||