DB encryption support

This commit is contained in:
Alexey Pustovalov
2020-04-28 17:21:46 +03:00
parent acbd134c44
commit 3f1cd26716
38 changed files with 739 additions and 172 deletions

View File

@ -80,9 +80,9 @@ RUN set -eux && \
rm -rf tests && \
./locale/make_mo.sh && \
ln -s "/etc/zabbix/web/zabbix.conf.php" "/usr/share/zabbix/conf/zabbix.conf.php" && \
chown --quiet -R zabbix:root /etc/zabbix/ /usr/share/zabbix/conf/ && \
chgrp -R 0 /etc/zabbix/ /usr/share/zabbix/conf/ && \
chmod -R g=u /etc/zabbix/ /usr/share/zabbix/conf/ && \
chown --quiet -R zabbix:root /etc/zabbix/ /usr/share/zabbix/conf/ /usr/share/zabbix/modules/ && \
chgrp -R 0 /etc/zabbix/ /usr/share/zabbix/conf/ /usr/share/zabbix/modules/ && \
chmod -R g=u /etc/zabbix/ /usr/share/zabbix/conf/ /usr/share/zabbix/modules/ && \
chown --quiet -R zabbix:root /etc/apache2/ /etc/php7/ && \
chgrp -R 0 /etc/apache2/ /etc/php7/ && \
chmod -R g=u /etc/apache2/ /etc/php7/ && \
@ -94,7 +94,7 @@ EXPOSE 8080/TCP 8443/TCP
WORKDIR /usr/share/zabbix
VOLUME ["/etc/ssl/apache2"]
VOLUME ["/etc/ssl/apache2", "/usr/share/zabbix/modules/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"]

View File

@ -178,8 +178,12 @@ check_db_connect() {
WAIT_TIMEOUT=5
if [ "${ZBX_DB_ENCRYPTION}" == "true" ]; then
ssl_opts="--ssl --ssl-ca=${ZBX_DB_CA_FILE} --ssl-key=${ZBX_DB_KEY_FILE} --ssl-cert=${ZBX_DB_CERT_FILE}"
fi
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
--password="${DB_SERVER_ROOT_PASS}" --silent --connect_timeout=10)" ]; do
--password="${DB_SERVER_ROOT_PASS}" --silent --connect_timeout=10 $ssl_opts)" ]; do
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
sleep $WAIT_TIMEOUT
done
@ -236,6 +240,10 @@ prepare_zbx_web_config() {
history_storage_url=$(escape_spec_char "${ZBX_HISTORYSTORAGEURL}")
history_storage_types=$(escape_spec_char "${ZBX_HISTORYSTORAGETYPES}")
ZBX_DB_KEY_FILE=$(escape_spec_char "${ZBX_DB_KEY_FILE}")
ZBX_DB_CERT_FILE=$(escape_spec_char "${ZBX_DB_CERT_FILE}")
ZBX_DB_CA_FILE=$(escape_spec_char "${ZBX_DB_CA_FILE}")
sed -i \
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \