Sophie

Sophie

distrib > Mandriva > 2007.1 > x86_64 > by-pkgid > 983203774e0615cc4eb609471d3be8ae > files > 2

naat-backend-0.8-37mdv2007.0.src.rpm

# detect if building under mandrake 8.2
%define mdk82 %(LC_ALL=C awk '{print ($4 <= 8.2)}' /etc/mandrake-release)
# detect if building under mandrake 9.0
%define mdk92 %(LC_ALL=C awk '{print ($4 >= 9.2)}' /etc/mandrake-release)

%define name naat-backend
%define version 0.8
%define release %mkrel 37

%define adminroot /home/admin

Summary: Backend for Mandriva 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

Requires(pre): coreutils
Requires(post): coreutils
Requires(postun): coreutils
Requires(post): sudo
Requires(postun): sudo
requires(post): perl
requires(postun): perl
Requires: perl-Text-Template
Requires: drakxtools-newt >= 1.1.7-43mdk
Requires: newt
BuildRequires: /bin/chmod
BuildRequires: perl-devel >= 5.6.0
BuildRequires: librrdtool-devel

%if %{mdk92} 
%define _requires_exceptions perl(Data::Dumper)\\|perl(Exporter)\\|perl(File::Basename)\\|perl(File::Path)\\|perl(Getopt::Long)\\|perl(POSIX)\\|perl(Text::Template)\\|perl(any)\\|perl(backend::config)\\|perl(backend::util)\\|perl(common)\\|perl(detect_devices)\\|perl(ethernet_info)\\|perl(isdn)\\|perl(lib)\\|perl(modules)\\|perl(netconnect)\\|perl(network)\\|perl(network::ethernet)\\|perl(network::isdn)\\|perl(network::modem)\\|perl(rpmtools)\\|perl(strict)\\|perl(urpm)\\|perl(vars)
%endif

%description
Backend for Mandriva 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 Mandriva 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
cp runtime/config-wrapper.pl runtime/config-wrapper.orig.pl
cp 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(noreplace) %{_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}/*
%{_prefix}/lib/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
* Sun May 28 2006 Pascal Terjan <pterjan@mandriva.org> 0.8-37mdv2007.0
- fix x86_64 build
- fix prereq syntax
- Mandrake -> Mandriva

* Mon Jan 02 2006 Lenny Cartier <lenny@mandriva.com> 0.8-36mdk
- requires librrdtool-devel rather than librrdtool0-devel (for x86_64)

* Tue Dec 23 2003 Florin <florin@mandrakesoft.com> 0.8-35mdk
- fix the mdk82, 92 definition
- fix the CLAMPSS in the shorewall.conf  
- rebuild

* Fri Dec 05 2003 Florin <florin@mandrakesoft.com> 0.8-34mdk
- add support for both freewan 1.X and 2.X versions

* Thu Dec 04 2003 Florin <florin@mandrakesoft.com> 0.8-33mdk
- update the VPN configs to freeswan 2x 

* Tue Dec 02 2003 Florin <florin@mandrakesoft.com> 0.8-32mdk
- fix the interfaces.pl

* Thu Nov 27 2003 Florin <florin@mandrakesoft.com> 0.8-31mdk
- cooker updates

* Wed Nov 26 2003 Florin <florin@mandrakesoft.com> 0.8-30mdk
- cooker updates

* Wed May 21 2003 Florin <florin@mandrakesoft.com> 0.8-29mdk
- several updates, fixes

* Thu Oct 24 2002 Florin <florin@mandrakesoft.com> 0.8-28mdk
- several updates, fixes

* Fri Aug 30 2002 Florin <florin@mandrakesoft.com> 0.8-27mdk
- small updates 

* Tue Aug 13 2002 Florin <florin@mandrakesof.com> 0.8-26mdk
- better service support (check_services.pl)

* Wed Aug 07 2002 Florin <florin@mandrakesoft.com> 0.8-25mdk
- use gentestcrtwindows to export the certtificate in pkcs12 format

*  Tue Jul 16 2002 Philippe Libat <philippe@mandrakesoft.com> 0.8-24mdk
- include shorewall.conf modification(florin)

* Fri Jun 28 2002 Florin <florin@mandrakesoft.com> 0.8-23mdk
- small vpn updates, small fixes

*  Wed Jun 26 2002 Philippe Libat <philippe@mandrakesoft.com> 0.8-22mdk
- fix uptime,vpn (florin)

* Tue Jun 18 2002 Florin <florin@mandrakesoft.com> 0.8-21mdk
- small vpn updates

*  Tue Jun 18 2002 Philippe Libat <philippe@mandrakesoft.com> 0.8-20mdk
- vpn working version

*  Mon Jun 17 2002 Philippe Libat <philippe@mandrakesoft.com> 0.8-19mdk
- vpn stuff (florin), fix typo and bugs

* Thu May 02 2002 Florin <florin@mandrakesoft.com> 0.8-18mdk
- more vpn stuff, not yet ready (florin)

*  Tue Apr 30 2002 Philippe Libat <philippe@mandrakesoft.com> 0.8-17mdk
- vpn(florin), fbugfixes, path

*  Fri Apr 19 2002 Philippe Libat <philippe@mandrakesoft.com> 0.8-16mdk
- add ProtocolList PortList

*  Wed Apr 17 2002 Philippe Libat <philippe@mandrakesoft.com> 0.8-15mdk
- florin fixes(DynDns), update mirror

*  Tue Apr 16 2002 Philippe Libat <philippe@mandrakesoft.com> 0.8-14mdk
- ez-ipupdate, squid (florin)

*  Thu Apr 11 2002 Philippe Libat <philippe@mandrakesoft.com> 0.8-13mdk
- fix update

*  Thu Apr 04 2002 Philippe Libat <philippe@mandrakesoft.com> 0.8-12mdk
- fix interfaces

*  Thu Apr 04 2002 Philippe Libat <philippe@mandrakesoft.com> 0.8-12mdk
- fix interfaces

*  Mon Mar 18 2002 Philippe Libat <philippe@mandrakesoft.com> 0.8-11mdk
- fix InternetStatus, default selected options, sumtraffic

*  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-35mdk
- 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