aptitude install dovecot-sieve dovecot-managesieved

/etc/dovecot/conf.d/15-lda.conf

# Address to use when sending rejection mails.
# Default is postmaster@<your domain>.
postmaster_address = mail@domain.tld

protocol lda {
   # Space separated list of plugins to load (default is global mail_plugins).
   mail_plugins = $mail_plugins sieve
}

/etc/dovecot/conf.d/20-managesieve.conf

service managesieve-login {
   inet_listener sieve {
      port = 4190
   }
}

Edit /etc/procmailrc and fill in the DELIVER parts. I’ts important to make continued use of procmail because spam filtering is done there.

# cat /etc/procmailrc

DELIVER=/usr/lib/dovecot/deliver
LOGFILE=/var/log/procmail.log
TRAP=/etc/webmin/virtual-server/procmail-logger.pl
:0wi
VIRTUALMIN=|/etc/webmin/virtual-server/lookup-domain.pl $LOGNAME
EXITCODE=$?
:0
* ?/usr/bin/test "$EXITCODE" = "73"
/dev/null
EXITCODE=0
:0
* ?/usr/bin/test "$VIRTUALMIN" != ""
{
INCLUDERC=/etc/webmin/virtual-server/procmail/$VIRTUALMIN
}
DEFAULT=$HOME/Maildir/
ORGMAIL=$HOME/Maildir/
DROPPRIVS=yes
:0 w
| $DELIVER
:0
$DEFAULT

You may want to enable the possibility to manage filters in Roundcube by editing its main.inc.php:

// List of active plugins (in plugins/ directory)
$rcmail_config['plugins'] = array('virtuser_file', 'managesieve');