1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-12-25 07:47:05 +00:00

Fixes for 20.04 version

This commit is contained in:
Jan van de Wijdeven 2021-04-11 23:09:41 +02:00
parent daf5a62e83
commit d9629caab7
5 changed files with 36 additions and 14 deletions

View File

@ -2,9 +2,6 @@ source setup/functions.sh
echo Installing geoip packages... echo Installing geoip packages...
# Install some packages
apt_install geoip-database-extra libgeoip1 libnginx-mod-http-geoip
# geo ip filtering of ssh entries, based on https://www.axllent.org/docs/ssh-geoip/#disqus_thread # geo ip filtering of ssh entries, based on https://www.axllent.org/docs/ssh-geoip/#disqus_thread
# Install geo ip lookup tool # Install geo ip lookup tool
@ -21,6 +18,7 @@ fi
# Install geo ip filter script # Install geo ip filter script
cp -f setup/geoipfilter.sh /usr/local/bin/ cp -f setup/geoipfilter.sh /usr/local/bin/
chmod +x /usr/local/bin/geoipfilter.sh
# Install only if not yet exists, to keep user config # Install only if not yet exists, to keep user config
if [ ! -f /etc/geoiplookup.conf ]; then if [ ! -f /etc/geoiplookup.conf ]; then
@ -60,7 +58,7 @@ hide_output wget -P /usr/share/GeoIP/ https://dl.miyuru.lk/geoip/maxmind/country
if [ -f "/usr/share/GeoIP/maxmind.dat.gz" ]; then if [ -f "/usr/share/GeoIP/maxmind.dat.gz" ]; then
gunzip -c /usr/share/GeoIP/maxmind.dat.gz > /usr/share/GeoIP/GeoIP.dat gunzip -c /usr/share/GeoIP/maxmind.dat.gz > /usr/share/GeoIP/GeoIP.dat
else else
echo Did not correctly download maxmind geoip database echo Did not correctly download maxmind geoip country database
fi fi
# If new file is not created, move the old file back # If new file is not created, move the old file back
@ -72,5 +70,25 @@ if [ ! -f "/usr/share/GeoIP/GeoIP.dat" ]; then
fi fi
fi fi
# Restart nginx # Move old file away if it exists
restart_service nginx if [ -f "/usr/share/GeoIP/GeoIPCity.dat" ]; then
mv -f /usr/share/GeoIP/GeoIPCity.dat /usr/share/GeoIP/GeoIPCity.dat.bak
fi
hide_output wget -P /usr/share/GeoIP/ https://dl.miyuru.lk/geoip/maxmind/city/maxmind.dat.gz
if [ -f "/usr/share/GeoIP/maxmind.dat.gz" ]; then
gunzip -c /usr/share/GeoIP/maxmind.dat.gz > /usr/share/GeoIP/GeoIPCity.dat
else
echo Did not correctly download maxmind geoip city database
fi
# If new file is not created, move the old file back
if [ ! -f "/usr/share/GeoIP/GeoIPCity.dat" ]; then
echo GeoIPCity.dat was not created
if [ -f "/usr/share/GeoIP/GeoIPCity.dat.bak" ]; then
mv /usr/share/GeoIP/GeoIPCity.dat.bak /usr/share/GeoIP/GeoIPCity.dat
fi
fi

View File

@ -43,7 +43,7 @@ InstallNextcloud() {
rm -f /tmp/nextcloud.zip rm -f /tmp/nextcloud.zip
# Empty the skeleton dir to save some space for each new user # Empty the skeleton dir to save some space for each new user
rm -f /usr/local/lib/owncloud/core/skeleton/* rm -rf /usr/local/lib/owncloud/core/skeleton/*
# The two apps we actually want are not in Nextcloud core. Download the releases from # The two apps we actually want are not in Nextcloud core. Download the releases from
# their github repositories. # their github repositories.

View File

@ -105,6 +105,7 @@ EOF
# Start service configuration. # Start service configuration.
source setup/system.sh source setup/system.sh
source setup/geoiptoolssetup.sh
source setup/ssl.sh source setup/ssl.sh
source setup/dns.sh source setup/dns.sh
source setup/mail-postfix.sh source setup/mail-postfix.sh
@ -118,7 +119,6 @@ source setup/nextcloud.sh
#source setup/zpush.sh #source setup/zpush.sh
source setup/management.sh source setup/management.sh
source setup/munin.sh source setup/munin.sh
source setup/geoiptoolssetup.sh
source setup/additionals.sh source setup/additionals.sh
# Wait for the management daemon to start... # Wait for the management daemon to start...

View File

@ -245,7 +245,6 @@ if [ -z "${DISABLE_FIREWALL:-}" ]; then
SSH_PORT=$(sshd -T 2>/dev/null | grep "^port " | sed "s/port //") #NODOC SSH_PORT=$(sshd -T 2>/dev/null | grep "^port " | sed "s/port //") #NODOC
if [ ! -z "$SSH_PORT" ]; then if [ ! -z "$SSH_PORT" ]; then
if [ "$SSH_PORT" != "22" ]; then if [ "$SSH_PORT" != "22" ]; then
echo Opening alternate SSH port $SSH_PORT. #NODOC echo Opening alternate SSH port $SSH_PORT. #NODOC
ufw_limit $SSH_PORT #NODOC ufw_limit $SSH_PORT #NODOC
else else
@ -314,6 +313,11 @@ if ! grep -q "listen-on " /etc/bind/named.conf.options; then
# Add a listen-on directive if it doesn't exist inside the options block. # Add a listen-on directive if it doesn't exist inside the options block.
sed -i "s/^}/\n\tlisten-on { 127.0.0.1; };\n}/" /etc/bind/named.conf.options sed -i "s/^}/\n\tlisten-on { 127.0.0.1; };\n}/" /etc/bind/named.conf.options
fi fi
if ! grep -q "listen-on-v6 " /etc/bind/named.conf.options; then
# Add a listen-on-v6 directive if it doesn't exist inside the options block.
sed -i "s/^}/\n\tlisten-on-v6 { ::1; };\n}/" /etc/bind/named.conf.options
fi
if ! grep -q "max-recursion-queries " /etc/bind/named.conf.options; then if ! grep -q "max-recursion-queries " /etc/bind/named.conf.options; then
# Add a max-recursion-queries directive if it doesn't exist inside the options block. # Add a max-recursion-queries directive if it doesn't exist inside the options block.
sed -i "s/^}/\n\tmax-recursion-queries 100;\n}/" /etc/bind/named.conf.options sed -i "s/^}/\n\tmax-recursion-queries 100;\n}/" /etc/bind/named.conf.options

View File

@ -19,7 +19,7 @@ fi
echo "Installing Nginx (web server)..." echo "Installing Nginx (web server)..."
apt_install nginx php-cli php-fpm idn2 apt_install nginx php-cli php-fpm idn2 libnginx-mod-http-geoip
rm -f /etc/nginx/sites-enabled/default rm -f /etc/nginx/sites-enabled/default