jjelen / rpms / nrpe

Forked from rpms/nrpe 6 years ago
Clone
Blob Blame History Raw
%if 0%{?fedora} > 19
%global _hardened_build 1
%endif
%define nsport 5666

Name: nrpe
Version: 3.2.1
Release: 3%{?dist}
Summary: Host/service/network monitoring agent for Nagios

Group: Applications/System
License: GPLv2
URL: http://www.nagios.org
Source0: ttps://github.com/NagiosEnterprises/nrpe/archive/%{name}-%{version}.tar.gz
Source1: nrpe.sysconfig
Source2: nrpe-tmpfiles.conf
Source3: nrpe.README.SELinux.rst
Source4: nrpe_epel6.te
Source5: nrpe_epel7.te
Source6: nrpe_epel.fc
Source7: nrpe.service.epel

Patch3: nrpe-0003-Include-etc-npre.d-config-directory.patch
Patch13: nrpe-0013-service-rhel6.patch

# For reconfiguration
BuildRequires: autoconf, automake, libtool
BuildRequires: openssl, openssl-devel
BuildRequires: checkpolicy, selinux-policy-devel
%if 0%{?fedora} > 17 || 0%{?rhel} > 6
BuildRequires: systemd-units
%endif

%if 0%{?el5}
BuildRequires: tcp_wrappers
%elif 0%{?rhel} || 0%{?fedora} < 28
BuildRequires: tcp_wrappers-devel
%endif

Requires(pre): %{_sbindir}/useradd, %{_sbindir}/usermod

%if 0%{?el5}%{?el6}
Requires(preun): /sbin/service, /sbin/chkconfig
Requires(post): /sbin/chkconfig, /sbin/service
Requires(postun): /sbin/service
Requires: initscripts
%else
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%endif

# owns /etc/nagios
Requires: nagios-common
Provides: nagios-nrpe = %{version}-%{release}

%description
Nrpe is a system daemon that will execute various Nagios plugins
locally on behalf of a remote (monitoring) host that uses the
check_nrpe plugin.  Various plugins that can be executed by the
daemon are available at:
http://sourceforge.net/projects/nagiosplug

This package provides the core agent.

%package -n nagios-plugins-nrpe
Group: Applications/System
Summary: Provides nrpe plugin for Nagios
Requires: nagios-plugins
Provides: check_nrpe = %{version}-%{release}

%description -n nagios-plugins-nrpe
Nrpe is a system daemon that will execute various Nagios plugins
locally on behalf of a remote (monitoring) host that uses the
check_nrpe plugin.  Various plugins that can be executed by the
daemon are available at:
http://sourceforge.net/projects/nagiosplug

This package provides the nrpe plugin for Nagios-related applications.

%if 0%{?rhel} > 5
%package selinux
Summary:          SELinux context for %{name}
Group:            Applications/System
Requires:         %name = %version-%release
Requires(post):   policycoreutils
Requires(postun): policycoreutils


%description selinux
SElinux context for %{name}.
%endif

%prep
%setup -q
%patch3 -p1 -b .include_etc_npre_d
%patch13 -p1 -b .fix_service_rhel6


%build
CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" LDFLAGS="%{?__global_ldflags}" \
%configure \
	--with-init-dir=%{_initrddir} \
	--with-nrpe-port=%{nsport} \
	--with-nrpe-user=nrpe \
	--with-nrpe-group=nrpe \
	--with-piddir=/var/run/nrpe \
	--bindir=%{_sbindir} \
	--libdir=/doesnt/matter/ \
	--libexecdir=%{_libdir}/nagios/plugins \
	--datadir=%{_datadir}/nagios \
	--sysconfdir=%{_sysconfdir}/nagios \
	--localstatedir=%{_localstatedir}/run/ \
	--enable-command-args

make %{?_smp_mflags} all

%if 0%{?rhel} > 5
## SELinux configs
mkdir selinux
install -pm 644 %{SOURCE3} README.SELinux.rst
%if 0%{?rhel} < 7
cp -p %{SOURCE4} selinux/%{name}_epel.te
%else
cp -p %{SOURCE5} selinux/%{name}_epel.te
%endif
cp -p %{SOURCE6} selinux/%{name}_epel.fc
touch selinux/%{name}_epel.if
make -f %{_datadir}/selinux/devel/Makefile
%endif

