diff --git a/.gitignore b/.gitignore index a1b2d77..cec2a8b 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,8 @@ nagios-3.2.1.tar.gz /nagioscore-nagios-4.4.2.tar.gz /nagioscore-nagios-4.4.3.tar.gz /nagioscore-nagios-4.4.5.tar.gz +/nagioscore-nagios-4.4.6.tar.gz +/nagioscore-nagios-4.4.7.tar.gz +/nagioscore-nagios-4.4.8.tar.gz +/nagioscore-nagios-4.4.9.tar.gz +/nagioscore-nagios-4.4.14.tar.gz diff --git a/nagios-0003-Install-config-files-too.patch b/nagios-0003-Install-config-files-too.patch index 4bf4aa2..3194a02 100644 --- a/nagios-0003-Install-config-files-too.patch +++ b/nagios-0003-Install-config-files-too.patch @@ -1,7 +1,8 @@ -diff -up ./Makefile.in.install_config ./Makefile.in ---- ./Makefile.in.install_config 2017-04-19 19:11:47.783707415 -0400 -+++ ./Makefile.in 2017-04-19 19:11:47.785707384 -0400 -@@ -377,7 +377,7 @@ dox: +diff --git a/Makefile.in b/Makefile.in +index b992ab1e..ef2a797f 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -439,7 +439,7 @@ dox: doxygen doxy.conf diff --git a/nagios-0009-fix-localstatedir-for-linux.patch b/nagios-0009-fix-localstatedir-for-linux.patch index 3c18043..070285f 100644 --- a/nagios-0009-fix-localstatedir-for-linux.patch +++ b/nagios-0009-fix-localstatedir-for-linux.patch @@ -264,9 +264,9 @@ diff -up ./startup/default-service.in.fix_localstatedir ./startup/default-servic ExecStop=@BIN_KILL@ -s TERM ${MAINPID} -ExecStopPost=@BIN_RM@ -f @localstatedir@/rw/nagios.cmd +ExecStopPost=@BIN_RM@ -f @localstatedir@/spool/nagios/cmd/nagios.cmd + ExecReload=@bindir@/nagios -v @sysconfdir@/nagios.cfg ExecReload=@BIN_KILL@ -s HUP ${MAINPID} - [Install] diff -up ./t-tap/Makefile.in.fix_localstatedir ./t-tap/Makefile.in --- ./t-tap/Makefile.in.fix_localstatedir 2019-01-16 14:24:14.944312569 -0600 +++ ./t-tap/Makefile.in 2019-01-16 14:24:42.359858604 -0600 diff --git a/nagios-0011-remove-rpmbuild.patch b/nagios-0011-remove-rpmbuild.patch index 88e0049..4e4bc1d 100644 --- a/nagios-0011-remove-rpmbuild.patch +++ b/nagios-0011-remove-rpmbuild.patch @@ -1,12 +1,14 @@ -diff -up ./contrib/Makefile.in.remove_rpmbuild ./contrib/Makefile.in ---- ./contrib/Makefile.in.remove_rpmbuild 2019-08-29 18:23:14.113160181 +0000 -+++ ./contrib/Makefile.in 2019-08-29 18:24:20.509445391 +0000 -@@ -85,36 +85,3 @@ $(CGI_O): $(CGI_C) +diff --git a/contrib/Makefile.in b/contrib/Makefile.in +index 72e4d4a9..62415152 100644 +--- a/contrib/Makefile.in ++++ b/contrib/Makefile.in +@@ -84,52 +84,3 @@ $(CGI_O): $(CGI_C) + %.cgi : %.c $(CC) $(CFLAGS) $(LDFLAGS) $< $(CGI_O) -o $@ - +- -############################################################################## --# rpm making automation for CentOS/RHEL. +-# making similar EPEL rpm for Fedora/RHEL/CentOS - -ifneq ("$(wildcard /etc/redhat-release)","") - @@ -25,16 +27,31 @@ diff -up ./contrib/Makefile.in.remove_rpmbuild ./contrib/Makefile.in - endif -endif - --rpm: +-# Create our own tarball and put ino rpmbuild/SOURCES +-localsrc-rpm: - # create nagios tar ball. - @(cd ..;rm -f nagios-@VERSION@) - @(cd ..;ln -s . nagios-@VERSION@) - @(cd ..;tar zhcf nagios-@VERSION@.tar.gz --exclude nagios-@VERSION@/nagios-@VERSION@.tar.gz --exclude nagios-@VERSION@/nagios-@VERSION@ --exclude RCS --exclude CVS --exclude build-* --exclude *~ --exclude .git* nagios-@VERSION@/) - @(cd ..;rm -f nagios-@VERSION@) - # build the rpm using rpmbuild from ./rmbuild as topdir -- @rm -rf rpmbuild && mkdir -p rpmbuild/SOURCES +- @rm -rf rpmbuild && mkdir -p ./rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} - @cp ../nagios-@VERSION@.tar.gz rpmbuild/SOURCES/nagios-@VERSION@.tar.gz -- @rpmbuild -ba --define "_topdir ${PWD}/rpmbuild" ../nagios.spec +- @cp epel-patches/* ./rpmbuild/SOURCES +- @rpmbuild -ba --define "_topdir ${PWD}/rpmbuild" epel-nagios.spec +- @cp rpmbuild/RPMS/$(RPM_ARCH)/*.rpm . +- @cp rpmbuild/SRPMS/*.src.rpm . +- @ls -l *.rpm +- +-# tarball from https://github.com/NagiosEnterprises/nagioscore/releases/download/nagios-%{version}/nagios-%{version}.tar.gz +-rpm: init-epelrpm build-epelrpm - @mv rpmbuild/RPMS/$(RPM_ARCH)/*.rpm . - @ls -l *.rpm +-init-epelrpm: +- # build the rpm using rpmbuild from ./rmbuild as topdir +- @rm -rf ./rpmbuild && mkdir -p ./rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} +- @spectool -C ./rpmbuild/SOURCES -g epel-nagios.spec +- @cp epel-patches/* ./rpmbuild/SOURCES +-build-epelrpm: +- @rpmbuild -ba --define "_topdir ${PWD}/rpmbuild" epel-nagios.spec -endif diff --git a/nagios.spec b/nagios.spec index cc7f990..5fc535c 100644 --- a/nagios.spec +++ b/nagios.spec @@ -1,14 +1,10 @@ %global _hardened_build 1 -%global with_selinux 1 -%global selinuxtype targeted - -# https://gcc.gnu.org/gcc-10/porting_to.html#common -# attempt to fix bugzilla 1793909 -%define _legacy_common_support 1 +# Set bootstrap = 1 to build without depending on plugins for localhost monitoring +%global bootstrap 0 Name: nagios -Version: 4.4.5 -Release: 5%{?dist} +Version: 4.4.14 +Release: 1%{?dist} Summary: Host/service/network monitoring program @@ -27,13 +23,10 @@ Source10: printer.png Source11: router.png Source12: switch.png Source13: nagios.README.SELinux.rst -Source14: nagios.te -Source15: nagios.fc -Source16: nagios.if +Source14: nagios_epel7.te +Source15: nagios_epel.fc +Source16: nagios_epel6.te -# Patch 0 should be a patch that we get from the maint git tree in -# order to fix any items upstream wanted. -#Patch0: nagios-0000-git201706.patch Patch1: nagios-0001-default-init.patch # Sent upstream Patch2: nagios-0002-Fix-installation-of-httpd-conf.d-config-file.patch @@ -41,8 +34,6 @@ Patch3: nagios-0003-Install-config-files-too.patch Patch4: nagios-0004-Fix-path-to-CGI-executables.patch Patch5: nagios-0005-Fixed-path-to-passwd-file-in-Apache-s-config-file.patch Patch6: nagios-0006-Added-several-images-to-the-sample-config-revb.patch -#Patch7: nagios-0007-Apache-2.4-configuration-fix-for-Fedora-18.patch -Patch8: nagios-0008-Add-cfg_dir-etc-nagios-conf.d-to-the-main-nagios-con.patch Patch9: nagios-0009-fix-localstatedir-for-linux.patch ## This has been requested for security groups not wanting to leak ## their nagios location. @@ -53,6 +44,7 @@ Patch12: nagios-0012-fix-spool.patch Patch13: nagios-0013-fix-plugin.patch Patch14: nagios-0014-fix-uidgid.patch +BuildRequires: make BuildRequires: doxygen BuildRequires: gcc BuildRequires: gd-devel > 1.8 @@ -70,6 +62,7 @@ BuildRequires: perl(Test::HTML::Lint) %endif BuildRequires: perl(Test::More) BuildRequires: perl(Test::Simple) +BuildRequires: openssl-devel # For up-to-date config.sub and config.guess BuildRequires: libtool @@ -90,11 +83,17 @@ Requires: nagios-common Requires: user(nagios) Requires: group(nagios) -%if 0%{?with_selinux} -# This ensures that the *-selinux package and all it’s dependencies are not pulled -# into containers and other systems that do not use SELinux -Requires: (%{name}-selinux if selinux-policy-%{selinuxtype}) -%endif # if with_selinux +# This plugins are required for localhost monitoring +%if ! 0%{?bootstrap} +Requires: nagios-plugins-ping +Requires: nagios-plugins-load +Requires: nagios-plugins-users +Requires: nagios-plugins-http +Requires: nagios-plugins-disk +Requires: nagios-plugins-ssh +Requires: nagios-plugins-swap +Requires: nagios-plugins-procs +%endif Requires(pre): group(nagios) Requires(pre): user(nagios) @@ -150,20 +149,17 @@ that you specify. This package provides include files that Nagios-related applications may compile against. -%if 0%{?with_selinux} -# SELinux subpackage +%if 0%{?rhel} > 5 %package selinux Summary: SELinux context for %{name} -Requires: %{name} = %{version}-%{release} -BuildArch: noarch -Requires: selinux-policy-%{selinuxtype} -Requires(post): selinux-policy-%{selinuxtype} -BuildRequires: checkpolicy, selinux-policy-devel -%{?selinux_requires} +Requires: %name = %version-%release +Requires(post): policycoreutils +Requires(postun): policycoreutils + %description selinux -SElinux security policy for %{name}. -%endif # if with_selinux +SElinux context for %{name}. +%endif %package contrib Summary: Eventhandlers contributed to nagios @@ -172,31 +168,8 @@ Requires: %name = %version-%release %description contrib Various contributed items used by plugins and other tools. -%if 0%{?with_selinux} -# SELinux contexts are saved so that only affected files can be -# relabeled after the policy module installation -%pre selinux -%selinux_relabel_pre -s %{selinuxtype} -%endif # if with_selinux - %prep -%setup -q -n nagioscore-nagios-%{version} - -# patch0 would go here -%patch1 -p1 -b .fix_el6_init -%patch2 -p1 -b .fix_httpd_conf_d -%patch3 -p0 -b .install_config -%patch4 -p1 -b .fix_path_to_cgi -%patch5 -p1 -b .fix_path_to_passwd -%patch6 -p1 -b .more_images - -#%patch8 -p1 -b .conf_d -%patch9 -p1 -b .fix_localstatedir -%patch10 -p1 -b .remove_3rdparty_links -%patch11 -p1 -b .remove_rpmbuild -%patch12 -p1 -b .fix_spool -%patch13 -p1 -b .fix_plugin -%patch14 -p1 -b .fix_uidgid +%autosetup -p1 -n nagioscore-nagios-%{version} install -p -m 0644 %{SOURCE10} %{SOURCE11} %{SOURCE12} html/images/logos/ @@ -235,13 +208,14 @@ install -p -m 0644 %{SOURCE10} %{SOURCE11} %{SOURCE12} html/images/logos/ --with-template-extinfo \ --enable-event-broker \ STRIP=/bin/true -make %{?_smp_mflags} all + +%make_build all ### Build our documentation -%{__make} dox +%make_build dox ### Apparently contrib does not obey configure ! -%{__make} %{?_smp_mflags} -C contrib +%make_build -C contrib sed -e "s|/usr/lib/|%{_libdir}/|" %{SOURCE2} > %{name}.htaccess @@ -250,23 +224,23 @@ cp -f %{SOURCE5} UpgradeToVersion4.ReadMe cp -f %{SOURCE6} UpgradeToVersion4.sh echo >> html/stylesheets/common.css -%if 0%{?with_selinux} +%if 0%{?rhel} > 5 +## SELinux configs mkdir selinux -# Shipping the whole nagios policy (originally from selinux-policy-contrib) -# this policy module will override the production module -cp -p %{SOURCE14} selinux/ -cp -p %{SOURCE15} selinux/ -cp -p %{SOURCE16} selinux/ - -make -f %{_datadir}/selinux/devel/Makefile %{name}.pp -bzip2 -9 %{name}.pp -%endif # if with_selinux +install -pm 644 %{SOURCE13} README.SELinux.rst +%if 0%{?rhel} == 6 +cp -p %{SOURCE16} selinux/%{name}_epel.te +%else +cp -p %{SOURCE14} selinux/%{name}_epel.te +%endif +cp -p %{SOURCE15} selinux/%{name}_epel.fc +touch selinux/%{name}_epel.if +make -f %{_datadir}/selinux/devel/Makefile +%endif %install -rm -rf $RPM_BUILD_ROOT - -make DESTDIR=%{buildroot} INIT_OPTS="" INSTALL_OPTS="" COMMAND_OPTS="" CGIDIR="%{_libdir}/%{name}/cgi-bin" CFGDIR="%{_sysconfdir}/%{name}" fullinstall +%make_install INIT_OPTS="" INSTALL_OPTS="" COMMAND_OPTS="" CGIDIR="%{_libdir}/%{name}/cgi-bin" CFGDIR="%{_sysconfdir}/%{name}" fullinstall # relocated to sbin (Fedora-specific) install -d -m 0755 %{buildroot}%{_bindir} @@ -306,6 +280,9 @@ install -D -m 0644 -p %{SOURCE8} %{buildroot}%{_tmpfilesdir}/%{name}.conf # Remove SystemV init-script rm -f %{buildroot}%{_initrddir}/nagios + +# Fix systemd unit file permissions #1676334 +chmod -x %{buildroot}%{_unitdir}/%{name}.service %endif # Fix permissions - FIXME remove this when unneeded @@ -315,13 +292,13 @@ chmod 755 %{buildroot}%{_sbindir}/nagios install -d -m 0755 %{buildroot}%{_datadir}/nagios/html/docs %{__cp} -a Documentation/html/* %{buildroot}%{_datadir}/nagios/html/docs -%if 0%{?with_selinux} -install -pm 0644 %{SOURCE13} README.SELinux.rst -install -D -m 0644 %{name}.pp.bz2 %{buildroot}%{_datadir}/selinux/packages/%{selinuxtype}/%{name}.pp.bz2 -%endif # if with_selinux +%if 0%{?rhel} >5 +# Selinux configs +install -p -m 644 -D %{name}_epel.pp $RPM_BUILD_ROOT%{_datadir}/selinux/packages/%{name}/%{name}_epel.pp +%endif ### CONTRIB ITEMS TAKEN FROM UPSTREAM NAGIOS SPEC -make install -C contrib DESTDIR="%{buildroot}" INSTALL_OPTS="" +%make_install -C contrib INSTALL_OPTS="" install -p -m 644 contrib/eventhandlers/disable_active_service_checks %{buildroot}%{_libdir}/nagios/plugins/eventhandlers/ install -p -m 644 contrib/eventhandlers/disable_notifications %{buildroot}%{_libdir}/nagios/plugins/eventhandlers/ install -p -m 644 contrib/eventhandlers/enable_active_service_checks %{buildroot}%{_libdir}/nagios/plugins/eventhandlers/ @@ -398,22 +375,49 @@ fi /bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || : %endif -%if 0%{?with_selinux} +%if 0%{?rhel} >5 %post selinux -%selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/%{selinuxtype}/%{name}.pp.bz2 -%selinux_relabel_post -s %{selinuxtype} - +%if 0%{?el5}%{?el6} if [ "$1" -le "1" ]; then # First install + semodule -i %{_datadir}/selinux/packages/%{name}/%{name}_epel.pp 2>/dev/null || : + fixfiles -R %{name} restore || : + /sbin/service %{name} condrestart > /dev/null 2>&1 || : +fi +%else +if [ "$1" -le "1" ]; then # First install + semodule -i %{_datadir}/selinux/packages/%{name}/%{name}_epel.pp 2>/dev/null || : + fixfiles -R %{name} restore || : %systemd_postun_with_restart %{name}.service fi +%endif +%endif -%postun selinux -if [ $1 -eq 0 ]; then - %selinux_modules_uninstall -s %{selinuxtype} %{name} - %selinux_relabel_post -s %{selinuxtype} +%if 0%{?rhel} >5 +%preun selinux +%if 0%{?el6} +if [ "$1" -lt "1" ]; then # Final removal + semodule -r %{name}_epel 2>/dev/null || : + fixfiles -R %{name} restore || : + /sbin/service %{name} condrestart > /dev/null 2>&1 || : +fi +%else +if [ "$1" -lt "1" ]; then # Final removal + semodule -r %{name}_epel 2>/dev/null || : + fixfiles -R %{name} restore || : %systemd_postun_with_restart %{name}.service fi -%endif # if with_selinux +%endif +%endif + +%if 0%{?rhel} >5 +%postun selinux +if [ "$1" -ge "1" ]; then # Upgrade + # Replaces the module if it is already loaded + semodule -i %{_datadir}/selinux/packages/%{name}/%{name}_epel.pp 2>/dev/null || : + # no need to restart the daemon +fi +%endif + %files @@ -421,8 +425,9 @@ fi %dir %{_datadir}/%{name} %dir %{_datadir}/%{name}/html %doc %{_datadir}/%{name}/html/docs -%doc Changelog INSTALLING LICENSE README.md UPGRADING UpgradeToVersion4.ReadMe UpgradeToVersion4.sh +%doc Changelog INSTALLING README.md UPGRADING UpgradeToVersion4.ReadMe UpgradeToVersion4.sh %doc internet.cfg +%license LICENSE %{_datadir}/%{name}/html/[^cd]* %{_datadir}/%{name}/html/contexthelp/ %{_datadir}/%{name}/html/d3/ @@ -464,13 +469,11 @@ fi %{_includedir}/%{name} %attr(0644,root,root) %{_libdir}/%{name}/libnagios.a -%if 0%{?with_selinux} +%if 0%{?rhel} > 5 %files selinux %doc README.SELinux.rst -%{_datadir}/selinux/packages/%{selinuxtype}/%{name}.pp.* -%ghost %{_sharedstatedir}/selinux/%{selinuxtype}/active/modules/200/%{name} -%endif # if with_selinux - +%{_datadir}/selinux/packages/%{name}/nagios_epel.pp +%endif %files contrib %doc contrib/README.contrib @@ -478,11 +481,29 @@ fi %{_libdir}/%{name}/cgi/ %changelog -* Thu Feb 27 2020 Martin Jackson - 4.4.5-5 -- Update selinux subpackage to fix BZ#1749156 - thanks for the patch vmojzis +* Sat Mar 09 2024 Guido Aulisi - 4.4.14-1 +- Update to 4.4.14 -* Wed Feb 26 2020 Vit Mojzis - 4.4.5-4 -- Update nagios-selinux based on the DSP guidelines +* Sun Dec 25 2022 Guido Aulisi - 4.4.9-1 +- Update to 4.4.9 + +* Wed Mar 03 2021 Guido Aulisi - 4.4.6-4 +- Add missing require for nagios-plugins-ping +- Fix run path + +* Sat Feb 27 2021 Guido Aulisi - 4.4.6-3 +- Require plugins needed for localhost monitoring (#1932297) + +* Tue Feb 23 2021 Guido Aulisi - 4.4.6-2 +- Fix systemd unit file permissions #1676334 + +* Sat Feb 20 2021 Guido Aulisi - 4.4.6-1 +- Update to 4.4.6 +- Fix for CVE-2020-13977 #BZ1849087 +- Some spec cleanup + +* Tue Apr 7 2020 Martin Jackson - 4.4.5-7 +- Revert to Smooge's last good build * Tue Feb 18 2020 Stephen Smoogen - 4.4.5-3 - Add change to allow for problems found in mass rebuild and gcc10. diff --git a/nagios.tmpfiles.conf b/nagios.tmpfiles.conf index 907ca68..4bb5bc3 100644 --- a/nagios.tmpfiles.conf +++ b/nagios.tmpfiles.conf @@ -1 +1 @@ -D /var/run/nagios 0755 nagios nagios - +D /run/nagios 0755 nagios nagios - diff --git a/sources b/sources index fa4ac42..83ce37d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (nagioscore-nagios-4.4.5.tar.gz) = b2b4213dc9087c49a96506f514ec672476763e1ca928bf5de8494a0509b612a4a357989e719820328095489138375c9db292ac3c8129925c323220860e17bc49 +SHA512 (nagioscore-nagios-4.4.14.tar.gz) = 6dfe19887f035f3a3f6774a0f1c515902608934a75b08835fe9a5163812657547c97a20f3df42b89a34cad949eb4b587853b4131718c30703490b11fbee0d0ee