[exim] Re: Fwd: Can I tell exim to accept messages and queue them rather than send them on?
On 10/02/2024 05:58, Andreas Metzler via Exim-users wrote: I'm going to be replacing our mail nodes over the next few weeks and I've been sequencing events in the move. It would be very handy if it were possible to tell one of my nodes to keep accepting mail but to stop trying to deliver it. Can this be done? If so, how? I suspect the answer is no, but I'll gladly be told otherwise. ... queue_only and queue_only_file. You'd have to also stop your queue-runners (probably, modify the daemon startup cmdline to lose the "-q5m" or similar). -- Cheers, Jeremy -- ## subscription configuration (requires account): ## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/ ## unsubscribe (doesn't require an account): ## exim-users-unsubscr...@lists.exim.org ## Exim details at http://www.exim.org/ ## Please use the Wiki with this list - http://wiki.exim.org/
[exim] Re: locking et al.
So, taking j...@wizmail.org URL: https://exim.org/exim-html-current/doc/html/spec_html/ch-the_appendfile_transport.html I see the text: (I've added **highlights**) ...Before appending to a file, a number of security checks are made, and the file is locked. A detailed description is given below, after the list of private options. ... The file option specifies a single file, to which the message is appended. One or more of use_fcntl_lock, use_flock_lock, or use_lockfile must be set with file ... use_fcntl_lock Use: appendfile Type: boolean Default: see below This option controls the use of the fcntl() function to lock a file for exclusive use when a message is being appended. **It is set by default unless use_flock_lock is set.** So this is set by default UNLESS ...one of the other locking options is chosen: If I do: root@ybox:/var/lib/exim4# grep -i use_ /var/lib/exim4/config.autogenerated root@ybox:/var/lib/exim4# grep -i lock /var/lib/exim4/config.autogenerated And I note, I have in that same file: mail_spool: debug_print = "T: appendfile for $local_part@$domain" driver = appendfile file = /var/mail/$local_part_data delivery_date_add envelope_to_add return_path_add group = mail mode = 0660 mode_fail_narrower = false So I take these together to mean: exim will use "apendfile" to append mail to /var/mail/ and it will use fcntl(2) (I'm assuming advisory locking?) So I (may need to) just ensure maildrop(1) also uses fcntl(2) locking FYI, my concern is the end of one of my maildrop configs, which ends: if ("$ADDRLIST" ne "") { log "@ in maildrop.manual $NOW, will send (using /etc/maildroprc.manual) copies like this: $ADDRLIST [SENDMAIL=$SENDMAIL]" # Spaces at the start really mess it up ADDRLIST=substr($ADDRLIST,1) to '!'"$ADDRLIST" } else { log "@ in maildrop.manual $NOW, no routing found, will drop through to DEFAULT=$DEFAULT" } So if it uses [ to '!'"$ADDRLIST" ] then it will pass the message to SMTP (aka exim4) and exim4 will write to e.g. /var/mail/myuserid ... or if it drops through, then maildrop will write to (the file) $DEFAULT, which could well be /var/mail/myuserid. Now I can't actually work out a case where 2 instances of this could be running simultaneously, but I'm just nervous of two different bits of code writing to the same file. I'm reasonably confident exim4 would protect itself from another exim4 instance and likewise maildrop. I think I'll go back to maildrop and see why I saw flock(2) getting used an if it can use fcntl(2) instead. From maildrop: --enable-use-flock=flag - if this option is set to 1, maildrop will use either the flock(), the lockf(), or the fcntl() system call to lock a mailbox file when delivering a message. **On most systems, all three use compatible locking mechanisms.** In some very isolated cases, flock(), lockf(), and fcntl(), are different, incompatible, locking mechanisms. maildrop must use the same locking mechanism as any mail reading programs. The configuration script will run some tests to determine what locking function calls are available, and will choose one by itself. The --with-locking-method can be used to manually choose the locking function call to use. --with-locking-method=name - manually select a locking function call. name is either "fcntl", "flock", or "lockf". Otherwise the configuration script will pick one by itself. The comment there is somewhat at odds, to the flock(2) man page: NOTES Since kernel 2.0, flock() is implemented as a system call in its own right rather than being emulated in the GNU C library as a call to fc‐ ntl(2). With this implementation, **there is no interaction between the types of lock placed by flock() and fcntl(2),** and flock() does not de‐ tect deadlock. ... I'm probably worrying about nothing, this is a standard Debian install and this same issue exists for Thunderbird, pine, mutt etc so I suspect it was "sorted out" during the packaging. -- ## subscription configuration (requires account): ## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/ ## unsubscribe (doesn't require an account): ## exim-users-unsubscr...@lists.exim.org ## Exim details at http://www.exim.org/ ## Please use the Wiki with this list - http://wiki.exim.org/
[exim] Re: locking et al.
On 2024-02-10 graeme vetterlein via Exim-users wrote: > So, taking j...@wizmail.org URL: > https://exim.org/exim-html-current/doc/html/spec_html/ch-the_appendfile_transport.html > I see the text: (I've added **highlights**) [...] > use_fcntl_lock Use: appendfile Type: boolean Default: see below > This option controls the use of the fcntl() function to lock a file for > exclusive use when a message is being appended. **It is set by default > unless > use_flock_lock is set.** > So this is set by default UNLESS ...one of the other locking options is > chosen: > If I do: > root@ybox:/var/lib/exim4# grep -i use_ /var/lib/exim4/config.autogenerated [...] > exim will use "apendfile" to append mail to /var/mail/ > and it will use fcntl(2) (I'm assuming advisory locking?) ametzler@argenau:~$ /usr/sbin/exim4 -bP transport mail_spool | grep use_fcntl use_fcntl_lock > So I (may need to) just ensure maildrop(1) also uses fcntl(2) locking [...] > From maildrop: [...] > --with-locking-method=name - manually select a locking function call. name > is either "fcntl", "flock", or "lockf". Otherwise the configuration > script will pick one by itself. [...] Looking at https://salsa.debian.org/debian/maildrop/-/blob/master/debian/rules?ref_type=heads we find: --with-locking-method=fcntl cu Andreas -- `What a good friend you are to him, Dr. Maturin. His other friends are so grateful to you.' `I sew his ears on from time to time, sure' -- ## subscription configuration (requires account): ## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/ ## unsubscribe (doesn't require an account): ## exim-users-unsubscr...@lists.exim.org ## Exim details at http://www.exim.org/ ## Please use the Wiki with this list - http://wiki.exim.org/
[exim] Re: locking et al.
On 10/02/2024 16:24, graeme vetterlein via Exim-users wrote: mail_spool: debug_print = "T: appendfile for $local_part@$domain" driver = appendfile file = /var/mail/$local_part_data delivery_date_add envelope_to_add return_path_add group = mail mode = 0660 mode_fail_narrower = false So I take these together to mean: exim will use "apendfile" to append mail to /var/mail/ ONLY IF this transport is the one being used for your delivery. The delivery lines ("=>") in the log should give a hint. and it will use fcntl(2) (I'm assuming advisory locking?) I'm assuming you've read it right. Yes, "fcntl" does an F_SETLOCKW. If you're really nervous, I spot a debug output in the transport code which says what sort of locking method is being used. -- Cheers, Jeremy PS: "Exim". Not "Exim 4" (unless you're a committed Debian-ite), Version 3 of Exim went obsolete twenty years ago. There is no Exim 3, nor Exim 5. -- ## subscription configuration (requires account): ## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/ ## unsubscribe (doesn't require an account): ## exim-users-unsubscr...@lists.exim.org ## Exim details at http://www.exim.org/ ## Please use the Wiki with this list - http://wiki.exim.org/
[exim] Re: locking et al.
On Sat, 10 Feb 2024, graeme vetterlein via Exim-users wrote: ... I'm probably worrying about nothing, this is a standard Debian install and this same issue exists for Thunderbird, pine, mutt etc If you are being paranoid, I'll mention that if you are mounting the file system over the network (traditionally NFS, but samba/SMB/CIFS or fuse would be significant too) you need to check how/whether locking works on that file system. -- Andrew C. Aitchison Kendal, UK and...@aitchison.me.uk -- ## subscription configuration (requires account): ## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/ ## unsubscribe (doesn't require an account): ## exim-users-unsubscr...@lists.exim.org ## Exim details at http://www.exim.org/ ## Please use the Wiki with this list - http://wiki.exim.org/