d78312585eba198dcc02d95c78c9f077629adff3
[dockerfile.git] / nagios / Dockerfile.template
1 # Copyright (C) 2014 W. Trevor King <wking@tremily.us>
2 #
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are met:
5 #
6 # * Redistributions of source code must retain the above copyright notice, this
7 # list of conditions and the following disclaimer.
8 #
9 # * Redistributions in binary form must reproduce the above copyright notice,
10 # this list of conditions and the following disclaimer in the documentation
11 # and/or other materials provided with the distribution.
12 #
13 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
17 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23 # POSSIBILITY OF SUCH DAMAGE.
24
25 FROM ${NAMESPACE}/gentoo-syslog:${TAG}
26 MAINTAINER ${MAINTAINER}
27 #VOLUME ["${PORTAGE}:/usr/portage:ro", "${PORTAGE}/distfiles:/usr/portage/distfiles:rw"]
28 RUN echo 'media-libs/gd jpeg png' >> /etc/portage/package.use
29 RUN echo 'net-analyzer/nagios-core lighttpd' >> /etc/portage/package.use
30 RUN echo 'net-analyzer/nagios-plugins nagios-dns nagios-ntp nagios-ssh' >> /etc/portage/package.use
31 RUN echo 'dev-lang/php cgi' >> /etc/portage/package.use
32 RUN emerge -v net-analyzer/nagios
33 RUN eselect news read new
34 ADD lighttpd-syslog.conf /etc/lighttpd/syslog.conf
35 RUN echo 'include "mod_fastcgi.conf"' >> /etc/lighttpd/lighttpd.conf
36 RUN echo 'include "syslog.conf"' >> /etc/lighttpd/lighttpd.conf
37 ADD lighttpd-nagios.conf /etc/lighttpd/nagios.conf
38 RUN echo 'include "nagios.conf"' >> /etc/lighttpd/lighttpd.conf
39 # https://bugs.gentoo.org/show_bug.cgi?id=528184
40 RUN chmod 755 /etc/nagios
41 RUN sed -i 's|\(#use_timezone=Australia/Brisbane\)|\1\nuse_timezone=UTC|' /etc/nagios/nagios.cfg
42 RUN sed -i 's|\(;date.timezone.*\)|\1\ndate.timezone = "UTC"|' /etc/php/*/php.ini
43 RUN sed -i 's|\(#default_user_name=.*\)|\1\ndefault_user_name=guest|' /etc/nagios/cgi.cfg
44 RUN sed -i 's|\(authorized_for_system_information=.*\)|\1,guest|' /etc/nagios/cgi.cfg
45 RUN sed -i 's|\(authorized_for_configuration_information=.*\)|\1,guest|' /etc/nagios/cgi.cfg
46 RUN sed -i 's|\(authorized_for_all_services=.*\)|\1,guest|' /etc/nagios/cgi.cfg
47 RUN sed -i 's|\(authorized_for_all_hosts=.*\)|\1,guest|' /etc/nagios/cgi.cfg
48 RUN sed -i 's|\(authorized_for_read_only=.*\)|\1,guest|' /etc/nagios/cgi.cfg
49 ADD no-localhost-ssh.patch /usr/local/share/no-localhost-ssh.patch
50 RUN patch -p1 < /usr/local/share/no-localhost-ssh.patch
51 RUN mkdir /etc/nagios/cfg
52 RUN chown nagios:nagios /etc/nagios/cfg
53 RUN sed -i 's|\(#cfg_dir=/etc/nagios/routers.*\)|\1\ncfg_dir=/etc/nagios/cfg|' /etc/nagios/nagios.cfg
54 RUN rc-update add nagios default
55 RUN rc-update add lighttpd default
56
57 EXPOSE 80