improve queue management

- add option to put messages in the queue "on hold", preventing delivery
  attempts until taken off hold again.
- add "hold rules", to automatically mark some/all submitted messages as "on
  hold", e.g. from a specific account or to a specific domain.
- add operation to "fail" a message, causing a DSN to be delivered to the
  sender. previously we could only drop a message from the queue.
- update admin page & add new cli tools for these operations, with new
  filtering rules for selecting the messages to operate on. in the admin
  interface, add filtering and checkboxes to select a set of messages to operate
  on.
This commit is contained in:
Mechiel Lukkien
2024-03-18 08:50:42 +01:00
parent 79f1054b64
commit 40ade995a5
19 changed files with 2554 additions and 565 deletions

View File

@ -9,6 +9,7 @@ import (
"os"
"path/filepath"
"testing"
"time"
"github.com/mjl-/mox/dmarcdb"
"github.com/mjl-/mox/dns"
@ -67,19 +68,66 @@ func TestCtl(t *testing.T) {
err := queue.Init()
tcheck(t, err, "queue init")
// "queue"
testctl(func(ctl *ctl) {
ctlcmdQueueList(ctl)
ctlcmdQueueHoldrulesList(ctl)
})
// "queuekick"
// All messages.
testctl(func(ctl *ctl) {
ctlcmdQueueKick(ctl, 0, "", "", "")
ctlcmdQueueHoldrulesAdd(ctl, "", "", "")
})
testctl(func(ctl *ctl) {
ctlcmdQueueHoldrulesAdd(ctl, "mjl", "", "")
})
testctl(func(ctl *ctl) {
ctlcmdQueueHoldrulesAdd(ctl, "", "☺.mox.example", "")
})
testctl(func(ctl *ctl) {
ctlcmdQueueHoldrulesAdd(ctl, "mox", "☺.mox.example", "example.com")
})
testctl(func(ctl *ctl) {
ctlcmdQueueHoldrulesRemove(ctl, 1)
})
// Has entries now.
testctl(func(ctl *ctl) {
ctlcmdQueueHoldrulesList(ctl)
})
// "queuelist"
testctl(func(ctl *ctl) {
ctlcmdQueueList(ctl, queue.Filter{})
})
// "queueholdset"
testctl(func(ctl *ctl) {
ctlcmdQueueHoldSet(ctl, queue.Filter{}, true)
})
// "queueschedule"
testctl(func(ctl *ctl) {
ctlcmdQueueSchedule(ctl, queue.Filter{}, true, time.Minute)
})
// "queuetransport"
testctl(func(ctl *ctl) {
ctlcmdQueueTransport(ctl, queue.Filter{}, "socks")
})
// "queuerequiretls"
testctl(func(ctl *ctl) {
ctlcmdQueueRequireTLS(ctl, queue.Filter{}, nil)
})
// "queuefail"
testctl(func(ctl *ctl) {
ctlcmdQueueFail(ctl, queue.Filter{})
})
// "queuedrop"
testctl(func(ctl *ctl) {
ctlcmdQueueDrop(ctl, 0, "", "")
ctlcmdQueueDrop(ctl, queue.Filter{})
})
// no "queuedump", we don't have a message to dump, and the commands exits without a message.