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