Compare commits

...
Sign in to create a new pull request.

7 commits

Author SHA1 Message Date
Fedora Release Engineering
7be12b31d2 dist-git conversion 2010-07-29 12:19:58 +00:00
Maros Barabas
982c273680 Fixed dBus problems in sectool-gui 2010-03-10 13:58:37 +00:00
Maros Barabas
512a480755 Added missing PolicyKit patch 2010-03-10 09:46:13 +00:00
Maros Barabas
622321b0dc Changed DBus sync call to async; removed killing python test scripts 2010-01-27 13:53:10 +00:00
Bill Nottingham
8a3e8d2910 Fix typo that causes a failure to update the common directory. (releng
#2781)
2009-11-26 01:38:25 +00:00
Maros Barabas
e0c3308d25 - changed policy file path
- removed usermod requirement
2009-11-19 13:57:23 +00:00
Jesse Keating
64332accd7 Initialize branch F-12 for sectool 2009-09-29 06:49:42 +00:00
6 changed files with 281 additions and 26 deletions

View file

View file

@ -1,21 +0,0 @@
# Makefile for source rpm: sectool
# $Id$
NAME := sectool
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := $(shell $(find-makefile-common))
ifeq ($(MAKEFILE_COMMON),)
# attept a checkout
define checkout-makefile-common
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
endif
include $(MAKEFILE_COMMON)

View file

@ -0,0 +1,156 @@
diff -up sectool-0.9.4/org.fedoraproject.sectool.mechanism.conf.old sectool-0.9.4/org.fedoraproject.sectool.mechanism.conf
--- sectool-0.9.4/org.fedoraproject.sectool.mechanism.conf.old 2009-09-01 10:20:23.000000000 +0200
+++ sectool-0.9.4/org.fedoraproject.sectool.mechanism.conf 2010-03-10 14:51:48.564326918 +0100
@@ -9,7 +9,7 @@
<allow own="org.fedoraproject.sectool.mechanism"/>
</policy>
<policy context="default">
- <allow send_destination="org.fedoraproject.sectool"/>
+ <allow send_destination="org.fedoraproject.sectool.mechanism"/>
<allow send_type="method_call"/>
</policy>
</busconfig>
diff -up sectool-0.9.4/org.fedoraproject.sectool.policy.old sectool-0.9.4/org.fedoraproject.sectool.policy
--- sectool-0.9.4/org.fedoraproject.sectool.policy.old 2009-08-24 16:43:10.000000000 +0200
+++ sectool-0.9.4/org.fedoraproject.sectool.policy 2010-03-10 14:51:51.858326825 +0100
@@ -20,8 +20,9 @@
<description>Run level</description>
<message>System policy prevents run level</message>
<defaults>
- <allow_inactive>no</allow_inactive>
- <allow_active>auth_admin</allow_active>
+ <allow_any>no</allow_any>
+ <allow_inactive>auth_admin_keep</allow_inactive>
+ <allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
@@ -29,9 +30,9 @@
<description>Run tests</description>
<message>System policy prevents run tests</message>
<defaults>
- <allow_any>no</allow_any>
- <allow_inactive>no</allow_inactive>
- <allow_active>auth_admin</allow_active>
+ <allow_any>auth_admin_keep</allow_any>
+ <allow_inactive>auth_admin_keep</allow_inactive>
+ <allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
diff -up sectool-0.9.4/src/sectool-gui.py.old sectool-0.9.4/src/sectool-gui.py
--- sectool-0.9.4/src/sectool-gui.py.old 2010-03-10 14:50:07.111201828 +0100
+++ sectool-0.9.4/src/sectool-gui.py 2010-03-10 14:52:01.219201762 +0100
@@ -712,10 +712,14 @@ class DBusCaller(object):
def __init__(self):
+ #print "DBusCaller::init::start"
self.timeout = -1
+ self.auth = 0
+ #print "DBusCaller::init::SystemBus()"
self.bus = dbus.SystemBus ()
#self.bus_name = dbus.service.BusName('org.fedoraproject.sectool.mechanism', self.bus)
- self.dbus_action_object = self.bus.get_object ("org.fedoraproject.sectool.mechanism", "/org/fedoraproject/sectool/object")
+ #self.dbus_action_object = self.bus.get_object ("org.fedoraproject.sectool.mechanism", "/org/fedoraproject/sectool/object")
+ #print "DBusCaller::init::end"
def get_action(self, action):
""" Get action from dbus sectool mechanism """
@@ -723,7 +727,7 @@ class DBusCaller(object):
@staticmethod
def error_handler(error):
- #print "ERROR: ", error
+ print "[ASYNC ERROR]: ", error
pass # We will recieve an error that timeout has expired
@staticmethod
@@ -736,12 +740,16 @@ class DBusCaller(object):
def close(self):
self.bus.flush()
- self.bus.close()
+ #self.bus.close() # can't close this, cause it will close main loop
def run( self, args, file ):
- auth = slip.dbus.polkit.IsSystemBusNameAuthorized( self.bus.get_unique_name(), "org.fedoraproject.sectool.runtests" )
+ #print "DBusCaller::run::start"
+ #if (self.auth != 1):
+ self.auth = slip.dbus.polkit.IsSystemBusNameAuthorized( self.bus.get_unique_name(), "org.fedoraproject.sectool.runtests" )
+ #print "DBusCaller::run::auth: \"",self.auth,"\" end"
self.runtests(args, file)
+ #print "DBusCaller::run::end"
@slip.dbus.polkit.enable_proxy
def runtests( self, args, file ):
@@ -754,7 +762,7 @@ class DBusCaller(object):
[args, file],
reply_handler=self.reply_handler,
error_handler=self.error_handler,
- timeout=0.00)
+ timeout=10)
class ThreadHandler(threading.Thread, Handler):
@@ -845,6 +853,9 @@ class ThreadHandler(threading.Thread, Ha
"""
self.readers = []
+ # get action from dbus
+ #print "start dbus"
+ self.bus = DBusCaller()
for test in self.__suite:
self.test = test
@@ -869,12 +880,10 @@ class ThreadHandler(threading.Thread, Ha
# Block for dbus exceptions handling, here should be all code that manipulate with dBus
try:
- # get action from dbus
- bus = DBusCaller()
-
# Start new thread - reader to listen on socket and update GUI if something from dBus comes up
# We need to call reader here, because of passing bus to close connection and save processes
- reader = Reader( file, test.dsc['HEADER']['NAME'], self.fill_form, self.test_done, iter, bus )
+ #print "start reader"
+ reader = Reader( file, test.dsc['HEADER']['NAME'], self.fill_form, self.test_done, iter, self.bus )
reader.start()
# Add reader to readers pool
self.readers.append( reader )
@@ -886,12 +895,15 @@ class ThreadHandler(threading.Thread, Ha
TODO: Look for async call, this is workaround using 0-timeout
If you use timeout=-1, it will be sequencial, all positives numbers are seconds in float
"""
-
- bus.run( self.__make_dbus_call( test.dsc["HEADER"]["NAME"] ), file )
+ #print "run start"
+ self.bus.run( self.__make_dbus_call( test.dsc["HEADER"]["NAME"] ), file )
+ #print "run end"
#bus.call( test.dsc["HEADER"]["NAME"], file )
except dbus.DBusException, e:
# This should always happend. We need to be stopped by dBus to start new test in separate thread
+ raise e
if 'org.freedesktop.DBus.Error.NoReply' in e.get_dbus_name():
+ print >>sys.stderr, "Not reply from DBus"
pass # maybe continue ?
# catch Authorization exception
elif 'NotAuthorizedException' in e.get_dbus_name():
@@ -939,6 +951,7 @@ class ThreadHandler(threading.Thread, Ha
The testing process is going to die .. we have a little time to stop all tests correctly
"""
self.__stopthread.set( )
+ self.bus.close()
for reader in self.readers:
reader.stop_thread()
@@ -1056,7 +1069,7 @@ class Reader(threading.Thread):
def stop_thread(self):
self.stop = True
- self.bus.close()
+ #self.bus.close()

21
sectool-0.9.4-pk1.patch Normal file
View file

@ -0,0 +1,21 @@
diff -up sectool-0.9.4/Makefile.old sectool-0.9.4/Makefile
--- sectool-0.9.4/Makefile.old 2009-11-19 13:36:45.680545213 +0100
+++ sectool-0.9.4/Makefile 2009-11-19 13:37:05.108513565 +0100
@@ -25,7 +25,7 @@ install:
mkdir -p $(DESTDIR)$(PKGDATADIR)
mkdir -p $(DESTDIR)$(PKGDATADIR)/scheduler
#mkdir -p $(DESTDIR)$(PKGDATADIR)/tests
- mkdir -p $(DESTDIR)$(DATADIR)/PolicyKit/policy/
+ mkdir -p $(DESTDIR)$(DATADIR)/polkit-1/actions/
mkdir -p $(DESTDIR)$(SYSCONFDIR)/dbus-1/system.d/
mkdir -p $(DESTDIR)$(DATADIR)/dbus-1/system-services/
mkdir -p $(DESTDIR)$(LIBEXECDIR)/sectool/tests
@@ -78,7 +78,7 @@ install:
done && test -z "$$fail"
chmod a+x $(DESTDIR)$(PKGDATADIR)/sectool-mechanism.py
# PolicyKit
- install -p -m644 org.fedoraproject.sectool.policy $(DESTDIR)$(DATADIR)/PolicyKit/policy/
+ install -p -m644 org.fedoraproject.sectool.policy $(DESTDIR)$(DATADIR)/polkit-1/actions/
install -p -m644 org.fedoraproject.sectool.mechanism.conf $(DESTDIR)$(SYSCONFDIR)/dbus-1/system.d/
install -p -m644 org.fedoraproject.sectool.mechanism.service $(DESTDIR)$(DATADIR)/dbus-1/system-services/

View file

@ -0,0 +1,84 @@
diff -up sectool-0.9.4/src/sectool-gui.py.old sectool-0.9.4/src/sectool-gui.py
--- sectool-0.9.4/src/sectool-gui.py.old 2009-12-08 17:11:31.417357216 +0100
+++ sectool-0.9.4/src/sectool-gui.py 2010-01-13 14:37:49.817461379 +0100
@@ -645,7 +645,7 @@ class TestHandler( Handler ):
""" Stop button has been pressed """
self.threadHandler.stop() #: give a short amount of time to stop the test by itself
- self.__signalHandler.kill_thread() #: kill the test by unix-style kill through os library
+ #self.__signalHandler.kill_thread() #: kill the test by unix-style kill through os library
def show_message_hint( self, test, msg_id ):
""" Show info message in hintWindow """
@@ -721,6 +721,16 @@ class DBusCaller(object):
""" Get action from dbus sectool mechanism """
return self.dbus_action_object.get_dbus_method( action, "org.fedoraproject.sectool.mechanism" )
+ @staticmethod
+ def error_handler(error):
+ #print "ERROR: ", error
+ pass # We will recieve an error that timeout has expired
+
+ @staticmethod
+ def reply_handler():
+ #print "REPLY done."
+ pass
+
def call(self, *p, **k):
self.bus.call_async(*p, **k)
@@ -728,13 +738,23 @@ class DBusCaller(object):
self.bus.flush()
self.bus.close()
+ def run( self, args, file ):
+
+ auth = slip.dbus.polkit.IsSystemBusNameAuthorized( self.bus.get_unique_name(), "org.fedoraproject.sectool.runtests" )
+ self.runtests(args, file)
+
@slip.dbus.polkit.enable_proxy
def runtests( self, args, file ):
- auth = slip.dbus.polkit.IsSystemBusNameAuthorized( self.bus.get_unique_name(), "org.fedoraproject.sectool.runtests" )
- if auth == "yes": self.timeout = 0.00
- self.dbus_action_object.runtests( args, file, timeout=self.timeout, dbus_interface = "org.fedoraproject.sectool.mechanism" )
- #dbus_action( self.__make_dbus_call( test.dsc["HEADER"]["NAME"] ), file, timeout=0.00 )
+ self.bus.call_async("org.fedoraproject.sectool.mechanism",
+ "/org/fedoraproject/sectool/object",
+ "org.fedoraproject.sectool.mechanism",
+ "runtests",
+ "ass",
+ [args, file],
+ reply_handler=self.reply_handler,
+ error_handler=self.error_handler,
+ timeout=0.00)
class ThreadHandler(threading.Thread, Handler):
@@ -867,7 +887,7 @@ class ThreadHandler(threading.Thread, Ha
If you use timeout=-1, it will be sequencial, all positives numbers are seconds in float
"""
- bus.runtests( self.__make_dbus_call( test.dsc["HEADER"]["NAME"] ), file )
+ bus.run( self.__make_dbus_call( test.dsc["HEADER"]["NAME"] ), file )
#bus.call( test.dsc["HEADER"]["NAME"], file )
except dbus.DBusException, e:
# This should always happend. We need to be stopped by dBus to start new test in separate thread
@@ -889,8 +909,6 @@ class ThreadHandler(threading.Thread, Ha
while self.done < count:
if self.__stopthread.isSet():
- for reader in self.readers:
- reader.stop_thread()
#self.__formatter.stopProgressBar()
break
time.sleep(2)
@@ -921,6 +939,8 @@ class ThreadHandler(threading.Thread, Ha
The testing process is going to die .. we have a little time to stop all tests correctly
"""
self.__stopthread.set( )
+ for reader in self.readers:
+ reader.stop_thread()
def __make_tmp_file( self ):
"""

View file

@ -1,12 +1,14 @@
Summary: A security audit system and intrusion detection system
Name: sectool
Version: 0.9.4
Release: 1%{?dist}
Release: 5%{?dist}
URL: https://hosted.fedoraproject.org/sectool/wiki/WikiStart
Source0: %{name}-%{version}.tar.bz2
Source1: sectool.log
Patch1: sectool-0.9.2-optflags.patch
#Patch2: sectool-0.9.3-ext4.patch
Patch2: sectool-0.9.4-pk1.patch
Patch3: sectool-0.9.4-policykit-fix.patch
Patch4: sectool-0.9.4-dbus-fix.patch
License: GPLv2+
Group: Applications/System
Requires: gettext coreutils libselinux python-slip-dbus PolicyKit dbus
@ -26,7 +28,7 @@ Summary: GUI for sectool - security audit system and intrusion detection system
License: GPLv2+
Group: Applications/System
Requires: sectool = %{version}-%{release}
Requires: pygtk2 usermode
Requires: pygtk2
%description
sectool is a security tool that can be used both as a security audit
@ -42,7 +44,9 @@ sectool-gui provides a GTK-based graphical user interface to sectool.
%prep
%setup -q
%patch1 -p1 -b .optflags
#%patch2 -p1 -b .ext4
%patch2 -p1 -b .pk1
%patch3 -p1 -b .policykit
%patch4 -p1 -b .dbus
%build
make %{?_smp_mflags}
@ -95,7 +99,7 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man8/sectool.8.gz
# PolicyKit
%{_sysconfdir}/dbus-1/system.d/org.fedoraproject.sectool.mechanism.conf
%{_datadir}/PolicyKit/policy/org.fedoraproject.sectool.policy
%{_datadir}/polkit-1/actions/org.fedoraproject.sectool.policy
%{_datadir}/dbus-1/system-services/org.fedoraproject.sectool.mechanism.service
%files gui
@ -112,6 +116,17 @@ rm -rf $RPM_BUILD_ROOT
%changelog
* Wed Mar 10 2010 Maros Barabas <mbarabas@redhat.com> - 0.9.4-5
- fixed dBus problems in sectool-gui
* Thu Nov 19 2009 Maros Barabas <mbarabas@redhat.com> - 0.9.4-4
- change dbus sync call to async
- removed killing python test scripts
* Thu Nov 19 2009 Maros Barabas <mbarabas@redhat.com> - 0.9.4-3
- change policy file path
- removed usermod requirement
* Wed Sep 09 2009 Maros Barabas <mbarabas@redhat.com> - 0.9.4-2
- upgrade with PolicyKit integration
- dbus update