diff --git a/README.md b/README.md index fc9f5bb2..7b4cfa2d 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Functionality changes and additions enable postfix filters, lengthen bantime and findtime * Add fail2ban jails for both above mentioned geoipblocking filters * Add fail2ban filters for web scanners and badbots -* Add solr full text searching to dovecot +* Add xapian full text searching to dovecot * Add rkhunter and chkrootkit * Configure domain names for which only www will be hosted. Edit /etc/miabwwwdomains.conf to configure. * Add some munin plugins diff --git a/conf/cron/miab_solr b/conf/cron/miab_solr deleted file mode 100644 index 7dafd5cc..00000000 --- a/conf/cron/miab_solr +++ /dev/null @@ -1,2 +0,0 @@ -1 */1 * * * root /usr/bin/curl -s http://127.0.0.1:8983/solr/update?commit=true >/dev/null 2>&1 -30 3 * * * root /usr/bin/curl -s http://127.0.0.1:8983/solr/update?optimize=true >/dev/null 2>&1 diff --git a/conf/solr/solr-config-7.7.0.xml b/conf/solr/solr-config-7.7.0.xml deleted file mode 100644 index 3661874d..00000000 --- a/conf/solr/solr-config-7.7.0.xml +++ /dev/null @@ -1,289 +0,0 @@ - - - - - - - 7.7.0 - - - - - - - - - - - - - - - - ${solr.data.dir:} - - - - - - - ${solr.ulog.dir:} - ${solr.ulog.numVersionBuckets:65536} - - - - - ${solr.autoCommit.maxTime:15000} - false - - - - - ${solr.autoSoftCommit.maxTime:-1} - - - - - - - - - - - - - - - - - - - - - - - - true - - - 20 - - - 200 - - - false - - - - - - - - - - - - - - - explicit - 10 - - - - - - _text_ - - - - - - diff --git a/conf/solr/solr-jetty.xml b/conf/solr/solr-jetty.xml deleted file mode 100644 index 27de9994..00000000 --- a/conf/solr/solr-jetty.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - /solr - /usr/share/solr/web - - - - solr.solr.home - /usr/share/solr - - - - - diff --git a/conf/solr/solr-schema-7.7.0.xml b/conf/solr/solr-schema-7.7.0.xml deleted file mode 100644 index 601a290c..00000000 --- a/conf/solr/solr-schema-7.7.0.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - id - diff --git a/conf/solr/solr.service b/conf/solr/solr.service deleted file mode 100644 index ba336584..00000000 --- a/conf/solr/solr.service +++ /dev/null @@ -1,20 +0,0 @@ -[Unit] -Description=Apache SOLR -After=network.target - -[Service] -Type=forking -User=solr -Environment=SOLR_INCLUDE=/etc/default/solr.in.sh -ExecStart=/usr/local/lib/solr/bin/solr start -ExecStop=/usr/local/lib/solr/bin/solr stop -Restart=on-failure -#ReadWritePaths=/var/lib/solr/ -#ReadWritePaths=/var/lib/solr/data/ -LimitNOFILE=65000 -LimitNPROC=65000 -TimeoutSec=180s -PrivateTmp=true - -[Install] -WantedBy=multi-user.target diff --git a/setup/solr.sh b/setup/solr.sh deleted file mode 100644 index caab1bef..00000000 --- a/setup/solr.sh +++ /dev/null @@ -1,166 +0,0 @@ -#!/bin/bash -# -# IMAP search with lucene via solr -# -------------------------------- -# -# By default dovecot uses its own Squat search index that has awful performance -# on large mailboxes. Dovecot 2.1+ has support for using Lucene internally but -# this didn't make it into the Ubuntu packages, so we use Solr instead to run -# Lucene for us. -# -# Solr runs as a Jetty process. The dovecot solr plugin talks to solr via its -# HTTP interface, searching indexed mail and returning results back to dovecot. -# -# Based on https://forum.iredmail.org/topic17251-dovecot-fts-full-text-search-using-apache-solr-on-ubuntu-1804-lts.html -# https://doc.dovecot.org/configuration_manual/fts/solr/ and https://solr.apache.org/guide/8_8/installing-solr.html -# -# solr-jetty package is removed from Ubuntu 21.04 onward. This installation -# therefore depends on manual installation of solr instead of an ubuntu package - -source setup/functions.sh # load our functions -source /etc/mailinabox.conf # load global vars - -# Install packages and basic configuation -# --------------------------------------- - -echo "Installing Solr..." - -apt_install dovecot-solr default-jre-headless - -VERSION=8.8.2 -HASH=7c3e2ed31a4412e7dac48d68c3abd52f75684577 - -needs_update=0 - -if [ ! -f /usr/local/lib/solr/bin/solr ]; then - # not installed yet - needs_update=1 -elif [[ "$VERSION" != `/usr/local/lib/solr/bin/solr version` ]]; then - # checks if the version is what we want - needs_update=1 -fi - -if [ $needs_update == 1 ]; then - # install SOLR - wget_verify \ - "https://www.apache.org/dyn/closer.lua?action=download&filename=lucene/solr/$VERSION/solr-$VERSION.tgz" \ - $HASH \ - /tmp/solr-$VERSION.tgz - - tar xzf /tmp/solr-$VERSION.tgz -C /tmp solr-$VERSION/bin/install_solr_service.sh --strip-components=2 - # install to usr/local, force update, do not start service on installation complete - bash /tmp/install_solr_service.sh /tmp/solr-$VERSION.tgz -i /usr/local/lib -f -n - - rm -f /tmp/solr-$VERSION.tgz - rm -f /tmp/install_solr_service.sh - - # stop and remove the init.d script - rm -f /etc/init.d/solr - update-rc.d solr remove -fi - -# Add security -tools/editconf.py /etc/default/solr.in.sh \ - SOLR_IP_WHITELIST='"127.0.0.1, [::1]"' - -# Change log dir -if [ ! -d "/var/log/solr" ]; then - mkdir /var/log/solr -fi - -chown solr:solr /var/log/solr - -tools/editconf.py /etc/default/solr.in.sh \ - SOLR_LOGS_DIR="/var/log/solr" - -# Install systemd service -cp -f conf/solr/solr.service /lib/systemd/system/solr.service -# hide_output systemctl link -f /lib/systemd/system/solr.service - -# Reload systemctl to pickup the above changes -hide_output systemctl daemon-reload - -# Make sure service is enabled -hide_output systemctl enable solr.service - -# Update the dovecot plugin configuration -# -# Break-imap-search makes search work the way users expect, rather than the way -# the IMAP specification expects. -# https://wiki.dovecot.org/Plugins/FTS/Solr -# "break-imap-search : Use Solr also for indexing TEXT and BODY searches. -# This makes your server non-IMAP-compliant." -tools/editconf.py /etc/dovecot/conf.d/10-mail.conf \ - mail_plugins="fts fts_solr" - -cat > /etc/dovecot/conf.d/90-plugin-fts.conf << EOF; -plugin { - fts = solr - fts_autoindex = yes - fts_solr = url=http://127.0.0.1:8983/solr/dovecot/ -} -EOF - -# Install cronjobs to keep FTS up to date. -hide_output install -m 755 conf/cron/miab_dovecot /etc/cron.daily/ -hide_output install -m 644 conf/cron/miab_solr /etc/cron.d/ - -# Initialize solr dovecot instance -if [ ! -d "/var/solr/data/dovecot" ]; then - # Starting solr might take a while - echo "Starting solr..." - hide_output systemctl restart solr.service - - sudo -u solr /usr/local/lib/solr/bin/solr create -c dovecot - rm -f /var/solr/data/dovecot/conf/schema.xml - rm -f /var/solr/data/dovecot/conf/managed-schema - rm -f /var/solr/data/dovecot/conf/solrconfig.xml - cp -f conf/solr/solr-config-7.7.0.xml /var/solr/data/dovecot/conf/solrconfig.xml - cp -f conf/solr/solr-schema-7.7.0.xml /var/solr/data/dovecot/conf/schema.xml - chown -R solr:solr /var/solr/data/dovecot/conf/* -fi - -# Create new rsyslog config for solr -cat > /etc/rsyslog.d/10-solr.conf < /etc/logrotate.d/solr-systemd <