%install
rm -rf %{buildroot}
%if 0%{?el5}%{?el6}%{?el7}
## If we are EL5 or EL6 we want the old style sysV init script
%if 0%{?el5}%{?el6}
install -D -p -m 0755 startup/default-init %{buildroot}/%{_initrddir}/nrpe
%else
## If we are EL7 we want the home crafted systemd service due to problems
install -D -m 0644 -p %{SOURCE7} %{buildroot}%{_unitdir}/%{name}.service
%endif
%else
## If we are Fedora we want the upstream systemd service file
install -D -m 0644 -p startup/default-service %{buildroot}%{_unitdir}/%{name}.service
%endif
install -D -p -m 0644 sample-config/nrpe.cfg %{buildroot}/%{_sysconfdir}/nagios/%{name}.cfg
install -D -p -m 0755 src/nrpe %{buildroot}/%{_sbindir}/nrpe
install -D -p -m 0755 src/check_nrpe %{buildroot}/%{_libdir}/nagios/plugins/check_nrpe
install -D -p -m 0644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/sysconfig/%{name}
install -d %{buildroot}%{_sysconfdir}/nrpe.d
install -d %{buildroot}%{_localstatedir}/run/%{name}
%if 0%{?fedora} > 14 || 0%{?rhel} > 6
install -D -p -m 0644 %{SOURCE2} %{buildroot}%{_tmpfilesdir}/%{name}.conf
%endif
%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

%pre
getent group %{name} >/dev/null || groupadd -r %{name}
getent passwd %{name} >/dev/null || \
%{_sbindir}/useradd -c "NRPE user for the NRPE service" -d %{_localstatedir}/run/%{name} -r -g %{name} -s /sbin/nologin %{name} 2> /dev/null || :
getent group nagios >/dev/null && %{_sbindir}/usermod -a -G nagios %{name} || :

%preun
%if 0%{?el5}%{?el6}
if [ $1 = 0 ]; then
	/sbin/service %{name} stop > /dev/null 2>&1 || :
	/sbin/chkconfig --del %{name} || :
fi
%else
%systemd_preun nrpe.service
%endif

%post
%if 0%{?el5}%{?el6}
/sbin/chkconfig --add %{name} || :
%else
%systemd_post nrpe.service
%endif

%postun
%if 0%{?el5}%{?el6}
if [ "$1" -ge "1" ]; then
	/sbin/service %{name} condrestart > /dev/null 2>&1 || :
fi
%else
%systemd_postun_with_restart nrpe.service
%endif

%if 0%{?rhel} >5
%post selinux
%if 0%{?el5}%{?el6}
if [ "$1" -le "1" ]; then # Fist 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 # Fist 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

