Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > main-src > by-pkgid > 2ee437970d446390fd48edbb41cd433b > files > 2

naat-backend-0.8-10mdk.src.rpm

%define name naat-backend
%define version 0.8
%define release 10mdk

%define adminroot /home/admin

Summary: Backend for MandrakeSoft firewall admin tool.
Name: %{name} 
Version: %{version}
Release: %{release}
Source0: %{name}-%{version}.tar.bz2
License: GPL
Url:		http://www.mandrakesecure.net
Group: System/Configuration/Other
#BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-buildroot
Prefix: %{_prefix}

PreReq: /bin/chmod
PreReq: /usr/bin/sudo
PreReq: /sbin/chkconfig
PreReq: perl >= 5.6.0
#PreReq: ipchains
Requires: perl-Text-Template
Requires: drakxtools-newt >= 1.1.7-43mdk
Requires: newt
BuildRequires: /bin/chmod
BuildRequires: perl-devel >= 5.6.0
BuildRequires: librrdtool0-devel

%description
Backend for MandrakeSoft firewall admin tool.
Contains an event-handler, a config-wrapper (usable in 
commandline), as well as a sample configuration, and 
base templates, events, and scripts.

%package devel
Summary: Development package of the backend-end in NAAT project
Group: Development/Other
Requires: perl-devel >= 5.6.0
Requires: librrdtool0-devel
Requires: rpm-devel
Requires: rpm-build
Requires: /bin/chmod
Requires: gcc
Requires: make

%description devel
A set of development tools of the 
Network Appliance Administration Tool on Mandrake Linux Server.

%prep
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT

%setup -q
mkdir -p ${RPM_BUILD_DIR}/%{name}-devel/
tar -jxf ${RPM_SOURCE_DIR}/%{name}-%{version}.tar.bz2 -C ${RPM_BUILD_DIR}/%{name}-devel/

%build
%make
mv runtime/config-wrapper.pl runtime/config-wrapper.orig.pl
mv runtime/config-test.pl runtime/config-test.orig.pl
mv runtime/config-wrapper.pl.bin runtime/config-wrapper.pl
mv runtime/config-test.pl.bin runtime/config-test.pl

%install
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT
%makeinstall DESTDIR=$RPM_BUILD_ROOT
cp runtime/*.orig.pl $RPM_BUILD_ROOT%{_bindir}

mkdir -p $RPM_BUILD_ROOT%{_prefix}/src/%{name}-devel
cp -dpR ${RPM_BUILD_DIR}/%{name}-devel/* $RPM_BUILD_ROOT%{_prefix}/src/%{name}-devel/

%clean
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT

%pre
# Add Naat console in /etc/shells
grep -qw 'naat-console' /etc/shells  || \
	echo "/usr/bin/naat-console" >> /etc/shells

# Add admin group exist if doesn't exit
grep -q '^admin:' /etc/group || \
	/usr/sbin/groupadd admin 2> /dev/null


# Add the admin user (for console) if doesn't exist
grep -q '^admin:' /etc/passwd  || \
	/usr/sbin/useradd -c "Administrator"  -g admin -G adm -d /home/admin \
	-s /usr/bin/naat-console admin 2> /dev/null

# Backup the configuration file
if [ "$1" = "2" ]; then
		cp -fp /var/lib/naat/configuration /var/lib/naat/configuration.rpmbackup;
fi


%post
# add sudoers entry
/bin/chmod a+w /etc/sudoers
grep -q '%admin' /etc/sudoers || \
echo "%admin ALL=(ALL) NOPASSWD: /usr/bin/event-handler.pl , /usr/share/naat/scripts/*" >> /etc/sudoers;
grep -q 'Defaults !syslog' /etc/sudoers || echo 'Defaults !syslog' >> /etc/sudoers
/bin/chmod 0440 /etc/sudoers

# Restore the values stored in the previous configuration file
if [ "$1" = "2" ]; then
    perl -n -e 'if (!defined ($read) ) {
						open (CONFIG, "/var/lib/naat/configuration.rpmbackup") or 	die "Can t open config file: $!"; 
						while (<CONFIG>) {  
								chomp; s/\#.*//; s/^\s+//; s/\s+$//; next unless length;  
								($var, $value) = split(/\s*=\s*/, $_, 2); 
								$hash{$var} = $value; 
						} 
						close (CONFIG); 
						$read = "true";
				}
				$line = $_;
				chomp; s/\#.*//; s/^\s+//; s/\s+$//;
				if (length) {
						($var, $value) = split(/\s*=\s*/, $_, 2);
						if ($value !~ /(get:|set:)/ && exists $hash{$var} ) {
							$line = "$var=$hash{$var}\n";	
						} 
				}
				print $line;
			' -i /var/lib/naat/configuration;
fi

%postun 
# it it's a full uninstall
if [ "$1" = "0" ]; then
# remove sudoers entry
/bin/chmod a+w /etc/sudoers
grep -q '%admin' /etc/sudoers && \
	perl -ni -e 'print unless m!^%admin.*!' /etc/sudoers;
/bin/chmod 0440 /etc/sudoers
grep -q 'Defaults !syslog' /etc/sudoers && \
	perl -ni -e 'print unless m/^Defaults !syslog/' /etc/sudoers

# Remove Naat console from /etc/shells
perl -ni -e 'print unless m!/usr/bin/naat-console.*!' /etc/shells

fi

