update to 4.2.2 [release 4.2.2-1mamba;Fri Nov 11 2016]

This commit is contained in:
Silvan Calarco 2024-01-06 07:30:34 +01:00
parent 1925cc6cdf
commit 289d141c05
4 changed files with 115 additions and 73 deletions

View File

@ -1,21 +0,0 @@
diff -ru nagios/sample-config/httpd.conf.in nagios-om/sample-config/httpd.conf.in
--- nagios/sample-config/httpd.conf.in 2012-11-16 17:43:48.000000000 +0100
+++ nagios-om/sample-config/httpd.conf.in 2012-11-16 17:45:04.000000000 +0100
@@ -19,7 +19,7 @@
# Allow from 127.0.0.1
AuthName "Nagios Access"
AuthType Basic
- AuthUserFile @sysconfdir@/htpasswd.users
+ AuthUserFile @sysconfdir@/private/htpasswd.users
Require valid-user
</Directory>
@@ -36,7 +36,7 @@
# Allow from 127.0.0.1
AuthName "Nagios Access"
AuthType Basic
- AuthUserFile @sysconfdir@/htpasswd.users
+ AuthUserFile @sysconfdir@/private/htpasswd.users
Require valid-user
</Directory>

View File

@ -0,0 +1,38 @@
--- nagios-4.2.2/sample-config/httpd.conf.in.orig 2016-11-12 14:33:10.319542841 +0100
+++ nagios-4.2.2/sample-config/httpd.conf.in 2016-11-12 14:57:12.187647460 +0100
@@ -18,7 +18,7 @@
AuthName "Nagios Access"
AuthType Basic
- AuthUserFile @sysconfdir@/htpasswd.users
+ AuthUserFile @sysconfdir@/private/htpasswd.users
Require valid-user
</RequireAll>
</IfVersion>
@@ -31,7 +31,7 @@
AuthName "Nagios Access"
AuthType Basic
- AuthUserFile @sysconfdir@/htpasswd.users
+ AuthUserFile @sysconfdir@/private/htpasswd.users
Require valid-user
</IfVersion>
</Directory>
@@ -49,7 +49,7 @@
AuthName "Nagios Access"
AuthType Basic
- AuthUserFile @sysconfdir@/htpasswd.users
+ AuthUserFile @sysconfdir@/private/htpasswd.users
Require valid-user
</RequireAll>
</IfVersion>
@@ -62,7 +62,7 @@
AuthName "Nagios Access"
AuthType Basic
- AuthUserFile @sysconfdir@/htpasswd.users
+ AuthUserFile @sysconfdir@/private/htpasswd.users
Require valid-user
</IfVersion>
</Directory>

11
nagios.service Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=Nagios Monitoring System
After=network.target
[Service]
ExecStart=/usr/sbin/nagios /etc/nagios/nagios.cfg
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
[Install]
WantedBy=multi-user.target

View File

