Blob Blame History Raw
Name:		openvas-scanner
Summary:	Open Vulnerability Assessment (OpenVAS) Scanner
Version:	3.1.1
Release:	2%{?dist}
Source0:	http://wald.intevation.org/frs/download.php/729/%{name}-%{version}.tar.gz
Source1:	openvas-initd.sh
Source2:	openvassd.conf
Source3:	openvas.logrotate
Source4:	openvas-scanner.sysconfig
Source5:	openvas-nvt-sync-cron
Source6:	openvas-nvt-sync-cronjob
Patch0:		openvas-scanner-nvtfeed.patch
URL:		http://www.openvas.org
License:	GPLv2
Group:		System Environment/Libraries
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires:	openvas-libraries-devel
BuildRequires:	cmake >= 2.6.0
BuildRequires:	glib2-devel
BuildRequires:	libpcap-devel
# This is introduced to accomodate difference in RHEL5/CentOS5
%if 0%{?rhel} <= 5
BuildRequires: e2fsprogs-libs-devel
%else
BuildRequires: libuuid-devel
%endif
BuildRequires:	gnutls-devel
BuildRequires:	gpgme-devel
Requires(post):	chkconfig
Requires(preun): chkconfig
Requires(preun): initscripts

#Required by the openvas-nvt-sync and greenbone-nvt-sync
Requires:	/usr/bin/md5sum
Requires:	/usr/bin/rsync
Requires:	/usr/bin/wget
Requires:	/usr/bin/curl

%filter_provides_in %{_libdir}/openvas/plugins
%filter_setup

%description
Scanner module for the Open Vulnerability Assessment System (OpenVAS).

%prep
%setup -q
# %patch0 -p 1 -b .nvtfeed

for i in CHANGES ChangeLog; do
	iconv -f iso8859-1 -t utf-8 $i > $i.utf8 && \
	touch -r $i $i.utf8 && \
	mv -f $i.utf8 $i;
done

%build
%configure --disable-static
make %{?_smp_mflags}

%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot} INSTALL="install -p"
find %{buildroot} -name '*.la' -exec rm -f {} ';'
chmod 755 %{buildroot}/%{_libdir}/openvas/plugins

#Make directories for the NVT feeds
mkdir -p %{buildroot}/%{_libdir}/openvas/plugins/nvt
mkdir -p %{buildroot}/%{_libdir}/openvas/plugins/gsf

# Make plugin cache directory
mkdir -p %{buildroot}/%{_var}/cache/openvas

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

# Install initial configuration
#install -Dp -m 644 %{SOURCE2} %{buildroot}/%{_sysconfdir}/openvas/
sed -e "s:@@OPENVAS_PLUGINS@@:%{_libdir}/openvas/plugins:g
	s:@@OPENVAS_CACHE@@:%{_var}/cache/openvas:g
	s:@@OPENVAS_LOGDIR@@:%{_var}/log/openvas:g
	s:@@OPENVAS_SYSCONF@@:%{_sysconfdir}/openvas:g" %{SOURCE2} > openvassd.conf
install -Dp -m 644 openvassd.conf %{buildroot}/%{_sysconfdir}/openvas/

# install log rotation stuff
install -m 644 -Dp %{SOURCE3} \
	%{buildroot}/%{_sysconfdir}/logrotate.d/openvas-scanner

# Install sysconfig configration
install -Dp -m 644 %{SOURCE4} %{buildroot}/%{_sysconfdir}/sysconfig/openvas-scanner

# Install cront script for update
install -Dp -m 755 %{SOURCE5} %{buildroot}/%{_sbindir}/

# Install cront jobs to periodically update plugins
install -Dp -m 644 %{SOURCE6} %{buildroot}/%{_sysconfdir}/cron.d/openvas-sync-plugins

%clean
rm -rf %{buildroot}

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

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

%postun
if [ $1 -ge 1 ]; then
	/sbin/service openvas-scanner condrestart >/dev/null 2>&1
fi 

