File babel_agents.spec of Package babel-agents

#
# Babel Agents
#
%define name        babel_agents
%define version	    1.1.0
Summary:            Agents  Babel Enterprise
Name:               %{name}
Version:            %{version}
Release:            1
License:            GPL
Vendor:             Sancho Lerena <sancho.lerena@artica.es>
Source0:            %{name}-%{version}.tar.gz
URL:                http://babel.sf.net
Group:              System/Monitoring
Packager:           Manuel Arostegui <marostegui@artica.es>
Prefix:             /opt
BuildRoot:          %{_tmppath}/%{name}-%{version}-buildroot
BuildArchitectures: noarch
Requires:           openssh-clients coreutils
AutoReq:            0
Provides:           %{name}-%{version}

%description
Babel has been designed with a very modular architecture, very easy to expand and customize. Agents are defined by a basic module, with extension .bem  (Babel Executable Module) who are independent from each other. Each module runs an specific security test (users, permissions, services, etc). Some of them have associated a small database in plain text. This is a white list or black list that allows administrator to customize the behaviour of agent, because helps to "filter"  the gathered information by agent. These libraries or small local databases, have the same name that the module, but with .lstextension. For example, in the password module, the library contains these words used by "default" in our corporation that, at this moment, we want to check no one is using them.
%prep
rm -rf $RPM_BUILD_ROOT

%setup -q -n Linux_SUSE10

%build

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{prefix}/%{name}-%{version}-%{release}
mkdir -p $RPM_BUILD_ROOT/usr/
mkdir -p $RPM_BUILD_ROOT/usr/bin/
mkdir -p $RPM_BUILD_ROOT/usr/share/
mkdir -p $RPM_BUILD_ROOT/usr/share/man
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1
mkdir -p $RPM_BUILD_ROOT/usr/share/etc/babel/
mkdir -p $RPM_BUILD_ROOT/usr/share/babel/
mkdir -p $RPM_BUILD_ROOT/usr/share/babel/temp/
mkdir -p $RPM_BUILD_ROOT/usr/local/
mkdir -p $RPM_BUILD_ROOT/usr/local/bin/
mkdir -p $RPM_BUILD_ROOT/etc/
mkdir -p $RPM_BUILD_ROOT/etc/babel/
mkdir -p $RPM_BUILD_ROOT/var/spool/babel/
mkdir -p $RPM_BUILD_ROOT/var/spool/babel/data_out
mkdir -p $RPM_BUILD_ROOT/var/log/babel/
cp -aRf * $RPM_BUILD_ROOT%{prefix}/%{name}-%{version}-%{release}
cp -aRf *  $RPM_BUILD_ROOT/usr/share/babel/
#cp babel_agent.conf $RPM_BUILD_ROOT/usr/share/babel/
#ln -s     $RPM_BUILD_ROOT/usr/share/babel/modules/  $RPM_BUILD_ROOT/etc/babel/
cp -r   $RPM_BUILD_ROOT%{prefix}/%{name}-%{version}-%{release}/log/ $RPM_BUILD_ROOT/var/log/
mv $RPM_BUILD_ROOT%{prefix}/%{name}-%{version}-%{release}/babel_agent $RPM_BUILD_ROOT/usr/bin/
#ln -s $RPM_BUILD_ROOT/usr/share/babel/ $RPM_BUILD_ROOT/etc/babel/
cp babel.1 $RPM_BUILD_ROOT/usr/share/man/man1/
cp babel_agents.1 $RPM_BUILD_ROOT/usr/share/man/man1/
if [ -f $RPM_BUILD_ROOT%{prefix}/%{name}-%{version}-%{release}/%{name}.spec ] ; then
    rm $RPM_BUILD_ROOT%{prefix}/%{name}-%{version}-%{release}/%{name}.spec
fi

%clean
rm -rf $RPM_BUILD_ROOT
%post
mkdir -p /etc/babel/
#ln -s /usr/share/babel/modules/ /etc/babel/modules/
ln -s /usr/share/babel/babel_agent.conf /etc/babel/babel_agent.conf
echo "Babel Agent has been place under /usr/bin/"
echo "Babel Agent configuration file is /etc/babel/babel_agent.conf"
%files
#/etc/babel/babel_agent.conf
#/etc/babel/modules/bigfiles.lst
#/etc/babel/modules/filehash.lst
#/etc/babel/modules/filehash.lst_full
#/etc/babel/modules/fileperm.lst
#/etc/babel/modules/inetd.lst
#/etc/babel/modules/kernel.lst
#/etc/babel/modules/openport.lst
#/etc/babel/modules/password.lst
#/etc/babel/modules/services.lst
#/etc/babel/modules/suid.lst
#/usr/share/babel/modules/
/usr/share/babel/util/create_allwritelist.sh
/usr/share/babel/util/create_permlist.sh
/usr/share/babel/util/extract_patch_sol.sh
/usr/share/babel/util/john
/usr/share/babel/util/john.ini
/usr/share/babel/util/lsof
/usr/share/babel/util/unshadow
#/etc/babel/babel
#/etc/babel/modules
   /usr/share/babel/babel.1
   /usr/share/babel/babel_agent
   /usr/share/babel/babel_agent.conf
   /usr/share/babel/babel_agents.1
   /usr/share/babel/doc/LICENSE
   /usr/share/babel/doc/README
   /usr/share/babel/doc/RPMUPDATE_SUSE
#   /usr/share/babel/modules/bigfiles.bem
   /usr/share/babel/modules/bigfiles.lst
#   /usr/share/babel/modules/filehash.bem
   /usr/share/babel/modules/filehash.lst
   /usr/share/babel/modules/filehash.lst_full
#   /usr/share/babel/modules/fileperm.bem
   /usr/share/babel/modules/fileperm.lst
#   /usr/share/babel/modules/inetd.bem
   /usr/share/babel/modules/inetd.lst
#   /usr/share/babel/modules/kernel.bem
   /usr/share/babel/modules/kernel.lst
#   /usr/share/babel/modules/openport.bem
   /usr/share/babel/modules/openport.lst
#   /usr/share/babel/modules/packages.bem
#   /usr/share/babel/modules/password.bem
   /usr/share/babel/modules/password.lst
#   /usr/share/babel/modules/remote.bem
#   /usr/share/babel/modules/services.bem
   /usr/share/babel/modules/services.lst
#  /usr/share/babel/modules/suid.bem
   /usr/share/babel/modules/suid.lst
#   /usr/share/babel/modules/uid0.bem
/var/log/babel/
%docdir %{prefix}/%{name}-%{version}-%{release}/docs
%{prefix}/%{name}-%{version}-%{release}
%defattr(600,babel,babel)
/var/spool/babel/
%defattr(700,babel,babel)
/usr/bin/babel_agent
/usr/share/babel/modules/*.bem

%{_mandir}/man1/babel.1.gz
%{_mandir}/man1/babel_agents.1.gz