remove ClamAV because of GPL and started work on read-only filesystem

This commit is contained in:
bunkerity
2021-05-26 17:18:49 +02:00
parent a8bc17e836
commit a991b262ef
24 changed files with 91 additions and 69 deletions

View File

@@ -1,18 +0,0 @@
#!/bin/bash
# load some functions
. /opt/entrypoint/utils.sh
# clamav setup
if [ "$(has_value USE_CLAMAV_UPLOAD yes)" != "" ] || [ "$USE_CLAMAV_SCAN" = "yes" ] ; then
echo "[*] Updating clamav (in background) ..."
freshclam > /dev/null 2>&1 &
echo "$CLAMAV_UPDATE_CRON /usr/bin/freshclam > /dev/null 2>&1" >> /etc/crontabs/nginx
fi
if [ "$USE_CLAMAV_SCAN" = "yes" ] ; then
if [ "$USE_CLAMAV_SCAN_REMOVE" = "yes" ] ; then
echo "$USE_CLAMAV_SCAN_CRON /usr/bin/clamscan -r -i --no-summary --remove / >> /var/log/clamav.log 2>&1" >> /etc/crontabs/nginx
else
echo "$USE_CLAMAV_SCAN_CRON /usr/bin/clamscan -r -i --no-summary / >> /var/log/clamav.log 2>&1" >> /etc/crontabs/nginx
fi
fi

View File

@@ -17,6 +17,7 @@ function trap_reload() {
echo "[*] Catched reload operation"
if [ "$MULTISITE" = "yes" ] && [ "$SWARM_MODE" != "yes" ] ; then
/opt/entrypoint/certbot.sh
/opt/entrypoint/jobs.sh
fi
if [ -f /tmp/nginx.pid ] ; then
echo "[*] Reloading nginx ..."
@@ -33,7 +34,7 @@ function trap_reload() {
trap "trap_reload" HUP
# do the configuration magic if needed
if [ ! -f "/opt/installed" ] ; then
if [ ! -f "/etc/nginx/global.env" ] ; then
echo "[*] Configuring bunkerized-nginx ..."
@@ -47,9 +48,6 @@ if [ ! -f "/opt/installed" ] ; then
exit 1
fi
# clamav config
/opt/entrypoint/clamav.sh
# start temp nginx to solve Let's Encrypt challenges if needed
/opt/entrypoint/nginx-temp.sh
@@ -67,8 +65,6 @@ if [ ! -f "/opt/installed" ] ; then
# certbot
/opt/entrypoint/certbot.sh
fi
touch /opt/installed
else
echo "[*] Skipping configuration process"
fi
@@ -98,7 +94,7 @@ pid="$!"
if [ "$1" == "test" ] ; then
sleep 10
echo -n "autotest" > /www/index.html
check=$(curl "http://localhost:${HTTP_PORT}" 2> /dev/null)
check=$(curl "http://localhost:8080")
if [ "$check" == "autotest" ] ; then
exit 0
fi

View File

@@ -4,7 +4,7 @@
. /opt/entrypoint/utils.sh
# GeoIP
if [ "$BLACKLIST_COUNTRY" != "" ] || [ "$WHITELIST_COUNTRY" != "" ] ; then
if [ "$(has_value BLACKLIST_COUNTRY .+)" != "" ] || [ "$(has_value WHITELIST_COUNTRY .+)" != "" ] ; then
if [ -f "/cache/geoip.mmdb" ] ; then
echo "[*] Copying cached geoip.mmdb ..."
cp /cache/geoip.mmdb /etc/nginx/geoip.mmdb

View File

@@ -24,20 +24,13 @@ function spaces_to_lua() {
# check if at least one env var (global or multisite) has a specific value
function has_value() {
if [ -f "/etc/nginx/site.env" ] ; then
if [ $(grep "^${1}=${2}$" /etc/nginx/site.env) != "" ] ; then
envs=$(find /etc/nginx -name "*.env")
for file in $envs ; do
if [ "$(grep "^${1}=${2}$" $file)" != "" ] ; then
echo "ok"
return 0
fi
else
servers=$(find /etc/nginx -name "site.env" | cut -d '/' -f 4)
for server in $servers ; do
if [ $(grep "^${1}=${2}$" /etc/nginx/$server/site.env) != "" ] ; then
echo "ok"
return 0
fi
done
fi
done
}
# log to jobs.log