%files
%defattr(-,root,root,-)
%doc CHANGES ChangeLog COPYING README
%{_bindir}/openvas-mkcert-client
%{_sbindir}/openvas-adduser
%{_sbindir}/openvas-mkcert
%{_sbindir}/openvas-rmuser
%{_sbindir}/openvas-nvt-sync
%{_sbindir}/openvas-nvt-sync-cron
%{_sbindir}/greenbone-nvt-sync
%{_sbindir}/openvassd
%{_initddir}/openvas-scanner
%dir %{_sysconfdir}/openvas
%config(noreplace) %{_sysconfdir}/openvas/openvassd.conf
%config(noreplace) %{_sysconfdir}/sysconfig/openvas-scanner
%config(noreplace) %{_sysconfdir}/cron.d/openvas-sync-plugins
%{_mandir}/man1/openvas-mkcert-client.1.*
%{_mandir}/man8/openvas-adduser.8.*
%{_mandir}/man8/openvas-mkcert.8.*
%{_mandir}/man8/openvas-rmuser.8.*
%{_mandir}/man8/openvassd.8.*
%{_mandir}/man8/openvas-nvt-sync.8.*
%dir %{_var}/log/openvas
%dir %{_var}/lib/openvas
%dir %{_var}/lib/openvas/openvas-services
%dir %{_var}/cache/openvas
%config(noreplace) %{_sysconfdir}/logrotate.d/openvas-scanner
%dir %{_libdir}/openvas
%dir %{_libdir}/openvas/plugins
%dir %{_libdir}/openvas/plugins/nvt
%dir %{_libdir}/openvas/plugins/gsf
%attr(644,root,root) %{_libdir}/openvas/plugins/*.nes

%changelog
* Thu Dec  9 2010 Stjepan Gros <stjepan.gros@gmail.com> - 3.1.2-2
- Changed BR so that it works for both RHEL5/CentOS5 and Fedora
- Changed startup script so that it works for both RHEL5/CentOS5 and Fedora

* Tue Nov 23 2010 Stjepan Gros <stjepan.gros@gmail.com> - 3.1.1-1
- synced with upstream version

* Thu Apr 16 2010 Michal Ambroz <rebus at, seznam.cz> - 3.0.2-4
- subdirectories for nvt feeds

* Fri Apr 16 2010 Stjepan Gros <stjepan.gros@gmail.com> - 3.0.2-3
- Reverted plugin permissions to 644
- Removed non-existing provides

* Wed Apr 14 2010 Stjepan Gros <stjepan.gros@gmail.com> - 3.0.2-2
- Changes based on the comments in the following review
  https://bugzilla.redhat.com/show_bug.cgi?id=562469#c24
- Included missed modifications to openvassd.conf by Michal Ambroz

* Tue Apr 13 2010 Stjepan Gros <stjepan.gros@gmail.com> - 3.0.2-1
- bump to a new upstream release

* Thu Mar 25 2010 Michal Ambroz <rebus at, seznam.cz> - 3.0.1-6
- fix config on 32bit architecture, double includes in specfile, permissions
- usage of macros/shell variables

* Fri Mar 12 2010 Stjepan Gros <stjepan.gros@gmail.com> - 3.0.1-5
- cron job shouldn't be replaced upon upgrade
- better alignment with Fedora's SysVInitScript guidelines
- Moved cronjob to cron.d directory
- Changed init.d name from openvassd into openvas-scanner
- Don't strip binary plugins in install phase to properly generate debuginfo

* Tue Mar  9 2010 Stjepan Gros <stjepan.gros@gmail.com> - 3.0.1-4
- Added cron job to periodically update plugins
- Added new option to init.d script to reload plugins

* Wed Mar  3 2010 Stjepan Gros <stjepan.gros@gmail.com> - 3.0.1-3
- Changes based on the comments in
  https://bugzilla.redhat.com/show_bug.cgi?id=562469#c5
- Fixed a small bug in postun scriptlet
- Ownership of /etc/openvas directory moved to libraries
- Modified init.d script to change openvassd into openvas-scanner

* Fri Feb 26 2010 Stjepan Gros <stjepan.gros@gmail.com> - 3.0.1-2
- Added cmake BR
- Changes based on the comments in
  https://bugzilla.redhat.com/show_bug.cgi?id=562469#c3

* Sat Feb  6 2010 Stjepan Gros <stjepan.gros@gmail.com> - 3.0.1-1
- Upgraded spec file for scanner version 3

* Tue Nov 17 2009 Stjepan Gros <stjepan.gros@gmail.com> - 2.0.3-1
- Minor changes from taken from Xavier Bachelot <xavier@bachelot.org>
- Initial spec file