%if 0%{?rhel} >5
%preun selinux
%if 0%{?el5}%{?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
%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
%if 0%{?el5}%{?el6}
%{_initrddir}/nrpe
%else
%{_unitdir}/%{name}.service
%endif
%{_sbindir}/nrpe
%dir %{_sysconfdir}/nrpe.d
%config(noreplace) %{_sysconfdir}/nagios/nrpe.cfg
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%if 0%{?fedora} > 14 || 0%{?rhel} > 6
%config(noreplace) %{_tmpfilesdir}/%{name}.conf
%endif
%doc CHANGELOG.md LICENSE.md LEGAL README.md README.SSL.md SECURITY.md docs/NRPE.pdf
%dir %attr(775, %{name}, %{name}) %{_localstatedir}/run/%{name}

%files -n nagios-plugins-nrpe
%{_libdir}/nagios/plugins/check_nrpe
%doc CHANGELOG.md LICENSE.md LEGAL README.md

%if 0%{?rhel} > 5
%files selinux
%doc README.SELinux.rst
%{_datadir}/selinux/packages/%{name}/%{name}_epel.pp
%endif

%changelog
* Fri Feb 09 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.2.1-3
- Escape macros in %%changelog

* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Tue Nov 21 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.2.1-1
- Update to nrpe-3.2.1
- Fix BZ#1485361

* Fri Aug  4 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.2.0-6
- Found the problem. Fixed and ready to push

* Fri Aug  4 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.2.0-5
- Make sure nrpe works with different selinux names between 5,6 and 7
- For some reason the selinux module still does not install unless by force on EL6.

* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Fri Jul 21 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.2.0-4
- Forgot to up the release.

* Fri Jul 21 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.2.0-3
- Clean out nrpe.fc as that breaks silently 

* Wed Jul 19 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.2.0-3
- Remove git from release name
- Fix selinux lines.

* Fri Jul 14 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.2.0-2git
- Remember to put in a patch so the /etc/nrpe.d/ is used.

* Fri Jul 14 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.2.0-1
- Update to 3.2.0
- Add patches for 321 openssl items
- Remove old patches no longer needed

* Tue Jul 11 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.1.1-6
- Put in fix for 1204683

* Tue Jul 11 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.1.1-5
- Add comments to nrpe.cfg to alert user on RHBZ #1318773
- Backport ipv6 patch for problem

* Fri Jul  7 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.1.1-4
- Fix patch name. Silly human. Do a fedpkg srpm before build.

* Fri Jul  7 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.1.1-3
- Fix crashing bug if username is not defined.

* Wed Jul  5 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.1.1-2
- Fix bug due to /etc/nrpe.d/ includes was above other defined entries BZ# 1467971
- I am not updating to 3.2.0 for a bit in order to smush out problems here.

* Wed Jun 14 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.1.1-1
- Update to 3.1.1
- Remove git patch
- Add pid_dir configure statement.

* Tue May  2 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.1.0-3
- Grab updates from upstream to see why nrpe fails on fedora but not rhel

* Wed Apr 26 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.1.0-2
- Move to using original nirik nrpe service file for systemd. It worked and the others dont
- NRPE fails to run using a /var/run/nrpe/ directory so trying to build without it.

* Thu Apr 20 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.1.0-1
- update to 3.1.0
- put in fix for format-error
- remove patches not needed.

* Thu Mar 23 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.0.1-6
- Redo the nagios policy to lower its all the permissions.

* Wed Mar 22 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.0.1-5
- Put in patches from GIT to fix noise problems
- Put in patch for RHEL6 systems to regain vars
- Put in initial patch for selinux on EPEL
- Remove el4 macros as this won't work there anyway.

* Fri Mar  3 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.0.1-5
- Remember to add the patch so it can build.

* Fri Mar  3 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.0.1-4
- Fix systemd to use correct service file.
- Add reload rule

* Fri Mar  3 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.0.1-3
- fix the systemd service file to better match needs.

* Fri Mar  3 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.0.1-2
- fix the statedir to look at /var/run/nrpe

* Mon Feb  6 2017 Stephen Smoogen <smooge@fedoraproject.org> - 3.0.1-1
- Update to 3.0.1
- Add a temp patch to get it to work with openssl v110 for F25

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.15-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Sep  8 2015 Peter Robinson <pbrobinson@fedoraproject.org> 2.15-7
- Use %%configure macro as it deals with config.sub/guess and various flags properly

* Fri Sep 04 2015 Scott Wilkerson <swilkerson@fedoraproject.org> - 2.15-6
- Fix spec file for missing /usr/share/libtool/config/config.guess

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.15-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.15-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.15-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Thu May 1 2014 Sam Kottler <skottler@fedoraproject.org> - 2.15.2
- Add patch to mitigate CVE-2014-2913

* Mon Jan 27 2014 Sam Kottler <skottler@fedoraproject.org> - 2.15.1
- Update to 2.15

* Wed Oct 16 2013 Peter Lemenkov <lemenkov@gmail.com> - 2.14-5
- Allow building for aarch64 (rhbz #926244)
- Allow user to redefine default commands (rhbz #963703)

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.14-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Wed May 22 2013 Kevin Fenzi <kevin@scrye.com> 2.14-3
- Apply patch from bug 860988 to handle RHEL versions and systemd
- Apply patch from bug 957567 to fix condrestart so nrpe restarts on upgrade.
- Rework systemd and service scriptlets and requires.
- Harden Fedora 19+ builds

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.14-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Mon Jan 14 2013 Mark Chappell <tremble@tremble.org.uk> - 2.14
- Version 2.14

* Mon Jan 14 2013 Mark Chappell <tremble@tremble.org.uk> - 2.13-2
- #860982 Mistake in service file
- #860985 nrpe shouldn't own /etc/nagios (from nagios-common)

* Mon Sep 17 2012 Peter Lemenkov <lemenkov@gmail.com> - 2.13-1
- Ver. 2.13

* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.12-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.12-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Thu Sep 22 2011 Peter Lemenkov <lemenkov@gmail.com> - 2.12-19
- Disable systemd stuff in EPEL

* Sat Sep 17 2011 Ruben Kerkhof <ruben@rubenkerkhof.com> - 2.12-18
- Let systemd create /var/run/nrpe. Fixes rhbz #656641

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.12-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Mon Oct 25 2010 Peter Lemenkov <lemenkov@gmail.com> - 2.12-16
- Issue with SELinux was resolved (see rhbz #565220#c25). 2nd try.

* Wed Sep 29 2010 jkeating - 2.12-15
- Rebuilt for gcc bug 634757

* Sat Sep 11 2010 Peter Lemenkov <lemenkov@gmail.com> - 2.12-14
- Issue with SELinux was resolved (see rhbz #565220).

* Fri Jun 18 2010 Peter Lemenkov <lemenkov@gmail.com> - 2.12-13
- Init-script enhancements (see rhbz #247001, #567141 and #575544)

* Mon Oct 26 2009 Peter Lemenkov <lemenkov@gmail.com> - 2.12-12
- Do not own %%{_libdir}/nagios/plugins ( bz# 528974 )
- Fixed building against tcp_wrappers in Fedora ( bz# 528974 )

* Thu Sep 24 2009 Peter Lemenkov <lemenkov@gmail.com> - 2.12-11
- Fixed BZ# 515324

* Fri Aug 21 2009 Tomas Mraz <tmraz@redhat.com> - 2.12-10
- rebuilt with new openssl

* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.12-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.12-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Sat Feb 21 2009 Mike McGrath <mmcgrath@redhat.com> - 2.12-7
- Re-fix for 477527

* Mon Feb  2 2009 Peter Lemenkov <lemenkov@gmail.com> - 2.12-6
- Fixed BZ# 449174
- Clean up (in order to disable rpmlint warnings)

* Sat Jan 17 2009 Tomas Mraz <tmraz@redhat.com> - 2.12-5
- rebuild with new openssl

* Sun Dec 21 2008 Mike McGrath <mmcgrath@redhat.com> - 2.12-4
- Added some doc lines for ticket 477527

* Fri Dec 19 2008 Mike McGrath <mmcgrath@redhat.com> - 2.12-3
- Added Provides: nagios-nrpe

* Fri Dec 19 2008 Mike McGrath <mmcgrath@redhat.com> - 2.12-2
- Upstreamreleased new version

* Tue Feb 12 2008 Mike McGrath <mmcgrath@redhat.com> - 2.7-6
- Rebuild for gcc43

* Wed Dec 05 2007 Release Engineering <rel-eng at fedoraproject dot org> - 2.7-5
 - Rebuild for deps

* Wed Aug 22 2007 Mike McGrath <mmcgrath@redhat.com> 2.7-4
- License Change
- Rebuild for BuildID

* Fri Feb 23 2007 Mike McGrath <mmcgrath@redhat.com> 2.7-1
- Upstream released new version

* Sun Jul 23 2006 Mike McGrath <imlinux@gmail.com> 2.5.2-3
- no longer owns libdir/nagios
- buildrequires tcp_wrappers

* Sun Jul 23 2006 Mike McGrath <imlinux@gmail.com> 2.5.2-2
- Specify bogus libdir so rpmlint won't complain

* Mon Jul 03 2006 Mike McGrath <imlinux@gmail.com> 2.5.2-1
- Upstream released new version

* Sun Mar 12 2006 Mike McGrath <imlinux@gmail.com> 2.4-3
- Added description to useradd statement

* Sun Mar 05 2006 Mike McGrath <imlinux@gmail.com> 2.4-2
- Added proper SMP build flags
- Added %%{?dist} tag
- Added reload to nrpe script
- Updated to 2.4, changes include:
- Added option to allow week random seed (Gerhard Lausser)
- Added optional command line prefix (Sean Finney)
- Added ability to reload config file with SIGHUP
- Fixed bug with location of dh.h include file
- Fixed bug with disconnect message in debug mode

* Sat Feb 04 2006 Mike McGrath <imlinux@gmail.com> 2.3-1
- Created a Fedora friendly spec file

* Mon Jan 23 2006 Andreas Kasenides ank<@>cs.ucy.ac.cy
- fixed nrpe.cfg relocation to sample-config
- replaced Copyright label with License
- added --enable-command-args to enable remote arg passing (if desired can be disabled by commenting out)

* Wed Nov 12 2003 Ingimar Robertsson <iar@skyrr.is>
- Added adding of nagios group if it does not exist.

* Tue Jan 07 2003 James 'Showkilr' Peterson <showkilr@showkilr.com>
- Removed the lines which removed the nagios user and group from the system
- changed the patch release version from 3 to 1

* Mon Jan 06 2003 James 'Showkilr' Peterson <showkilr@showkilr.com>
- Removed patch files required for nrpe 1.5
- Update spec file for version 1.6 (1.6-1)

* Sat Dec 28 2002 James 'Showkilr' Peterson <showkilr@showkilr.com>
- First RPM build (1.5-1)