%files
%defattr(-,root,root)
%doc README configuration.README COPYRIGHT AUTHORS GPL ChangeLog
%dir %{_sysconfdir}/naat
%config(noreplace) %{_sysconfdir}/naat/*
%config %{_sysconfdir}/pingtest.conf
%dir %attr(2770,root,admin) %{_localstatedir}/naat
%attr(660,root,admin) %{_localstatedir}/naat/*
%attr(755,root,root) %{_bindir}/*
%attr(755,root,root) %{_sbindir}/*
%dir %{_libdir}/naat
%{_libdir}/naat/*
%dir %{_datadir}/naat
%{_datadir}/naat/*

%files devel
%defattr(-,root,root)
%doc README configuration COPYRIGHT AUTHORS GPL ChangeLog
%dir %{_prefix}/src/%{name}-devel
%{_prefix}/src/%{name}-devel/*

%changelog
*  Fri Mar 15 2002 Philippe Libat <philippe@mandrakesoft.com> 0.8-10mdk
- fix typo, squidguard, dansquardian, snort*,(florin)

*  Fri Mar 15 2002 Philippe Libat <philippe@mandrakesoft.com> 0.8-9mdk
- florin fix(squid,dansguardian, other things)

*  Wed Mar 13 2002 Philippe Libat <philippe@mandrakesoft.com> 0.8-8mdk
- fix configuration, (florin dansguardian,bind)

*  Fri Mar 08 2002 Philippe Libat <philippe@mandrakesoft.com> 0.8-7mdk
- fix services, other stuff (florin)

*  Thu Mar 07 2002 Philippe Libat <philippe@mandrakesoft.com> 0.8-6mdk
- new features, add configuration reset

* Wed Feb 20 2002 Florin <florin@mandrakesoft.com> 0.8-10mdk
- small backend fixes 

*  Mon Feb 18 2002 Philippe Libat <philippe@mandrakesoft.com> 0.8-3mdk
- New Version: shorewall, new services

*  Mon Feb 11 2002 Philippe Libat <philippe@mandrakesoft.com> 0.8-2mdk
- Add shorewall, fix lot of bugs

*  Wed Dec 19 2001 Philippe Libat <philippe@mandrakesoft.com> 0.8-1mdk
- version snf

*  Wed Dec 19 2001 Philippe Libat <philippe@mandrakesoft.com> 0.8-1mdk
- fix snf release

*  Wed Dec 19 2001 Philippe Libat <philippe@mandrakesoft.com> 0.7-1mdk
- Version snf

* Fri Nov 23 2001 Florin <florin@mandrakesoft.com> 0.6-3mdk
- Requires on libdrakxtools-newt instead of libdrakxtools

* Thu Nov 08 2001 Florin <florin@mandrakesoft.com> 0.6-2mdk
- Philippe, Renaud and I, actually
- make it work for cooker after 8.1 

* Fri Aug 24 2001 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.6-1mdk
- release for 8.1
- modify squid init script only if present
- update ipchains script in post
- updated files attributes

* Fri May  4 2001 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.5-3mdk
- events, ifup-local

* Wed May  2 2001 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.5-2mdk
- readded *.sh ......... (I won't kill anyone but I'd like to)
- updated sudoers file

* Mon Apr 30 2001 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.5-1mdk
- monitoring program in C from Vince, anacron in msec, bug fixes

* Thu Apr 3  2001 Philippe Libat <philippe@mandrakesoft.com> 0.4-6mdk
- prelude, iptoip

* Fri Mar 2  2001 Philippe Libat <philippe@mandrakesoft.com> 0.4-3mdk
- fixes for diald

* Wed Feb 14 2001 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.4-2mdk
- updated attributes on libs and scripts to build a correct rpm 
when checking out from CVS

* Fri Feb  9 2001 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.4-1mdk
- new version, and added several configurations that were in httpd-naat 
  packages previously

* Thu Feb  1 2001 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.3-15mdk
- update logs.pl

* Mon Jan 29 2001 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.3-14mdk
- update (config-test not case sensitive anymore) and change to noarch

* Fri Jan 26 2001 Philippe Libat <philippe@mandrakesoft.com> 0.3-13mdk
- squid, monitoring, 

* Thu Jan 25 2001 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.3-12mdk
- date

* Thu Jan 25 2001 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.3-11mdk
- update isdn scripts

* Wed Jan 24 2001 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.3-10mdk
- sticky bit on dir /var/lib/naat and more restrictive rights on files

* Tue Jan 23 2001 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.3-9mdk
- new more robust version, removed adsl init script (was a bad idea).

* Mon Jan 22 2001 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.3-8mdk
- new version with adsl initscript sourcing 
  /etc/sysconfig/network-scripts/net_cnx_up

* Fri Jan 19 2001 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.3-7mdk
- updated bastille template

* Fri Jan 19 2001 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.3-6mdk
- new version

* Fri Jan 12 2001 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.3-4mdk
- improved /etc/sudoers in-place edition in postun

* Thu Jan  10 2001 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.3-3mdk
- readded drakxtools files

* Thu Jan  4 2001 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.3-2mdk
- execution right on init scripts templates

* Wed Jan  3 2001 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.3-1mdk
- scripts are now passed the transaction name as a first arg
- hints naming scheme simplified and less prone to conflicts
- config-test.pl improvements
- fixed postun script
- removed draxtools patched files, should be included in 1.1.5-33.5mdk

* Fri Dec 29 2000 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.2-2mdk
- set correct rights on templates (net_cnx_up and _down with +x 
  for instance)

* Wed Dec 20 2000 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.2-1mdk
- new version with dns/dhcp tools, and mandrake update and  
  monitoring scripts

* Tue Nov 28 2000 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.1-4mdk
- improved sudoers hangling

* Thu Nov 23 2000 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.1-3mdk
- update

* Fri Nov 17 2000 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.1-2mdk
- update sudoers file in post and postun

* Fri Nov 17 2000 Renaud Chaillat <rchaillat@mandrakesoft.com> 0.1-1mdk
- First spec file for Mandrake distribution. 

# end of file