feat(fetchmail): added fetchmail

cron job to run fetchmail script to get fetchmail config from roundcube
mysql database.

MR !1
This commit is contained in:
2022-02-14 09:53:57 +09:30
parent a7c1ae052c
commit ace2493f66
4 changed files with 55 additions and 0 deletions

View File

@ -43,6 +43,21 @@ RUN apt update && DEBIAN_FRONTEND=noninteractive apt -y --no-install-recommends
libmailtools-perl=2.21-1 \
fam=2.7.0-17.3 \
libnet-dns-perl=1.29-1 \
# Fetchmail
fetchmail=6.4.16-4+deb11u1 \
# Perl Modules for fetchmail.pl
# DBI
libdbix-easy-perl \
# LockFile::Simple
liblockfile-simple-perl \
# DBD::mysql
libclass-dbi-mysql-perl \
# Sys::Syslog
liblogger-syslog-perl \
# LockFile::Simple
libio-lockedfile-perl
# Cleanup, remove cron jobs not required
RUN rm -f /etc/cron.d/e2scrub_all \
&& rm -f /etc/cron.daily/apt-compat \
@ -88,6 +103,13 @@ RUN chmod +x /docker-entrypoint.sh \
# Spammassassin related Commands
&& mkdir -p /var/spool/spamassassin \
&& chmod 777 /var/spool/spamassassin \
# Ensure spamassassin related scripts are executable
&& chmod +x /bin/spam-learn.sh \
# fetchmail.pl setup
&& curl -o /bin/fetchmail.pl https://raw.githubusercontent.com/postfixadmin/postfixadmin/8f20c96278a694a7e0bb570f1d56c208105e5a14/ADDITIONS/fetchmail.pl \
&& chmod +x /bin/fetchmail.pl \
&& mkdir -p /var/run/fetchmail \
&& mkdir -p /var/lock/fetchmail
# Setup data volumes

View File

@ -31,6 +31,8 @@ do
done
mkdir -p /var/lock/fetchmail
if [ "$1" == "setup" ]; then

View File

@ -0,0 +1,7 @@
#
# SpamAssassin Bayes learning from mailboxes
#
# m h dom mon dow user command
#1,31 * * * * root if [ "0$USE_FETCHMAIL_PL" != "0" ]; then /bin/fetchmail.pl 2>&1; fi
1,31 * * * * root if [ "0$USE_FETCHMAIL_PL" != "0" ]; then echo /bin/fetchmail.pl 2>&1; fi

View File

@ -0,0 +1,24 @@
# database settings
# database backend - uncomment one of these
our $db_type = 'mysql';
#my $db_type = 'mysql';
# host name
our $db_host="mysql";
# database name
our $db_name="roundcube";
# database username
our $db_username="roundcube";
# database password
our $db_password="roundcube";
# Where to create a lockfile; please ensure path exists.
our $run_dir="/var/lock/fetchmail";
# in case you want to use dovecot deliver to put the mail directly into the users mailbox,
# set "mda" in the fetchmail table to the keyword "dovecot".
# Where the delivery binary is located
$dovecot_deliver = "/usr/lib/dovecot/dovecot-lda";