76 lines
4.0 KiB
Makefile
76 lines
4.0 KiB
Makefile
OT_VER ?= 0.60.2
|
|
OT_SUBVER ?=
|
|
OT_TARBALL = v$(OT_VER).tar.gz
|
|
OT_URL = https://github.com/decalage2/oletools/archive/refs/tags/$(OT_TARBALL)
|
|
|
|
OF_COMMIT ?= e9e593bf29799e3f61023125cbfd5cd3c1338cf4
|
|
OF_TARBALL = $(OF_COMMIT).tar.gz
|
|
OF_URL = https://github.com/HeinleinSupport/olefy/archive/$(OF_TARBALL)
|
|
|
|
RF_COMMIT ?= 66c24d19222f7a21e4cb7c38f1618c909fba47f9
|
|
RF_TARBALL = $(RF_COMMIT).tar.gz
|
|
RF_URL = https://github.com/HeinleinSupport/razorfy/archive/$(RF_TARBALL)
|
|
|
|
preinstall:
|
|
# hardcoded users and groups
|
|
$(inroot) useradd --system --comment="created from appliance building - olefy user" --home-dir="/dev/null" --shell="/sbin/nologin" --no-create-home --uid 603 --user-group olefy
|
|
$(inroot) useradd --system --comment="created from appliance building - razorfy user" --home-dir="/dev/null" --shell="/sbin/nologin" --no-create-home --uid 608 --user-group razorfy
|
|
|
|
install_oletools:
|
|
# oletools zur Office-Macro-Erkennung in rspamd
|
|
$(inroot) test -f /usr/portage/distfiles/$(OT_TARBALL) || \
|
|
$(inroot) wget -P /usr/portage/distfiles $(OT_URL)
|
|
$(inroot) sh -c 'tar xf /usr/portage/distfiles/$(OT_TARBALL) -C /tmp && cd /tmp/oletools-$(OT_VER) && python setup.py install'
|
|
|
|
install_olefy:
|
|
$(inroot) test -f /usr/portage/distfiles/$(OF_TARBALL) || \
|
|
$(inroot) wget -P /usr/portage/distfiles $(OF_URL)
|
|
$(inroot) sh -c 'tar xf /usr/portage/distfiles/$(OF_TARBALL) -C /tmp && cd /tmp/olefy-$(OF_COMMIT) && cp olefy.py /usr/bin && cp olefy.conf /etc && cp olefy.service /etc/systemd/system'
|
|
sed -i 's#/usr/local/bin/#/usr/bin/#' $(CHROOT)/usr/bin/olefy.py
|
|
sed -i 's#/usr/local/bin/#/usr/bin/#' $(CHROOT)/etc/olefy.conf
|
|
sed -i 's#OLEFY_LOGLVL=30#OLEFY_LOGLVL=20#' $(CHROOT)/etc/olefy.conf
|
|
sed -i 's#/usr/local/bin/#/usr/bin/#' $(CHROOT)/etc/systemd/system/olefy.service
|
|
|
|
install_razorfy:
|
|
# razorfy zur Razor-Einbindung in rspamd
|
|
$(inroot) test -f /usr/portage/distfiles/$(RF_TARBALL) || \
|
|
$(inroot) wget -P /usr/portage/distfiles $(RF_URL)
|
|
$(inroot) sh -c 'tar xf /usr/portage/distfiles/$(RF_TARBALL) -C /tmp && cd /tmp/razorfy-$(RF_COMMIT) && cp razorfy.pl /usr/bin && cp razorfy.conf /etc && cp razorfy.service /etc/systemd/system'
|
|
sed -i 's#/usr/local/bin/#/usr/bin/#' $(CHROOT)/etc/systemd/system/razorfy.service
|
|
|
|
configure_redis:
|
|
sed -i 's#maxmemory 64MB#maxmemory 512MB#' $(CHROOT)/etc/redis/redis.conf
|
|
sed -i 's#maxmemory-policy noeviction#maxmemory-policy noeviction\nmaxmemory-policy volatile-ttl#' $(CHROOT)/etc/redis/redis.conf
|
|
|
|
$(CHROOT)/etc/sysctl.d/99-rspamd.conf:
|
|
mkdir -p $(CHROOT)/etc/sysctl.d
|
|
echo "# Empfehlung für rspamd" > $@
|
|
echo "vm.overcommit_memory = 1" >> $@
|
|
|
|
$(CHROOT)/var/lib/mysql: mariadb/my.cnf.root
|
|
# MariaDB-Konfiguration ($$, weil make ein $ entfernt)
|
|
sed -i "s/^character-set-server.*$$/character-set-server = utf8mb4/" $(CHROOT)/etc/mysql/mariadb.d/50-distro-server.cnf
|
|
echo >> $(CHROOT)/etc/mysql/mariadb.d/50-distro-server.cnf
|
|
echo "collation-server = utf8mb4_general_ci" >> $(CHROOT)/etc/mysql/mariadb.d/50-distro-server.cnf
|
|
echo "transaction_isolation = READ-COMMITTED" >> $(CHROOT)/etc/mysql/mariadb.d/50-distro-server.cnf
|
|
echo "binlog_format = ROW" >> $(CHROOT)/etc/mysql/mariadb.d/50-distro-server.cnf
|
|
echo "expire_logs_days = 3" >> $(CHROOT)/etc/mysql/mariadb.d/50-distro-server.cnf
|
|
echo "innodb_file_per_table = 1" >> $(CHROOT)/etc/mysql/mariadb.d/50-distro-server.cnf
|
|
echo "innodb_large_prefix = on" >> $(CHROOT)/etc/mysql/mariadb.d/50-distro-server.cnf
|
|
echo "innodb_buffer_pool_size = 256M" >> $(CHROOT)/etc/mysql/mariadb.d/50-distro-server.cnf
|
|
echo "innodb_strict_mode = OFF" >> $(CHROOT)/etc/mysql/mariadb.d/50-distro-server.cnf
|
|
cp mariadb/my.cnf.root $(CHROOT)/root/.my.cnf
|
|
chmod 0600 $(CHROOT)/root/.my.cnf
|
|
rm -rf $(CHROOT)/var/lib/mysql/*
|
|
RUN bash -c 'yes gentoo | emerge --config dev-db/mariadb'
|
|
|
|
postinstall: install_oletools install_olefy install_razorfy configure_redis $(CHROOT)/etc/sysctl.d/99-rspamd.conf $(CHROOT)/var/lib/mysql
|
|
## # Wegen razorfy muß Perl mit USE=ithreads gebaut werden.
|
|
## # Deswegen müssen auch alle Module neu erstellt werden.
|
|
## $(inroot)perl-cleaner --reallyall
|
|
|
|
# Anpassungen
|
|
$(inroot) usermod -a -G clamav rspamd
|
|
|
|
clean:
|