Adds mail-support

This commit is contained in:
Hyatt 2020-05-15 11:02:29 -05:00
parent 111a15e393
commit 4da99d1b9e
Signed by: nhyatt
GPG Key ID: C50D0BBB5BC40BEA

@ -40,6 +40,21 @@ ini_set('default_socket_timeout', 2);
\$check_file = '/cert-monitor/checks.json';
\$deleted_check_file = '/cert-monitor/deleted_checks.json';
"""
def MC = """defaults
tls on
tls_certcheck off
tls_starttls on
account default
host example.com
port 25
logfile /var/log/msmtp.log
auto_from on
maildomain smoothnet.org
"""
def AC = """
LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so
LoadModule vhost_alias_module /usr/lib/apache2/modules/mod_vhost_alias.so
@ -68,24 +83,55 @@ LoadModule vhost_alias_module /usr/lib/apache2/modules/mod_vhost_alias.so
FROM php:7-apache
RUN apt-get update && \\
apt-get install -y libicu-dev python2 python-netaddr libcurl4-openssl-dev libonig-dev libxml2-dev && \\
docker-php-ext-install intl bcmath curl mbstring xml && \\
mkdir -p /var/www/html/ssl-decoder /var/www/html/certificate-expiry-monitor /cert-monitor
mkdir -p /var/www/html/ssl-decoder /var/www/html/certificate-expiry-monitor /cert-monitor && \\
apt-get install -y \\
libicu-dev \\
python2 \\
gettext \\
python-netaddr \\
libcurl4-openssl-dev \\
libonig-dev \\
libxml2-dev \\
libglib2.0-dev \\
libgnutls28-dev \\
automake \\
libtool && \\
apt-get clean && \\
printf '%s\\\n' "sendmail_path = /usr/local/bin/msmtp -t -i" >> /usr/local/etc/php/php.ini && \\
cd /tmp && \\
curl -L https://marlam.de/msmtp/releases/msmtp-1.8.8.tar.xz -o msmtp.tar.xz && \\
tar -x -f msmtp.tar.xz && \\
cd msmtp-1.8.8 && \\
autoreconf -i && \\
./configure && \\
make && \\
make install && \\
rm -rf /tmp/msmtp && \\
touch /var/log/msmtp.log && \\
chmod 777 /var/log/msmtp.log && \\
cd /var/www/html && \\
docker-php-ext-install intl bcmath curl mbstring xml
COPY linux-webserver.conf /etc/apache2/sites-enabled/linux-webserver.conf
COPY ssl-decoder /var/www/html/ssl-decoder
COPY certificate-expiry-monitor /var/www/html/certificate-expiry-monitor
COPY variables.php /var/www/html/certificate-expiry-monitor/functions/variables.php
COPY msmtprc /usr/local/etc/msmtprc
RUN printf '%s' "{}" > /cert-monitor/pre_checks.json && \\
printf '%s' "{}" > /cert-monitor/checks.json && \\
printf '%s' "{}" > /cert-monitor/deleted_checks.json && \\
chown -R 33:33 /var/www/html/* /cert-monitor && \\
sed -i '18s/^.*\$/error_reporting(E_ERROR | E_PARSE);/' /var/www/html/ssl-decoder/index.php
sed -i '18s/^.*\$/error_reporting(E_ERROR | E_PARSE);/' /var/www/html/ssl-decoder/index.php && \\
sed -i '18s/^.*\$/error_reporting(E_ERROR | E_PARSE);/' /var/www/html/certificate-expiry-monitor/index.php && \\
sed -i '17s/^.*\$/error_reporting(E_ERROR | E_PARSE);/' /var/www/html/certificate-expiry-monitor/add.php && \\
sed -i '17s/^.*\$/error_reporting(E_ERROR | E_PARSE);/' /var/www/html/certificate-expiry-monitor/confirm.php && \\
sed -i '17s/^.*\$/error_reporting(E_ERROR | E_PARSE);/' /var/www/html/certificate-expiry-monitor/unsubscribe.php
"""
writeFile file: workspace + '/linux-webserver.conf', text: AC
writeFile file: workspace + '/variables.php', text: CE
writeFile file: workspace + '/Dockerfile', text: DF
writeFile file: workspace + '/msmtprc', text: MC
sh '/kaniko/executor --insecure --skip-tls-verify --context "' + workspace + '" -f "' + workspace + '/Dockerfile" --destination registry.test-chamber-13.lan:5000/raymii:latest'
}