-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: /var/mail-state
should not symlink non-existing directories
#4018
fix: /var/mail-state
should not symlink non-existing directories
#4018
Conversation
…king The Getmail service doesn't have a directory in `/var/lib/` by default, yet `mail-state` is configured to symlink it, and the service in DMS is configured to expect `/var/lib/getmail` exists. Handled in `mail-state` logic to ensure it doesn't silently fail.
Existing tests are failing: not ok 30 [Getmail] debug-getmail works as expected in 565ms
# (from function `assert_line' in file test/test_helper/bats-assert/src/assert_line.bash, line 219,
# in test file test/tests/parallel/set1/getmail.bats, line 58)
# `assert_line --regexp 'retriever:.*SimpleIMAPSSLRetriever\(ca_certs="None", certfile="None", getmaildir="\/tmp\/docker-mailserver\/getmail", imap_on_delete="None", imap_search="None", keyfile="None", mailboxes="\(.*INBOX.*\)", move_on_delete="None", ***, password_command="\(\)", port="993", record_mailbox="True", server="imap.remote-service.test", ssl_cert_hostname="None", ssl_ciphers="None", ssl_fingerprints="\(\)", ssl_version="None", timeout="180", use_cram_md5="False", use_kerberos="False", use_peek="True", use_xoauth2="False", username="user3"\)'' failed
#
# -- no output line matches regular expression --
# regexp : retriever:.*SimpleIMAPSSLRetriever\(ca_certs="None", certfile="None", getmaildir="\/tmp\/docker-mailserver\/getmail", imap_on_delete="None", imap_search="None", keyfile="None", mailboxes="\(.*INBOX.*\)", move_on_delete="None", ***, password_command="\(\)", port="993", record_mailbox="True", server="imap.remote-service.test", ssl_cert_hostname="None", ssl_ciphers="None", ssl_fingerprints="\(\)", ssl_version="None", timeout="180", use_cram_md5="False", use_kerberos="False", use_peek="True", use_xoauth2="False", username="user3"\)
# output (22 lines):
# retriever: SimpleIMAPSSLRetriever(ca_certs="None", certfile="None", getmaildir="/var/lib/getmail", imap_on_delete="None", imap_search="None", keyfile="None", mailboxes="('INBOX',)", move_on_delete="None", ***, password_command="()", port="993", record_mailbox="True", server="imap.remote-service.test", ssl_cert_hostname="None", ssl_ciphers="None", ssl_fingerprints="()", ssl_version="None", timeout="180", use_cram_md5="False", use_kerberos="False", use_peek="True", use_xoauth2="False", username="user3")
# destination: MDA_external(allow_root_commands="True", arguments="('-d', 'user3@example.test')", command="deliver", group="None", ignore_stderr="False", path="/usr/lib/dovecot/deliver", pipe_stdout="True", unixfrom="False", user="None")
# options:
# delete : False
# delete_after : 0
# delete_bigger_than : 0
# delivered_to : False
# fingerprint : False
# logfile : logfile(filename="/var/log/mail/getmail-user3.log")
# max_bytes_per_session : 0
# max_message_size : 0
# max_messages_per_session : 500
# message_log : /var/log/mail/getmail-user3.log
# message_log_syslog : False
# message_log_verbose : False
# netrc_file : None
# read_all : False
# received : False
# skip_imap_fetch_size : False
# to_oldmail_on_each_mail : False
# use_netrc : False
# verbose : 0
# --
# I have no idea why the EC lint is failing, though.. |
TL;DR: Seems that
This is due to the logic here: docker-mailserver/target/bin/debug-getmail Lines 10 to 15 in 006f442
Previously since the internal directory never existed in the first place (except I guess as a symlink to nothing) it would fallback to the config volume and configure for that instead... I guess we missed that during review 🤷♂️ It shouldn't store data at locations for different concerns? (runtime state that's usually discardable vs config volume that is generally used to persist anything else) The cronjob (for runtime usage) has the docker-mailserver/target/bin/getmail-cron Lines 3 to 7 in 006f442
More contexthttps://getmail6.org/configuration.html#running-commandline-options
Unlike fetchmail, there is no daemon service or polling, thus the cronjob:
RC files are provided via the config volume and copied over to internal location in docker-mailserver/target/scripts/startup/setup.d/getmail.sh Lines 14 to 16 in 006f442
These all have a base config (which our docs advise mounting directly over instead of supporting via the config volume) but to be practical with DMS needs to configure to deliver over to Dovecot: docker-mailserver/test/config/getmail/getmail-user3.cf Lines 1 to 11 in 006f442
I'm not sure why this even needs to be in DMS beyond convenience, there isn't anything specific about it to integrate from the looks of it. Although that's probably the same case with fetchmail. Although there's this interesting FAQ entry from the original getmail author criticizing fetchmail.
So any existing users of the feature either have had mail delivered to Dovecot as per guidance in the docs, or it's been stored in |
Description
/var/lib/getmail/
doesn't seem like it should have been introduced. Drop it in favor of/tmp/docker-mailserver/getmail
. It appears to be for storing remote mail that was retrieved if not configured to send to Dovecot like our docs advise. This location was never valid anyway (as referenced issue covers).Fetchmail debug command force enabled the feature to avoid requiring the ENV. Probably before a release when we moved the(EDIT: Sorry lacking time to support this unrelated change due to a test case reliance on it, reverted)setup
CLI into the container itself. Since the feature setup script called already gates on the feature ENV toggle and outputs a debug log when disabled... don't implicitly enable the feature.Original message
/var/lib/
by default, yetmail-state
is configured to symlink it, and the service in DMS is configured to expect/var/lib/getmail
exists.Handled in(EDIT: Just realized this won't solve it due to the condition it's in 😂 )mail-state
logic to ensure it doesn't silently fail.It should probably skip the symlink in this case and omit an error to the logs? Quick fix would be to have the Getmail service startup script itself ensure the directory is configured.
Fixes #4015
Type of change
Checklist
CHANGELOG.md