@ -3,8 +3,8 @@
%define cmdgrp nagioscmd %define cmdgrp nagioscmd
Name: nagios Name: nagios
Version: 3.5.1 Version: 4.2.2
Release: 5mamba Release: 1mamba
Summary: An Open Source host, service and network monitoring program Summary: An Open Source host, service and network monitoring program
Group: Network/Monitoring Group: Network/Monitoring
Vendor: openmamba Vendor: openmamba
@ -13,10 +13,11 @@ Packager: Davide Madrisan <davide.madrisan@gmail.com>
URL: http://www.nagios.org/ URL: http://www.nagios.org/
Source0: http://downloads.sourceforge.net/sourceforge/nagios/nagios-%{version}.tar.gz Source0: http://downloads.sourceforge.net/sourceforge/nagios/nagios-%{version}.tar.gz
Source1: nagios.htaccess Source1: nagios.htaccess
Source2: nagios.service
Patch0: %{name}-3.4.2-nagios_initscripts.patch Patch0: %{name}-3.4.2-nagios_initscripts.patch
Patch1: %{name}-3.4.2-makefile_install,patch Patch1: %{name}-3.4.2-makefile_install,patch
Patch2: %{name}-3.4.2-fix_path_to_cgi_executables.patch Patch2: %{name}-3.4.2-fix_path_to_cgi_executables.patch
Patch3: %{name}-3.4.2-fix_path_to_passwd_file_in_apache_s_config_file.patch Patch3: %{name}-4.2.2-fix_path_to_passwd_file_in_apache_s_config_file.patch
Patch4: %{name}-3.4.2-p1_missing_interpreter.patch Patch4: %{name}-3.4.2-p1_missing_interpreter.patch
Patch5: nagios-3.5.1-confd.patch Patch5: nagios-3.5.1-confd.patch
License: GPL License: GPL
@ -27,7 +28,6 @@ BuildRequires: libjpeg-devel
BuildRequires: libltdl-devel BuildRequires: libltdl-devel
BuildRequires: libpng-devel BuildRequires: libpng-devel
BuildRequires: libz-devel BuildRequires: libz-devel
BuildRequires: perl-devel
## AUTOBUILDREQ-END ## AUTOBUILDREQ-END
BuildRequires: mailx BuildRequires: mailx
BuildRequires: perl(CPAN) BuildRequires: perl(CPAN)
@ -39,6 +39,7 @@ BuildRequires: perl(Test::More)
BuildRequires: perl(Test::Simple) BuildRequires: perl(Test::Simple)
Requires: mailx Requires: mailx
Requires: nagios-plugins Requires: nagios-plugins
%systemd_requires
BuildRoot: %{_tmppath}/%{name}-%{version}-root BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description %description
@ -71,12 +72,12 @@ Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
This package provides include files that Nagios-related applications may compile against. This package provides include files that Nagios-related applications may compile against.
%prep %prep
%setup -q -n %{name} %setup -q
%patch0 -p1 #%patch0 -p1
%patch1 -p1 #%patch1 -p1
%patch2 -p1 %patch2 -p1
%patch3 -p1 %patch3 -p1
%patch4 -p1 #%patch4 -p1
%patch5 -p1 %patch5 -p1
%build %build
@ -99,7 +100,6 @@ This package provides include files that Nagios-related applications may compile
--with-lockfile=/run/%{name}.pid \ --with-lockfile=/run/%{name}.pid \
--with-checkresult-dir=%{_localstatedir}/spool/%{name} \ --with-checkresult-dir=%{_localstatedir}/spool/%{name} \
--with-nagios-user=%{nsusr} --with-nagios-grp=%{nsgrp} \ --with-nagios-user=%{nsusr} --with-nagios-grp=%{nsgrp} \
--with-command-group=%{cmdgrp} \
--with-gd-lib=%{_libdir} \ --with-gd-lib=%{_libdir} \
--with-gd-inc=%{_includedir} \ --with-gd-inc=%{_includedir} \
--with-perlcache \ --with-perlcache \
@ -108,6 +108,8 @@ This package provides include files that Nagios-related applications may compile
--with-mail=/bin/mailx \ --with-mail=/bin/mailx \
STRIP=/bin/true STRIP=/bin/true
# --with-command-group=%{cmdgrp} \
%make %{?_smp_mflags} all %make %{?_smp_mflags} all
sed -e "s|@libdir@/|%{_libdir}/|" %{S:1} > %{name}.htaccess sed -e "s|@libdir@/|%{_libdir}/|" %{S:1} > %{name}.htaccess
@ -128,10 +130,14 @@ cd ..
# make daemonchk.cgi and event handlers # make daemonchk.cgi and event handlers
cd contrib cd contrib
%make daemonchk.cgi \
traceroute.cgi \ %ifarch %{ix86}
mini_epn \ export ARCH=i686
convertcfg %else
export ARCH=%{_target_cpu}
%endif
%make all
cd eventhandlers cd eventhandlers
for f in `find . -type f`; do for f in `find . -type f`; do
sed -i "\ sed -i "\
@ -143,17 +149,24 @@ done
%install %install
[ "%{buildroot}" != / ] && rm -rf %{buildroot} [ "%{buildroot}" != / ] && rm -rf %{buildroot}
install -d -m0755 %{buildroot}%{_sysconfdir}/httpd/httpd.d
make \ make \
DESTDIR=%{buildroot} \ DESTDIR=%{buildroot} \
INSTALL_OPTS="" COMMAND_OPTS="" INIT_OPTS="" \ INSTALL_OPTS="" COMMAND_OPTS="" INIT_OPTS="" \
CGIDIR="%{_libdir}/%{name}/cgi-bin" \ CGIDIR="%{_libdir}/%{name}/cgi-bin" \
CFGDIR="%{_sysconfdir}/%{name}" fullinstall CFGDIR="%{_sysconfdir}/%{name}" fullinstall
# Install sample config files
for f in nagios.cfg cgi.cfg mrtg.cfg; do
install -D -m 0644 sample-config/$f %{buildroot}%{_sysconfdir}/%{name}/$f
done
for f in commands.cfg contacts.cfg localhost.cfg printer.cfg switch.cfg templates.cfg timeperiods.cfg windows.cfg; do
install -D -m 0644 sample-config/template-object/$f %{buildroot}%{_sysconfdir}/%{name}/objects/$f
done
# Private files # Private files
install -d -m 0755 %{buildroot}%{_sysconfdir}/%{name}/private install -D -m 0644 sample-config/resource.cfg %{buildroot}%{_sysconfdir}/%{name}/private/resource.cfg
mv %{buildroot}%{_sysconfdir}/%{name}/resource.cfg \
%{buildroot}%{_sysconfdir}/%{name}/private/resource.cfg
install -d %{buildroot}%{_sysconfdir}/%{name}/private
touch %{buildroot}%{_sysconfdir}/%{name}/private/htpasswd.users touch %{buildroot}%{_sysconfdir}/%{name}/private/htpasswd.users
# Install header-file # Install header-file
@ -168,7 +181,6 @@ install -d %{buildroot}%{_localstatedir}/spool/%{name}/rw
install -d -m 0755 %{buildroot}%{_libdir}/%{name}/plugins/eventhandlers install -d -m 0755 %{buildroot}%{_libdir}/%{name}/plugins/eventhandlers
# Install eventhandlers # Install eventhandlers
pwd
install -d %{buildroot}%{_libdir}/nagios/eventhandlers install -d %{buildroot}%{_libdir}/nagios/eventhandlers
find ./contrib/eventhandlers/ -type f -exec \ find ./contrib/eventhandlers/ -type f -exec \
install -m 0755 {} %{buildroot}%{_libdir}/%{name}/eventhandlers/ ';' install -m 0755 {} %{buildroot}%{_libdir}/%{name}/eventhandlers/ ';'
@ -181,6 +193,10 @@ chmod 755 %{buildroot}%{_libdir}/nagios/cgi-bin/*
# Create conf.d directory # Create conf.d directory
install -d %{buildroot}%{_sysconfdir}/nagios/conf.d install -d %{buildroot}%{_sysconfdir}/nagios/conf.d
# install service file
install -D -m0644 %{SOURCE2} %{buildroot}%{_unitdir}/nagios.service
rm -f %{buildroot}%{_initrddir}/nagios
%clean %clean
[ "%{buildroot}" != / ] && rm -rf %{buildroot} [ "%{buildroot}" != / ] && rm -rf %{buildroot}
@ -191,27 +207,32 @@ install -d %{buildroot}%{_sysconfdir}/nagios/conf.d
%{_sbindir}/useradd -r -c "Nagios Network Monitoring"\ %{_sbindir}/useradd -r -c "Nagios Network Monitoring"\
-d %{_localstatedir}/spool/%{name}\ -d %{_localstatedir}/spool/%{name}\
-s /bin/bash -g %{nsgrp} %{nsusr} >/dev/null 2>&1 -s /bin/bash -g %{nsgrp} %{nsusr} >/dev/null 2>&1
exit 0 :
%preun %preun
%systemd_preun nagios
if [ $1 = 0 ]; then if [ $1 = 0 ]; then
/sbin/service %{name} stop >/dev/null 2>&1 %{_sbindir}/userdel %{nsusr} >/dev/null 2>&1
/sbin/chkconfig --del %{name}
%{_sbindir}/userdel %{nsusr} >/dev/null 2>&1
%{_sbindir}/groupdel %{nsgrp} >/dev/null 2>&1 %{_sbindir}/groupdel %{nsgrp} >/dev/null 2>&1
%{_sbindir}/groupdel %{cmdgrp} >/dev/null 2>&1 %{_sbindir}/groupdel %{cmdgrp} >/dev/null 2>&1
fi fi
exit 0 :
%post %post
%systemd_post nagios
if [ $1 -eq 1 ]; then if [ $1 -eq 1 ]; then
/sbin/chkconfig --add %{name}
# add apache user to %{cmdgrp} so sending commands to nagios
# from the command CGI is possible
%{_sbindir}/usermod -A %{cmdgrp} apache >/dev/null 2>&1 %{_sbindir}/usermod -A %{cmdgrp} apache >/dev/null 2>&1
fi fi
exit 0 :
%postun
%systemd_postun_with_restart nagios
:
%posttrans
# clean old sysv broken links
find /etc/rc[0-6].d/ -type l -xtype l -exec rm -f {} \;
:
%preun www %preun www
if [ $1 = 0 ]; then if [ $1 = 0 ]; then
@ -225,59 +246,46 @@ if [ $1 -eq 1 ]; then
%{_bindir}/htpasswd \ %{_bindir}/htpasswd \
-bc %{_sysconfdir}/%{name}/private/htpasswd.users nagiosadmin \ -bc %{_sysconfdir}/%{name}/private/htpasswd.users nagiosadmin \
$RANDOM_PASSWD >/dev/null 2>&1 $RANDOM_PASSWD >/dev/null 2>&1
[ -e %{_localstatedir}/lock/subsys/httpd ] && /sbin/service httpd reload groupmod nagios -A apache
systemctl -q reload httpd || :
fi fi
exit 0 exit 0
%postun www %postun www
if [ $1 -ge 1 ]; then if [ $1 -ge 1 ]; then
/sbin/service httpd condrestart >/dev/null 2>&1 || : systemctl -q reload httpd || :
fi fi
exit 0 exit 0
%files %files
%defattr(-,root,root) %defattr(-,root,root)
%{_sbindir}/nagios %attr(0755,root,root) %{_sbindir}/nagios
%{_sbindir}/nagiostats %{_sbindir}/nagiostats
%{_sbindir}/p1.pl #%{_sbindir}/p1.pl
%dir %{_sysconfdir}/nagios %dir %{_sysconfdir}/nagios
%dir %{_sysconfdir}/nagios/conf.d %dir %{_sysconfdir}/nagios/conf.d
%attr(644,root,root) %config(noreplace) %{_sysconfdir}/nagios/*.cfg %attr(644,root,root) %config(noreplace) %{_sysconfdir}/nagios/*.cfg
%dir %{_sysconfdir}/%{name}/objects
%attr(644,root,root) %config(noreplace) %{_sysconfdir}/%{name}/objects/*.cfg %attr(644,root,root) %config(noreplace) %{_sysconfdir}/%{name}/objects/*.cfg
#%dir %{_sysconfdir}/%{name}/objects
#%attr(644,root,root) %config(noreplace) %{_sysconfdir}/%{name}/objects/*.cfg
%dir %{_sysconfdir}/nagios/private %dir %{_sysconfdir}/nagios/private
%attr(640,root,%{nsgrp}) %config(noreplace) %{_sysconfdir}/nagios/private/resource.cfg %attr(640,root,%{nsgrp}) %config(noreplace) %{_sysconfdir}/nagios/private/resource.cfg
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/sysconfig/%{name} %config(noreplace) %attr(0644,root,root) %{_sysconfdir}/sysconfig/%{name}
%{_initrddir}/nagios %{_unitdir}/nagios.service
%attr(0755,%{nsusr},%{nsgrp}) %dir %{_localstatedir}/spool/%{name} %attr(0755,%{nsusr},%{nsgrp}) %dir %{_localstatedir}/spool/%{name}
%attr(2771,apache,nagioscmd) %{_localstatedir}/spool/%{name}/rw %attr(2771,apache,%{nsgrp}) %{_localstatedir}/spool/%{name}/rw
%attr(0755,%{nsusr},%{nsgrp}) %dir %{_localstatedir}/log/%{name} %attr(0755,%{nsusr},%{nsgrp}) %dir %{_localstatedir}/log/%{name}
%attr(0755,%{nsusr},%{nsgrp}) %dir %{_localstatedir}/log/%{name}/archives %attr(0755,%{nsusr},%{nsgrp}) %dir %{_localstatedir}/log/%{name}/archives
%attr(0755,%{nsusr},%{nsgrp}) %dir %{_localstatedir}/log/%{name}/rw
%{_libdir}/%{name}/eventhandlers %{_libdir}/%{name}/eventhandlers
%dir %{_datadir}/%{name} %dir %{_datadir}/%{name}
%files www %files www
%defattr(-,root,root) %defattr(-,root,root)
%dir %{_datadir}/%{name}/html %dir %{_datadir}/%{name}/html
%{_datadir}/%{name}/html/index.php %{_datadir}/%{name}/html/*
%{_datadir}/%{name}/html/main.php
%{_datadir}/%{name}/html/rss-corefeed.php
%{_datadir}/%{name}/html/rss-newsfeed.php
%{_datadir}/%{name}/html/side.php
%config(noreplace) %{_datadir}/%{name}/html/config.inc.php %config(noreplace) %{_datadir}/%{name}/html/config.inc.php
%{_datadir}/%{name}/html/*.txt
%{_datadir}/%{name}/html/contexthelp
%dir %{_datadir}/%{name}/html/images
%{_datadir}/%{name}/html/images/*.gif
%{_datadir}/%{name}/html/images/*.ico
%{_datadir}/%{name}/html/images/*.jpg
%{_datadir}/%{name}/html/images/[^s]*.png
%{_datadir}/%{name}/html/images/sflogo.png
%config(noreplace) %{_datadir}/%{name}/html/images/sblogo.png %config(noreplace) %{_datadir}/%{name}/html/images/sblogo.png
%{_datadir}/%{name}/html/images/logos
%{_datadir}/%{name}/html/includes
%{_datadir}/%{name}/html/js
%{_datadir}/%{name}/html/stylesheets
%dir %{_libdir}/nagios/cgi-bin %dir %{_libdir}/nagios/cgi-bin
%{_libdir}/nagios/cgi-bin/* %{_libdir}/nagios/cgi-bin/*
%config(noreplace) %{_sysconfdir}/httpd/httpd.d/nagios.conf %config(noreplace) %{_sysconfdir}/httpd/httpd.d/nagios.conf
@ -287,8 +295,14 @@ exit 0
%defattr(-,root,root) %defattr(-,root,root)
%dir %{_includedir}/nagios %dir %{_includedir}/nagios
%{_includedir}/nagios/*.h %{_includedir}/nagios/*.h
%dir %{_includedir}/nagios/lib
%{_includedir}/nagios/lib/*.h
%{_libdir}/nagios/libnagios.a
%changelog %changelog
* Fri Nov 11 2016 Silvan Calarco <silvan.calarco@mambasoft.it> 4.2.2-1mamba
- update to 4.2.2
* Sun Jul 27 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 3.5.1-5mamba * Sun Jul 27 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 3.5.1-5mamba
- other rw permission fix attempt - other rw permission fix attempt