add cli command "mox admin imapserve $preauthaddress"

for admins to open an imap connection preauthenticated for an account (by address), also when
it is disabled for logins.

useful for migrations. the admin typically doesn't know the password of the
account, so couldn't get an imap session (for synchronizing) before.

tested with "mox localserve" and running:

	mutt -e 'set tunnel="MOXCONF=/home/mjl/.config/mox-localserve/mox.conf ./mox admin imapserve mox@localhost"'

may also work with interimap, but untested.

i initially assumed imap would be done fully on file descriptor 0, but mutt
expects imap output on fd 1. that's the default now. flag -fd0 is for others
that expect it on fd0.

for issue #175, suggested by DanielG
This commit is contained in:
Mechiel Lukkien
2025-01-25 22:18:26 +01:00
parent 2d3d726f05
commit 49e2eba52b
11 changed files with 141 additions and 14 deletions

13
doc.go
View File

@ -89,6 +89,7 @@ any parameters. Followed by the help and usage information for each command.
mox config printservice >mox.service
mox config ensureacmehostprivatekeys
mox config example [name]
mox admin imapserve preauth-address
mox checkupdate
mox cid cid
mox clientconfig domain
@ -1204,6 +1205,18 @@ List available config examples, or print a specific example.
usage: mox config example [name]
# mox admin imapserve
Initiate a preauthenticated IMAP connection on file descriptor 0.
For use with tools that can do IMAP over tunneled connections, e.g. with SSH
during migrations. TLS is not possible on the connection, and authentication
does not require TLS.
usage: mox admin imapserve preauth-address
-fd0
write IMAP to file descriptor 0 instead of stdout
# mox checkupdate
Check if a newer version of mox is available.