Blob Blame History Raw
Name:		openvas-manager
Summary:	Manager Module for the Open Vulnerability Assessment System (OpenVAS)
Version:	2.0.3
Release:	1%{?dist}
URL:		http://www.openvas.org
License:	GPLv2+
Group:		System Environment/Libraries

Source0:	http://wald.intevation.org/frs/download.php/858/%{name}-%{version}.tar.gz
Source1:	openvas-manager.initd
Source2:	openvas-manager.logrotate
Source3:	openvas-manager.sysconfig

#Patch to avoid compile-time errors about variable set but not used
Patch0:		openvas-manager-notused.patch

#Put certs to /etc/pki as suggested by http://fedoraproject.org/wiki/PackagingDrafts/Certificates
#Not reported upstream as it is RedHat/Fedora specific
Patch1:		openvas-manager-pki.patch

#Patch to install to report templates with specified DESTDIR variabe
Patch2:		openvas-manager-destdir.patch

BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires:	openvas-libraries-devel
BuildRequires:	cmake >= 2.6.0
BuildRequires:	glib2-devel
BuildRequires:	sqlite-devel
BuildRequires:	gnutls-devel
BuildRequires:	libpcap-devel
BuildRequires:	gpgme-devel
BuildRequires:	doxygen
BuildRequires:	pkgconfig
# This is introduced to accomodate difference in RHEL5/CentOS5
%if %{defined rhel}
%if 0%{?rhel} <= 5
#RHEL5
BuildRequires:	e2fsprogs-libs-devel
%else
#RHEL6
BuildRequires:	libuuid-devel
%endif
%else
#Fedora 14 doesn't have "rhel" defined
BuildRequires:	libuuid-devel
%endif

Requires:	logrotate
Requires:	/usr/bin/xsltproc

Requires(post):		chkconfig
Requires(preun):	chkconfig
Requires(preun):	initscripts


%description
The OpenVAS Manager is the central service that consolidates plain vulnerability
scanning into a full vulnerability management solution. The Manager controls the
Scanner via OTP and itself offers the XML-based, stateless OpenVAS Management 
Protocol (OMP). All intelligence is implemented in the Manager so that it is
possible to implement various lean clients that will behave consistently e.g. 
with regard to filtering or sorting scan results. The Manager also controls 
a SQL database (sqlite-based) where all configuration and scan result data is 
centrally stored.


%prep
%setup -q
%patch0 -p1 -b .notused
%patch1 -p1 -b .pki
%patch2 -p1 -b .destdir

%build
export CFLAGS="$RPM_OPT_FLAGS -Werror=unused-but-set-variable"
%cmake -DLOCALSTATEDIR:PATH=%{_var}
make %{?_smp_mflags} VERBOSE=1

%install
rm -rf %{buildroot}

make install DESTDIR=%{buildroot} INSTALL="install -p"

#Config directory
mkdir -p %{buildroot}/%{_sysconfdir}/openvas
chmod 755 %{buildroot}/%{_sysconfdir}/openvas

#Log direcotry
mkdir -p %{buildroot}/%{_var}/log/openvas
touch %{buildroot}%{_var}/log/openvas/openvasmd.log

#Runtime lib directory
mkdir -p %{buildroot}/%{_var}/lib/openvas/mgr

# Install startup script
install -Dp -m 755 %{SOURCE1} %{buildroot}/%{_initddir}/%{name}

# install log rotation stuff
install -m 644 -Dp %{SOURCE2} \
	%{buildroot}/%{_sysconfdir}/logrotate.d/%{name}

# Install sysconfig configration
install -Dp -m 644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/sysconfig/%{name}

#Fix permissions on templates
chmod -R a+r %{buildroot}%{_datadir}/openvas/openvasmd
find %{buildroot}%{_datadir}/openvas/openvasmd -name generate | xargs chmod 755

%clean
[ "%{buildroot}" = "/" ] || rm -rf %{buildroot}


%post
# This adds the proper /etc/rc*.d links for the script
if [ "$1" -eq 1 ] ; then
	/sbin/chkconfig --add openvas-manager
fi


%preun
if [ "$1" -eq 0 ] ; then
	/sbin/service openvas-manager stop >/dev/null 2>&1
	/sbin/chkconfig --del openvas-manager
fi


%postun
# only for upgrades not erasure
if [ "$1" -eq 1 ] ; then
	/sbin/service openvas-manager condrestart  >/dev/null 2>&1
fi


%files
%defattr(-,root,root)
%doc CHANGES COPYING README ChangeLog INSTALL TODO
%doc doc/*.png doc/*.sql doc/*.html doc/report-format-HOWTO
%doc report_formats
%config(noreplace) %{_sysconfdir}/logrotate.d/openvas-manager
%dir %{_sysconfdir}/openvas
%dir %{_var}/lib/openvas
%dir %{_var}/lib/openvas/mgr
%dir %{_var}/lib/openvas/openvasmd
%dir %{_var}/lib/openvas/openvasmd/report_formats
%dir %{_var}/log/openvas
%dir %{_datadir}/openvas
%config(noreplace) %{_sysconfdir}/openvas/openvasmd_log.conf
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%{_initrddir}/%{name}
%{_sbindir}/openvasmd
%{_mandir}/man8/openvasmd.8*
%{_datadir}/openvas/openvasmd
%ghost %{_var}/log/openvas/openvasmd.log

%changelog
* Tue Apr 19 2011 Michal Ambroz <rebus at, seznam.cz> - 2.0.3-1
- bump to bugfix release

* Wed Apr 14 2011 Michal Ambroz <rebus at, seznam.cz> - 2.0.2-4
- apply BR for EL5 from openvas-scanner

* Wed Mar 30 2011 Michal Ambroz <rebus at, seznam.cz> - 2.0.2-3
- implement changes based on package review

* Wed Mar 30 2011 Michal Ambroz <rebus at, seznam.cz> - 2.0.2-2
- implement changes based on package review

* Mon Mar 28 2011 Michal Ambroz <rebus at, seznam.cz> - 2.0.2-1
- initial spec for openvas-manager based on openvas-scanner