Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Hi there,
- I made a mailserver with dovecot + postfix on debian. I can send and recieve emails. Also the server detects spam emails.
- Unfortunately, Sieve does not sort out Spam Mails to a Spam folder. Thats why i am here.
- Here are some Files I edited:
- dovecot.conf
- <pre>
- <code>
- ## Dovecot configuration file
- # If you're in a hurry, see http://wiki2.dovecot.org/QuickConfiguration
- # "doveconf -n" command gives a clean output of the changed settings. Use it
- # instead of copy&pasting files when posting to the Dovecot mailing list.
- # '#' character and everything after it is treated as comments. Extra spaces
- # 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/destination IPs by placing the settings inside sections, for example:
- # 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're listed only as examples.
- # Paths are also just examples with the real defaults being based on configure
- # options. The paths listed here are for configure --prefix=/usr
- # --sysconfdir=/etc --localstatedir=/var
- # Enable installed protocols
- !include_try /usr/share/dovecot/protocols.d/*.protocol
- # A comma separated list of IPs or hosts where to listen in for connections.
- # "*" listens in all IPv4 interfaces, "::" listens in all IPv6 interfaces.
- # If you want to specify non-default ports or anything more complex,
- # edit conf.d/master.conf.
- # Alex edited
- listen = *
- # Base directory where to store runtime data.
- #base_dir = /var/run/dovecot/
- # Name of this instance. In multi-instance setup doveadm and other commands
- # can use -i <instance_name> to select which instance is used (an alternative
- # to -c <config_path>). The instance name is also added to Dovecot processes
- # in ps output.
- #instance_name = dovecot
- # Greeting message for clients.
- #login_greeting = Dovecot ready.
- # 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.
- #login_trusted_networks =
- # Space separated list of login access check sockets (e.g. tcpwrap)
- #login_access_sockets =
- # 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's IP.
- #auth_proxy_self =
- # 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).
- #verbose_proctitle = no
- # Should all processes be killed when Dovecot master process shuts down.
- # Setting this to "no" means that Dovecot can be upgraded without
- # forcing existing client connections to close (although that could also be
- # a problem if the upgrade is e.g. because of a security fix).
- #shutdown_clients = yes
- # If non-zero, run mail commands via this many connections to doveadm server,
- # instead of running them directly in the same process.
- #doveadm_worker_count = 0
- # UNIX socket or host:port used for connecting to doveadm server
- #doveadm_socket_path = 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.
- #import_environment = TZ
- ##
- ## 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
- # "proxy::<name>".
- dict {
- #quota = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext
- #expire = sqlite:/etc/dovecot/dovecot-dict-sql.conf.ext
- }
- # 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/*.conf
- # A config file can also tried to be included without giving an error if
- # it's not found:
- !include_try local.conf
- auth_mechanisms = plain login
- log_timestamp = "%Y-%m-%d %H:%M:%S "
- passdb {
- args = /etc/dovecot/dovecot-mysql.conf
- driver = sql
- }
- protocols = imap pop3 sieve
- # Alex edit diese zeile
- mail_home = /var/vmail/%d/%n
- # Alex edit done
- service auth {
- unix_listener /var/spool/postfix/private/auth_dovecot {
- group = postfix
- mode = 0660
- user = postfix
- }
- unix_listener auth-master {
- mode = 0660
- user = vmail
- }
- user = root
- }
- ssl = yes
- ssl_cert = </etc/postfix/ssl/mailserver.crt
- ssl_key = </etc/postfix/ssl/mailserver.key
- userdb {
- args = /etc/dovecot/dovecot-mysql.conf
- driver = sql
- }
- protocol pop3 {
- pop3_uidl_format = %08Xu%08Xv
- pop3_client_workarounds = oe-ns-eoh
- # pop3_uidl_format = %v.%u
- }
- protocol lda {
- auth_socket_path = /var/run/dovecot/auth-master
- postmaster_address = [email protected]
- mail_plugins = sieve
- #log_path = /var/log/sieve.log
- }
- #
- #
- #
- #
- #
- # Alex Settings :D
- lda_mailbox_autosubscribe = yes
- lda_mailbox_autocreate = yes
- namespace inbox {
- mailbox Spam {
- auto = subscribe
- special_use = \Junk
- }
- mailbox Entwürfe {
- auto = create
- special_use = \Drafts
- }
- }
- plugin {
- sieve_before = /var/vmail/sieve/spam-global.sieve
- sieve_dir = /var/vmail/%d/%n/sieve/scripts/
- sieve = /var/vmail/%d/%n/sieve/active-script.sieve
- }
- #plugin {
- # sieve_global_path = /var/lib/dovecot/sieve/default.sieve
- # sieve_global_dir = /var/lib/dovecot/sieve/
- #}
- #plugin {
- # Eigene Sieve Filter liegen im Heimverzeichnis
- # sieve = ~/sieve/dovecot.sieve
- # sieve_dir = ~/sieve
- # Der globale Filter außerhalb
- # sieve_before = /var/vmail/before.sieve
- # sieve_max_script_size = 1M
- # sieve_quota_max_scripts = 0
- # sieve_quota_max_storage = 0
- #}
- service managesieve-login {
- inet_listener sieve {
- port = 4190
- }
- service_count = 1
- process_min_avail = 2
- vsz_limit = 128M
- }
- service managesieve {
- process_limit = 256
- }
- protocol sieve {
- managesieve_logout_format = bytes=%i/%o
- }
- mail_debug = yes
- log_path = /var/log/dovecot.log
- # If you want everything in one file, just don't specify info_log_path and debug_log_path
- info_log_path = /var/log/dovecot-info.log
- # Leave empty in order to send debug-level messages to info_log_path
- debug_log_path = /var/log/dovecot-debug.log
- </code>
- </pre>
- 15-lda.conf
- <pre>
- <code>
- ##
- ## LDA specific settings (also used by LMTP)
- ##
- # Address to use when sending rejection mails.
- # Default is postmaster@<your domain>. %d expands to recipient domain.
- postmaster_address = [email protected]
- # Hostname to use in various parts of sent mails (e.g. in Message-Id) and
- # in LMTP replies. Default is the system's real hostname@domain.
- hostname = example.com
- # If user is over quota, return with temporary failure instead of
- # bouncing the mail.
- #quota_full_tempfail = no
- # Binary to use for sending mails.
- #sendmail_path = /usr/sbin/sendmail
- # If non-empty, send mails via this SMTP host[:port] instead of sendmail.
- #submission_host =
- # Subject: header to use for rejection mails. You can use the same variables
- # as for rejection_reason below.
- #rejection_subject = Rejected: %s
- # Human readable error message for rejection mails. You can use variables:
- # %n = CRLF, %r = reason, %s = original subject, %t = recipient
- #rejection_reason = Your message to <%t> was automatically rejected:%n%r
- # Delimiter character between local-part and detail in email address.
- #recipient_delimiter = +
- # Header where the original recipient address (SMTP's RCPT TO: address) is taken
- # from if not available elsewhere. With dovecot-lda -a parameter overrides this.
- # A commonly used header for this is X-Original-To.
- #lda_original_recipient_header =
- # Should saving a mail to a nonexistent mailbox automatically create it?
- lda_mailbox_autocreate = yes
- # Should automatically created mailboxes be also automatically subscribed?
- lda_mailbox_autosubscribe = yes
- protocol lda {
- # Space separated list of plugins to load (default is global mail_plugins).
- mail_plugins = $mail_plugins sieve
- }
- </code>
- </pre>
- master.cf
- <pre>
- <code>
- #
- # Postfix master process configuration file. For details on the format
- # of the file, see the master(5) manual page (command: "man 5 master" or
- # on-line: http://www.postfix.org/master.5.html).
- #
- # Do not forget to execute "postfix reload" after editing this file.
- #
- # ==========================================================================
- # service type private unpriv chroot wakeup maxproc command + args
- # (yes) (yes) (yes) (never) (100)
- # ==========================================================================
- smtp inet n - - - - smtpd
- #smtp inet n - - - 1 postscreen
- #smtpd pass - - - - - smtpd
- #dnsblog unix - - - - 0 dnsblog
- #tlsproxy unix - - - - 0 tlsproxy
- submission inet n - - - - smtpd
- # -o syslog_name=postfix/submission
- # -o smtpd_tls_security_level=encrypt
- # -o smtpd_sasl_auth_enable=yes
- # -o smtpd_reject_unlisted_recipient=no
- # -o smtpd_client_restrictions=$mua_client_restrictions
- # -o smtpd_helo_restrictions=$mua_helo_restrictions
- # -o smtpd_sender_restrictions=$mua_sender_restrictions
- # -o smtpd_recipient_restrictions=
- # -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
- # -o milter_macro_daemon_name=ORIGINATING
- smtps inet n - - - - smtpd
- # -o syslog_name=postfix/smtps
- -o smtpd_tls_wrappermode=yes
- # -o smtpd_sasl_auth_enable=yes
- # -o smtpd_reject_unlisted_recipient=no
- # -o smtpd_client_restrictions=$mua_client_restrictions
- # -o smtpd_helo_restrictions=$mua_helo_restrictions
- # -o smtpd_sender_restrictions=$mua_sender_restrictions
- # -o smtpd_recipient_restrictions=
- # -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
- # -o milter_macro_daemon_name=ORIGINATING
- #628 inet n - - - - qmqpd
- pickup unix n - - 60 1 pickup
- -o content_filter=
- -o receive_override_options=no_header_body_checks
- cleanup unix n - - - 0 cleanup
- qmgr unix n - n 300 1 qmgr
- #qmgr unix n - n 300 1 oqmgr
- tlsmgr unix - - - 1000? 1 tlsmgr
- rewrite unix - - - - - trivial-rewrite
- bounce unix - - - - 0 bounce
- defer unix - - - - 0 bounce
- trace unix - - - - 0 bounce
- verify unix - - - - 1 verify
- flush unix n - - 1000? 0 flush
- proxymap unix - - n - - proxymap
- proxywrite unix - - n - 1 proxymap
- smtp unix - - - - - smtp
- relay unix - - - - - smtp
- # -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
- showq unix n - - - - showq
- error unix - - - - - error
- retry unix - - - - - error
- discard unix - - - - - discard
- local unix - n n - - local
- virtual unix - n n - - virtual
- lmtp unix - - - - - lmtp
- anvil unix - - - - 1 anvil
- scache unix - - - - 1 scache
- #
- # ====================================================================
- # Interfaces to non-Postfix software. Be sure to examine the manual
- # pages of the non-Postfix software to find out what options it wants.
- #
- # Many of the following services use the Postfix pipe(8) delivery
- # agent. See the pipe(8) man page for information about ${recipient}
- # and other message envelope options.
- # ====================================================================
- #
- # maildrop. See the Postfix MAILDROP_README file for details.
- # Also specify in main.cf: maildrop_destination_recipient_limit=1
- #
- maildrop unix - n n - - pipe
- flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
- #
- # ====================================================================
- #
- # Recent Cyrus versions can use the existing "lmtp" master.cf entry.
- #
- # Specify in cyrus.conf:
- # lmtp cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
- #
- # Specify in main.cf one or more of the following:
- # mailbox_transport = lmtp:inet:localhost
- # virtual_transport = lmtp:inet:localhost
- #
- # ====================================================================
- #
- # Cyrus 2.1.5 (Amos Gouaux)
- # Also specify in main.cf: cyrus_destination_recipient_limit=1
- #
- #cyrus unix - n n - - pipe
- # user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
- #
- # ====================================================================
- # Old example of delivery via Cyrus.
- #
- #old-cyrus unix - n n - - pipe
- # flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
- #
- # ====================================================================
- #
- # See the Postfix UUCP_README file for configuration details.
- #
- uucp unix - n n - - pipe
- flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
- #
- # Other external delivery methods.
- #
- ifmail unix - n n - - pipe
- flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
- bsmtp unix - n n - - pipe
- flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
- scalemail-backend unix - n n - 2 pipe
- flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
- mailman unix - n n - - pipe
- flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
- ${nexthop} ${user}
- #Alex edit
- #dovecot unix - n n - - pipe
- # flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${recipient}
- dovecot unix - n n - - pipe
- flags=ODRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -e -f ${sender} -d ${recipient}
- smtp-amavis unix - - - - 2 smtp
- -o smtp_data_done_timeout=1200
- -o smtp_send_xforward_command=yes
- -o disable_dns_lookups=yes
- -o max_use=20
- -o smtp_tls_security_level=none
- 127.0.0.1:10025 inet n - - - - smtpd
- -o content_filter=
- -o local_recipient_maps=
- -o relay_recipient_maps=
- -o smtpd_restriction_classes=
- -o smtpd_delay_reject=no
- -o smtpd_client_restrictions=permit_mynetworks,reject
- -o smtpd_helo_restrictions=
- -o smtpd_sender_restrictions=
- -o smtpd_recipient_restrictions=permit_mynetworks,reject
- -o smtpd_data_restrictions=reject_unauth_pipelining
- -o smtpd_end_of_data_restrictions=
- -o mynetworks=127.0.0.0/8
- -o smtpd_error_sleep_time=0
- -o smtpd_soft_error_limit=1001
- -o smtpd_hard_error_limit=1000
- -o smtpd_client_connection_count_limit=0
- -o smtpd_client_connection_rate_limit=0
- -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks
- -o smtpd_tls_security_level=none
- </code>
- </pre>
- main.cf
- <pre>
- <code>
- # See /usr/share/postfix/main.cf.dist for a commented, more complete version
- # Debian specific: Specifying a file name will cause the first
- # line of that file to be used as the name. The Debian default
- # is /etc/mailname.
- #myorigin = /etc/mailname
- smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
- biff = no
- # appending .domain is the MUA's job.
- append_dot_mydomain = no
- # Uncomment the next line to generate "delayed mail" warnings
- #delay_warning_time = 4h
- readme_directory = no
- # TLS parameters
- smtpd_tls_cert_file=/etc/postfix/ssl/mailserver.crt
- smtpd_tls_key_file=/etc/postfix/ssl/mailserver.key
- smtpd_use_tls=yes
- smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
- smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
- smtpd_tls_security_level = may
- # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
- # information on enabling SSL in the smtp client.
- smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
- myhostname = debianServer
- alias_maps = hash:/etc/aliases
- alias_database = hash:/etc/aliases
- myorigin = /etc/mailname
- mydestination = virtual_mailbox_domains, example.com, debianServer, localhost.localdomain, localhost
- relayhost =
- mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
- mailbox_command = /usr/lib/dovecot/deliver
- mailbox_transport = dovecot
- mailbox_size_limit = 0
- recipient_delimiter = +
- inet_interfaces = all
- # a bit more spam protection
- disable_vrfy_command = yes
- # Auth
- smtpd_sasl_type=dovecot
- smtpd_sasl_path=private/auth_dovecot
- smtpd_sasl_auth_enable = yes
- smtpd_sasl_authenticated_header = yes
- broken_sasl_auth_clients = yes
- proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $smtpd_sender_login_maps
- smtpd_sender_login_maps = proxy:mysql:/etc/postfix/mysql-sender-login-maps.cf
- smtpd_sender_restrictions = reject_authenticated_sender_login_mismatch
- reject_unknown_sender_domain
- smtpd_recipient_restrictions = permit_sasl_authenticated
- permit_mynetworks
- reject_unauth_destination
- # Virtual mailboxes
- virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual-alias-maps.cf
- virtual_mailbox_base = /var/vmail/
- virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual-domains-maps.cf
- virtual_mailbox_limit = 0
- virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
- virtual_minimum_uid = 104
- virtual_transport = dovecot
- local_transport = virtual
- virtual_uid_maps = static:6000
- virtual_gid_maps = static:6000
- dovecot_destination_recipient_limit = 1
- # Alex EDIT 1337 haxor
- content_filter=smtp-amavis:[127.0.0.1]:10024
- </code>
- </pre>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement