summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/smtpctl.c
AgeCommit message (Collapse)Author
2010-06-01new queue, again; gcc2 compile tested by deraadtJacek Masiulaniec
2010-06-01New queue doesn't compile on gcc2, back out. Spotted by deraadt@Jacek Masiulaniec
2010-06-01Include birth time in smtpctl show queue raw.Jacek Masiulaniec
2010-05-31Rewrite entire queue code.Jacek Masiulaniec
Major goals: 1) Fix bad performance caused by the runner process doing full queue read in 1s intervals. My Soekris can now happily accept >50 msg/s while having multi-thousand queue; before, one hundred queue would bring the system to its knees. 2) Introduce Qmail-like scheduler that doesn't write as much to the disk so that it needs less code for servicing error conditions, which in some places can be tricky to get right. 3) Introduce separation between the scheduler and the backend; these two queue aspects shouldn't be too tied too each other. This means that eg. storing queue in SQL requires rewrite of just queue_backend.c. 4) Make on-disk queue format architecture independent, and more easily extensible, to reduce number of flag days in the future. Minor goals: ENOSPC no longer prevents delivery attempts, fixed session limiting for relayed mail, improved batching of "relay via" mails, human-readable mailq output, "show queue raw" command, clearer logging, sending of single bounce about multiple recipients, exact delay= computation, zero delay between deliveries while within session limit (currently 1s delay between re-scheduling is enforced), mta no longer requests content fd, corrected session limit for bounce submissions, tiny <100B queue files instead of multi-KB, detect loops before accepting mail, reduce traffic on imsg channels by killing enormous struct submit_status.
2010-04-21Runner process is just a helper for queue, so tear down its imsgJacek Masiulaniec
channels to parent, mda, mta, lka, smtp, and control. This leaves just the channel to queue, which forwards imsgs on runner's behalf and redirects any replies back to it. OK gilles@
2010-01-10- teach runner how to remove a message from queue given a message id/uidGilles Chehade
and assuming message is not in processing/scheduled state - teach smtpctl how to request message removal from runner discussed with todd@, idea ok jacekm@
2010-01-03Implement "log verbose" and "log brief" to enable or disable verbose debugCharles Longeau
logging on runtime. Based on claudio@'s work on ripd, ospfd, ospf6d, dvmrpd, ldpd, bgpd. With help/ideas/testing from gilles@ jacekm@ todd@ ok jacekm@
2009-12-14Control maximum number of bounce sessions similarly to how the mta and mdaJacek Masiulaniec
are now controlled.
2009-12-14Impose sessions limit on the delivery sessions (mta and mda).Jacek Masiulaniec
2009-12-13Use safe fd limits in smtp, lka, queue, and control. Removes aJacek Masiulaniec
possibility for fd-starvation fatal when under heavy load.
2009-12-13typoJacek Masiulaniec
2009-11-13add missing headers needed by time()Charles Longeau
ok jacekm@
2009-10-25smtpctl reload is work in progress, do not expose it and make sure smtpd'sGilles Chehade
control process does not try to handle it. spotted and reported by martijn@bunix.org
2009-09-12Simplify line len checking: use one limit for all SMTP exchanges.Jacek Masiulaniec
This is not as strict as various RFCs want it, but we can make it more granular later. For now, let all mails flow by using the maximum of all limits found in the RFCs. ok gilles@
2009-09-12cmdlinetoolong stat was incremented at the wrong place, fixGilles Chehade
2009-09-12- fix a compile time warningGilles Chehade
- add a new stats counter to distinguish between command lines which exceeded the limit and data lines which exceeded the limits
2009-09-02Include mbox write errors in "show stats". Suggested by gilles.Jacek Masiulaniec
2009-08-27s/relayd/smtpd/Jacek Masiulaniec
2009-08-08mailq is a common sendmail alias for showing the queue; make smtpctlIan Darwin
implement this, ignoring sendmail options for now. OK gilles@, jackekm@
2009-08-08missing headerGilles Chehade
2009-06-06Sync with relayd:Pierre-Yves Ritschard
Stop pushing event handling in the imsg framework. Instead, provide a small glue layer on top of both imsg and libevent. This finally clearly separates event handling and imsg construction. Sidetrack bonus: remove the mega-ugly hack of having a dummy imsg_event_add stub in smtpctl. ok jaceckm@
2009-06-06if smtpctl is run in unsupported mode, exit with a warning instead ofJacek Masiulaniec
defaulting to smtpctl-mode; aja@ ok
2009-05-30- increment stats.mta.sessions_active when session is allocated in mtaGilles Chehade
- reorder alphabetically and add mta to the statistics
2009-05-27request flood mitigation:Jacek Masiulaniec
1) each state may have 2 responses sent quickly; 2) more responses are delayed exponentially, up to a defined limit. Delay count is user visible (smtp.errors.delays). ok gilles@
2009-05-24Instead of keeping stats private to each process, and querying everyJacek Masiulaniec
process individually whenever stats need to be fetched, keep stats in MAP_ANON shared memory allocated by parent. This means control has direct access to stats and can respond very quickly without troubling any other daemon processes. ok gilles@
2009-05-20fix a pasto causing "smtpctl resume mta" to try to resume mdaGilles Chehade
spotted and diff by giovanni <qgiovanni@gmail.com>
2009-05-18Complete rework of bufferevent event masking allowing for moreJacek Masiulaniec
strictness: - Drop clients attempting command pipelining; protects the daemon from all kinds of abuse. - Replace F_EVLOCKED flag with F_WRITEONLY which has cleaner sematics: when up, session must not be destroyed nor read from, but may be written to. - Write callback becomes a central place for enabling EV_READ. - Delay bufferevent creation until after ssl handshake is completed. A bunch of session error stats were added to smtpctl's "show stats". These could help spotting event masking errors in the future. ok gilles@
2009-04-23sort "show stats" outputJacek Masiulaniec
2009-04-21Make /usr/sbin/sendmail not fail due to smtpd being down.Jacek Masiulaniec
The approach is to save cmdline + stdin in a file under a newly added directory /var/spool/smtpd/offline (uid 0 gid 0 mode 1777). Next time daemon starts, it uses information in that directory to replay sendmail on user's behalf. ok gilles@
2009-04-20Rewrite smtp session timeouts; use evtimer_* from event(3) insteadJacek Masiulaniec
of regularly walking session tree in search of idle clients. Gives the smtp process a chance to become idle. As a bonus, add smtp.sessions.timeout counter to "smtpctl show stats". ok gilles@
2009-04-16Total rewrite of the sendmail interface. Adds support for -t, -v,Jacek Masiulaniec
and -F cmdline args. Also, date and Message-Id headers are added when missing. The main trouble with the current enqueue code is that it requires dealing with problems in the control process that are already solved in the smtp process, ie. duplicating a lot of code which interacts with untrusted clients. This diff solves this by making sendmail obtain a SMTP socket from smtp via smtpd.sock, and using that socket to deliver the message. For smtpd it looks as if connection was made from the network, only difference being the F_MESSAGE_ENQUEUED message flag, handy when differentation between local and remote deliveries is wanted. Most of the features come from the femail program, created by henning@. Additional testing by Nigel J. Taylor. ok gilles@, henning@ happy with smtpd using femail code
2009-04-15s/ssmtp/smtps/; ok gilles@Jacek Masiulaniec
2009-03-23various minor improvements; ok jacekm gillesJason McIntyre
2009-03-22trivial message repair, ok jacek@Ian Darwin
2009-03-15since we are going to share code in smtp sessions and mta sessions, we needGilles Chehade
to also share the statistics structure, still being worked on
2009-03-01In "smtpctl show stats", break queue.inserts into queue.inserts.remoteJacek Masiulaniec
and queue.inserts.local; ok gilles@
2009-02-24teach smtpctl's parser how to deal with parameters that are not necessarilyGilles Chehade
a token so that it is possible to do: smtpctl schedule <message id/uid> introduce F_MESSAGE_FORCESCHEDULE which lets the runner schedule a message even if the retry delay has not been expired. F_MESSAGE_ENQUEUED is a valid flag for a message and should not cause an\ errx() in smtpctl show queue
2009-02-17imsg_init depends on ibuf being calloc'd. fix few places where mallocJacek Masiulaniec
is used instead; ok gilles@ Problem made visible by malloc.conf = AFGJ, and pointed out by otto@
2009-02-13Make stats output more sysctl-like by killing spaces around '='; ok gilles@Jacek Masiulaniec
2009-01-30when decreasing ssl related counters, make sure the session was flagged asGilles Chehade
F_SECURE. while at it, add "smtp.sessions.aborted" which keeps track of sessions which were interrupted before completion.
2009-01-30improve statistics for smtp process. not only collect the current sessionsGilles Chehade
count, but also the total sessions count, ssmtp sessions (both current and total) and starttls sessions (both current and total) # ./smtpctl/smtpctl show stats|grep smtp.sessions smtp.sessions = 0 smtp.sessions.active = 0 smtp.sessions.ssmtp = 0 smtp.sessions.ssmtp.active = 0 smtp.sessions.starttls = 0 smtp.sessions.starttls.active = 0 #
2009-01-30clear the F_EVLOCK flag earlier to prevent the error event handler fromGilles Chehade
being called again with F_EVLOCK set. this fixes a bug where disconnect after smtpd sends greeting and before entering any command failed to go into session_destroy(). while at it, rename the "smtp.clients" statistic to "smtp.sessions" and add counters to struct s_smtp so that I can add ssmtp and starttls with my next commit ;)
2009-01-29fix compiler warningJacek Masiulaniec
2009-01-29Implement "smtpctl show stats"; ok gilles@Jacek Masiulaniec
2009-01-29Common queue walking code for smtpd and smtpctl. Kills majority of showqueue.c,Jacek Masiulaniec
the remaining code was moved to queue_shared.c; ok gilles@
2009-01-27first bricks of enqueue code which allows smtpctl to submit mail to queueGilles Chehade
without "talking" smtp to listeners. currently, a big part of the server side code is done (and requires a cleanup), next step is to get it usable properly from a mail user agent.
2009-01-04- smtp can now pause/resume the accepting of incoming messagesGilles Chehade
- smtpctl recognizes "pause incoming" and "resume incoming" - setup imsg communication between control process and smtp process
2009-01-04- runner is now capable of pausing/resuming the scheduling of deliveriesGilles Chehade
for both mda and mta batches. - smtpctl can be used to disable/enable deliveries at runtime using the pause/resume commands. ok jacekm@
2008-12-27Break showqueue and showrunqueue into 2 words; ok gilles@Jacek Masiulaniec
2008-12-06- teach smtpctl how to inspect queue and runqueue, it supports two commandsGilles Chehade
`showqueue' which displays the content of the queue (all envelopes) `showrunqueue` which displays envelopes scheduled for delivery. The utility will be improved and extended, but for now we need at least this basic support to help debug queue-related issues. Output format is spamdb-alike: type|envelope uid|sender|recipient|last delivery date|retry count ok jacek@