Dovecot Sieve does not run?

You say you had to create the file?

Sounds like you never installed the protocol plugin under dovecot.

  1. First, DO NOT edit (or create) the installed conf files when avoidable. Make your own. Create a /etc/dovecot/local.cf OR /etc/dovecot/conf.d/99-custom.conf (for example).

  2. In newer Dovecot distro versions, the LDA (15-lda.conf) plugin is installed by default, but not the LMTP plugin (20-lmtp.conf). You can use the LDA plugin. (Local Delivery Agent).

  3. If you still wish to use LMTP, you need to install the plugin: sudo apt install dovecot-lmtpd. If you had done that, you wouldn't need to create the .conf file for it.

The pertinent Sieve areas of my /etc/dovecot/local.cf:

protocol imap {

  mail_plugins = autocreate
}
plugin {
   autocreate = Spam
   autosubscribe = Spam
}

# SIEVE STUFF
# Include already included protocols and sieve:
protocols = $protocols sieve

# Allow sieve to be run out of LDA plugin/protocol:
protocol lda {
  mail_plugins = $mail_plugins sieve
}

# Sieve plugin settings
plugin {
   sieve = file:~/sieve;active=~/.dovecot.sieve
   sieve_default = /usr/local/lib/dovecot/sieve/default.sieve
   sieve_global = /usr/local/lib/dovecot/sieve/
}

# May not need this, but it doesn't hurt:
service managesieve-login {
  inet_listener sieve {
    port = 4190
  }
}

The pertinent Sieve areas of my /etc/postfix/main.cf (using dovecot lda/deliver):

mailbox_command = /usr/lib/dovecot/dovecot-lda -f "$SENDER" -a "$RECIPIENT"
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1

My default.sieve:

require ["envelope", "fileinto", "mailbox", "subaddress"];

if header :contains "X-Spam-Flag" "YES" {
        fileinto :create "Spam";
}
if header :contains "X-Amavis-Alert" "BAD HEADER SECTION" {
        fileinto :create "Spam";
}
if address :domain "From" "mydomain.net" {
   if not envelope :domain "From" "mydomain.net" {
      fileinto "Spam";
      stop;
   }
}
if address :domain "From" "mydomain.com" {
   if not envelope :domain "From" "mydomain.com" {
      fileinto "Spam";
      stop;
   }
}

Pertinent area of /etc/amavis/conf.d/50-user (or make your own: 99-custom) :

@local_domains_acl  = ( [ ".$mydomain", '.mydomain.net', '.mydomain.com' ] );
@local_domains_maps = ( [ ".$mydomain", '.mydomain.net', '.mydomain.com' ] );
# Do not quarantine or trash emails - hand off to LDA instead
$final_spam_destiny=D_PASS;
$final_virus_destiny=D_PASS;
$final_bad_header_destiny=D_PASS;
@addr_extension_spam_maps=('Spam');

Restart Dovecot and test port:

# sudo systemctl restart dovecot
# telnet 10.10.10.100 4190
Trying 10.10.10.100...
Connected to 10.10.10.100.
Escape character is '^]'.
"IMPLEMENTATION" "Dovecot (Ubuntu) Pigeonhole"
"SIEVE" "fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext"
"NOTIFY" "mailto"
"SASL" "PLAIN"
"STARTTLS"
"VERSION" "1.0"
OK "Dovecot (Ubuntu) ready."

Dovecot debug output - can see it working:

2019-05-16 15:29:49 lda(emailuser1): Debug: Loading modules from directory: /usr/lib/dovecot/modules
2019-05-16 15:29:49 lda(emailuser1): Debug: Module loaded: /usr/lib/dovecot/modules/lib90_sieve_plugin.so
2019-05-16 15:29:49 lda(emailuser1): Debug: Effective uid=1000, gid=1000, home=/home/emailuser1
2019-05-16 15:29:49 lda(emailuser1): Debug: Namespace inbox: type=private, prefix=, sep=, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/home/emailuser1/Maildir
2019-05-16 15:29:49 lda(emailuser1): Debug: maildir++: root=/home/emailuser1/Maildir, index=, indexpvt=, control=, inbox=/home/emailuser1/Maildir, alt=
2019-05-16 15:29:49 lda(emailuser1): Debug: userdb lookup skipped, username taken from USER environment
2019-05-16 15:29:49 lda(emailuser1): Debug: none: root=, index=, indexpvt=, control=, inbox=, alt=
2019-05-16 15:29:49 lda(emailuser1): Debug: Destination address: [email protected] (source: -a parameter)
2019-05-16 15:29:49 lda(emailuser1): Debug: sieve: Pigeonhole version 0.4.21 (92477967) initializing
2019-05-16 15:29:49 lda(emailuser1): Debug: sieve: file storage: Storage path `/home/emailuser1/sieve' not found
2019-05-16 15:29:49 lda(emailuser1): Debug: sieve: file storage: Storage path `/home/emailuser1/.dovecot.sieve' not found
2019-05-16 15:29:49 lda(emailuser1): Debug: sieve: storage: Trying default script location `/usr/local/lib/dovecot/sieve/default.sieve'
2019-05-16 15:29:49 lda(emailuser1): Debug: sieve: file storage: Using Sieve script path: /usr/local/lib/dovecot/sieve/default.sieve
2019-05-16 15:29:49 lda(emailuser1): Debug: sieve: file script: Opened script `default' from `/usr/local/lib/dovecot/sieve/default.sieve'
2019-05-16 15:29:49 lda(emailuser1): Debug: sieve: Using the following location for user's Sieve script: /usr/local/lib/dovecot/sieve/default.sieve

Sieve now runs. Your question answered.

As far as anything I may have missed - each setup can vary. Please review some articles if you are still stuck. My sieve global rules store quarantine stuff in per-user 'Spam' folders (users are non-virtual). As pointed out, you probably need to edit your postfix main.cf (and master.cf if virtual users/vmail) as noted here to use Dovecot LDA. You also probably need to edit your content-filter (amavis-new for instance) as noted. There are articles out there for this.