[Oval-commits] r248 - in trunk/oval-server: . debian
Javier Fernandez-Sanguino Pen~a
jfs at alioth.debian.org
Tue Sep 4 21:12:51 UTC 2007
Author: jfs
Date: 2007-09-04 21:12:51 +0000 (Tue, 04 Sep 2007)
New Revision: 248
Added:
trunk/oval-server/debian/install
trunk/oval-server/debian/oval-monitor.1
trunk/oval-server/debian/oval-server.1
trunk/oval-server/debian/postrm
trunk/oval-server/debian/pycompat
trunk/oval-server/server.conf
Removed:
trunk/oval-server/debian/manpage.1.ex
trunk/oval-server/debian/postinst.ex
trunk/oval-server/debian/postrm.ex
trunk/oval-server/debian/preinst.ex
trunk/oval-server/debian/prerm.ex
trunk/oval-server/oval-server.cfg
Modified:
trunk/oval-server/Dsa2Oval.TODO
trunk/oval-server/OvalServer.BUGS
trunk/oval-server/OvalServer.README
trunk/oval-server/OvalServer.TODO
trunk/oval-server/debian/control
trunk/oval-server/debian/oval-server.default
trunk/oval-server/debian/oval-server.init
trunk/oval-server/debian/rules
trunk/oval-server/dsa2oval.py
trunk/oval-server/oval-monitor.py
trunk/oval-server/oval-server.py
trunk/oval-server/setup.py
Log:
Commit patchset sent by Pavel (#1)
Modified: trunk/oval-server/Dsa2Oval.TODO
===================================================================
--- trunk/oval-server/Dsa2Oval.TODO 2007-09-04 21:10:52 UTC (rev 247)
+++ trunk/oval-server/Dsa2Oval.TODO 2007-09-04 21:12:51 UTC (rev 248)
@@ -1,6 +1,5 @@
Summer:
Update uname architecture mappings
- Build debian package
Refactoring and optimization of source code
Later:
Modified: trunk/oval-server/OvalServer.BUGS
===================================================================
--- trunk/oval-server/OvalServer.BUGS 2007-09-04 21:10:52 UTC (rev 247)
+++ trunk/oval-server/OvalServer.BUGS 2007-09-04 21:12:51 UTC (rev 248)
@@ -1,3 +1,3 @@
CTRL+C don't kill server
Fix UTC/Local time in timestamps
-
\ No newline at end of file
+postrm script remove oval user if oval-agent installed
Modified: trunk/oval-server/OvalServer.README
===================================================================
--- trunk/oval-server/OvalServer.README 2007-09-04 21:10:52 UTC (rev 247)
+++ trunk/oval-server/OvalServer.README 2007-09-04 21:12:51 UTC (rev 248)
@@ -1,10 +1 @@
-Dependencies:
- python > 2.4
- python-pysqlite2
- python-libxml2
- python-pyopenssl
- python-xml
-
-Installation:
- You need manualy create all log, dsa and other directories
-
+Currently none
Modified: trunk/oval-server/OvalServer.TODO
===================================================================
--- trunk/oval-server/OvalServer.TODO 2007-09-04 21:10:52 UTC (rev 247)
+++ trunk/oval-server/OvalServer.TODO 2007-09-04 21:12:51 UTC (rev 248)
@@ -1,16 +1,7 @@
-CLI monitor:
- that just says:
- - X vulnerabilities in the database
- - X agents
- The following agents are vulnerable:
- - X to Y
- - Y to Z
- The following agents have not updated since new vulnerabilities where added: A, B, C
-
dsaSync:
Implement mail sync
Implement rss sync
Filtering by release
proper license headers in all code files, I don't see any of them with that
-the server/agent should either warn about the cfg directories missing or should create them
\ No newline at end of file
+the server/agent should either warn about the cfg directories missing or should create them
Modified: trunk/oval-server/debian/control
===================================================================
--- trunk/oval-server/debian/control 2007-09-04 21:10:52 UTC (rev 247)
+++ trunk/oval-server/debian/control 2007-09-04 21:12:51 UTC (rev 248)
@@ -2,19 +2,21 @@
Section: admin
Priority: optional
Maintainer: Pavel Vinogradov <Pavel.Vinogradov at nixdev.net>
-Build-Depends: debhelper (>= 5)
+Build-Depends: debhelper (>= 5.0.37.2), python2.4 (>=2.4-1)
Build-Depends-Indep: python-dev, python-support (>= 0.5.6)
Standards-Version: 3.7.2
Homepage: http://alioth.debian.org/projects/oval/
XS-Vcs-Svn: svn://svn.debian.org/oval/oval/trunk
XS-Vcs-Browser: http://svn.debian.org/wsvn/oval/oval/trunk/
+XS-Python-Version: 2.4
+XB-Python-Version: ${python:Versions}
Package: oval-server
Architecture: all
-Depends: ${python:Depends}
+Depends: ${python:Depends}, python2.4-libxml2, python2.4-pyopenssl, python2.4-pysqlite2, python2.4-xml, adduser
Description: OVAL server
- OVAL server is a daemon that manages OVAL agents installed in other
- computers. The server generates the OVAL definitions by parsing information
- from Debian Security Advisories. This information is provided to agents
- and the result of the evaluation (vulnerable or not vulnerable) is stored
- in an SQLite database.
+ OVAL server is a daemon that manages OVAL agents installed in other
+ computers. The server generates the OVAL definitions by parsing information
+ from Debian Security Advisories. This information is provided to agents
+ and the result of the evaluation (vulnerable or not vulnerable) is stored
+ in an SQLite database.
Added: trunk/oval-server/debian/install
===================================================================
--- trunk/oval-server/debian/install (rev 0)
+++ trunk/oval-server/debian/install 2007-09-04 21:12:51 UTC (rev 248)
@@ -0,0 +1 @@
+server.conf etc/oval
Deleted: trunk/oval-server/debian/manpage.1.ex
===================================================================
--- trunk/oval-server/debian/manpage.1.ex 2007-09-04 21:10:52 UTC (rev 247)
+++ trunk/oval-server/debian/manpage.1.ex 2007-09-04 21:12:51 UTC (rev 248)
@@ -1,59 +0,0 @@
-.\" Hey, EMACS: -*- nroff -*-
-.\" First parameter, NAME, should be all caps
-.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
-.\" other parameters are allowed: see man(7), man(1)
-.TH OVAL-AGENT SECTION "Август 23, 2007"
-.\" Please adjust this date whenever revising the manpage.
-.\"
-.\" Some roff macros, for reference:
-.\" .nh disable hyphenation
-.\" .hy enable hyphenation
-.\" .ad l left justify
-.\" .ad b justify to both left and right margins
-.\" .nf disable filling
-.\" .fi enable filling
-.\" .br insert line break
-.\" .sp <n> insert n+1 empty lines
-.\" for manpage-specific macros, see man(7)
-.SH NAME
-oval-agent \- program to do something
-.SH SYNOPSIS
-.B oval-agent
-.RI [ options ] " files" ...
-.br
-.B bar
-.RI [ options ] " files" ...
-.SH DESCRIPTION
-This manual page documents briefly the
-.B oval-agent
-and
-.B bar
-commands.
-.PP
-.\" TeX users may be more comfortable with the \fB<whatever>\fP and
-.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
-.\" respectively.
-\fBoval-agent\fP is a program that...
-.SH OPTIONS
-These programs follow the usual GNU command line syntax, with long
-options starting with two dashes (`-').
-A summary of options is included below.
-For a complete description, see the Info files.
-.TP
-.B \-h, \-\-help
-Show summary of options.
-.TP
-.B \-v, \-\-version
-Show version of program.
-.SH SEE ALSO
-.BR bar (1),
-.BR baz (1).
-.br
-The programs are documented fully by
-.IR "The Rise and Fall of a Fooish Bar" ,
-available via the Info system.
-.SH AUTHOR
-oval-agent was written by <upstream author>.
-.PP
-This manual page was written by Pavel Vinogradov <Pavel.Vinogradov at nixdev.net>,
-for the Debian project (but may be used by others).
Added: trunk/oval-server/debian/oval-monitor.1
===================================================================
--- trunk/oval-server/debian/oval-monitor.1 (rev 0)
+++ trunk/oval-server/debian/oval-monitor.1 2007-09-04 21:12:51 UTC (rev 248)
@@ -0,0 +1,49 @@
+.TH oval-monitor 1 "August 31, 2007"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+oval-monitor \- program that generate reports about agents status
+.SH SYNOPSIS
+.B oval-agent
+[\-h] [\-c filename] [\-v] [\-a <agent ip>] [\-d <DSA id>]
+.SH DESCRIPTION
+.B oval-monitor
+tool to generate reports based on
+.B oval-server
+database. Currently support three reports - general, agent and definition.
+.PP
+.SH OPTIONS
+.TP
+.B \-h
+Show summary of options.
+.TP
+.B \-c filename
+Path to configuration file
+.TP
+.B \-v
+Show version of program.
+.TP
+.B \-a <agent ip>
+Generate agent report for selected agent.
+.TP
+.B \-d <DSA id>
+Generate definition report for selected DSA.
+.SH SEE ALSO
+.BR oval-agent (1),
+.BR oval-server (1).
+.br
+.SH AUTHOR
+oval-monitor was written by Pavel Vinogradov <Pavel.Vinogradov at nixdev.net>.
+.PP
+This manual page was written by Pavel Vinogradov <Pavel.Vinogradov at nixdev.net>,
+for the Debian project (but may be used by others).
Added: trunk/oval-server/debian/oval-server.1
===================================================================
--- trunk/oval-server/debian/oval-server.1 (rev 0)
+++ trunk/oval-server/debian/oval-server.1 2007-09-04 21:12:51 UTC (rev 248)
@@ -0,0 +1,43 @@
+.TH oval-server 1 "August 31, 2007"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+oval-server \- program that generate OVAL definitions, send them to agents and store results
+.SH SYNOPSIS
+.B oval-server
+[\-h] [\-c filename] [\-v]
+.SH DESCRIPTION
+.B oval-server
+daemon was developed to automize generation of OVAL definitions and distribute them to agents and store result of evalution. This result may be queried by
+.B oval-monitor
+tool.
+.PP
+.SH OPTIONS
+.TP
+.B \-h
+Show summary of options.
+.TP
+.B \-c filename
+Path to configuration file
+.TP
+.B \-v
+Show version of program.
+.SH SEE ALSO
+.BR oval-agent (1),
+.BR oval-monitor (1).
+.br
+.SH AUTHOR
+oval-server was written by Pavel Vinogradov <Pavel.Vinogradov at nixdev.net>.
+.PP
+This manual page was written by Pavel Vinogradov <Pavel.Vinogradov at nixdev.net>,
+for the Debian project (but may be used by others).
Modified: trunk/oval-server/debian/oval-server.default
===================================================================
--- trunk/oval-server/debian/oval-server.default 2007-09-04 21:10:52 UTC (rev 247)
+++ trunk/oval-server/debian/oval-server.default 2007-09-04 21:12:51 UTC (rev 248)
@@ -22,4 +22,4 @@
# The configuration file to use.
#
-OVALSERVER_CONFIG_FILE=/etc/oval/oval-server.conf
+OVALSERVER_CONFIG_FILE=/etc/oval/server.conf
Modified: trunk/oval-server/debian/oval-server.init
===================================================================
--- trunk/oval-server/debian/oval-server.init 2007-09-04 21:10:52 UTC (rev 247)
+++ trunk/oval-server/debian/oval-server.init 2007-09-04 21:12:51 UTC (rev 248)
@@ -22,8 +22,8 @@
PIDFILE=/var/run/oval-server.pid
OVALSERVER_ENABLE=false
-#OVALAGENT_USER=debtorrent
-OVALSERVER_CONFIG_FILE=/etc/oval/oval-server.conf
+OVALSERVER_USER=oval
+OVALSERVER_CONFIG_FILE=/etc/oval/server.conf
OVALSERVER_LOG_DIR=/var/log/oval/
test -x $DAEMON || exit 0
@@ -58,7 +58,7 @@
exit 1
fi
start-stop-daemon --start --quiet --background \
- --pidfile $PIDFILE --make-pidfile \
+ --pidfile $PIDFILE --make-pidfile --chuid $OVALSERVER_USER\
--exec $DAEMON \
-- -c "$OVALSERVER_CONFIG_FILE"
log_end_msg $?
@@ -93,7 +93,7 @@
rm -f $PIDFILE
fi
if start-stop-daemon --start --quiet --background \
- --pidfile $PIDFILE --make-pidfile \
+ --pidfile $PIDFILE --make-pidfile --chuid $OVALSERVER_USER\
--exec $DAEMON \
-- -c "$OVALSERVER_CONFIG_FILE"
then
Deleted: trunk/oval-server/debian/postinst.ex
===================================================================
--- trunk/oval-server/debian/postinst.ex 2007-09-04 21:10:52 UTC (rev 247)
+++ trunk/oval-server/debian/postinst.ex 2007-09-04 21:12:51 UTC (rev 248)
@@ -1,41 +0,0 @@
-#!/bin/sh
-# postinst script for oval-agent
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-# * <postinst> `configure' <most-recently-configured-version>
-# * <old-postinst> `abort-upgrade' <new version>
-# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
-# <new-version>
-# * <postinst> `abort-remove'
-# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
-# <failed-install-package> <version> `removing'
-# <conflicting-package> <version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-
-case "$1" in
- configure)
- ;;
-
- abort-upgrade|abort-remove|abort-deconfigure)
- ;;
-
- *)
- echo "postinst called with unknown argument \`$1'" >&2
- exit 1
- ;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
-
-
Added: trunk/oval-server/debian/postrm
===================================================================
--- trunk/oval-server/debian/postrm (rev 0)
+++ trunk/oval-server/debian/postrm 2007-09-04 21:12:51 UTC (rev 248)
@@ -0,0 +1,60 @@
+#!/bin/sh
+# postrm script for oval-server
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postrm> `remove'
+# * <postrm> `purge'
+# * <old-postrm> `upgrade' <new-version>
+# * <new-postrm> `failed-upgrade' <old-version>
+# * <new-postrm> `abort-install'
+# * <new-postrm> `abort-install' <old-version>
+# * <new-postrm> `abort-upgrade' <old-version>
+# * <disappearer's-postrm> `disappear' <overwriter>
+# <overwriter-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+OVALAGENT=`dpkg -l | grep oval-agent | awk '{print $1}'`
+
+case "$1" in
+ purge)
+ rm -rf /var/cache/oval-server
+ rm -rf /var/lib/oval-server
+ ;;
+
+ remove)
+ if [ "OVALAGENT" != "ii" ]; then
+ rm -rf /var/log/oval
+ else
+ rm -rf /var/log/oval/oval-server.log
+ fi
+
+ if [ "OVALAGENT" != "ii" ]; then
+ if id oval >/dev/null; then
+ deluser oval
+ fi
+ fi
+ ;;
+
+ upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+ ;;
+
+ *)
+ echo "postrm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
Deleted: trunk/oval-server/debian/postrm.ex
===================================================================
--- trunk/oval-server/debian/postrm.ex 2007-09-04 21:10:52 UTC (rev 247)
+++ trunk/oval-server/debian/postrm.ex 2007-09-04 21:12:51 UTC (rev 248)
@@ -1,39 +0,0 @@
-#!/bin/sh
-# postrm script for oval-agent
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-# * <postrm> `remove'
-# * <postrm> `purge'
-# * <old-postrm> `upgrade' <new-version>
-# * <new-postrm> `failed-upgrade' <old-version>
-# * <new-postrm> `abort-install'
-# * <new-postrm> `abort-install' <old-version>
-# * <new-postrm> `abort-upgrade' <old-version>
-# * <disappearer's-postrm> `disappear' <overwriter>
-# <overwriter-version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-
-case "$1" in
- purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
- ;;
-
- *)
- echo "postrm called with unknown argument \`$1'" >&2
- exit 1
- ;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
-
-
Deleted: trunk/oval-server/debian/preinst.ex
===================================================================
--- trunk/oval-server/debian/preinst.ex 2007-09-04 21:10:52 UTC (rev 247)
+++ trunk/oval-server/debian/preinst.ex 2007-09-04 21:12:51 UTC (rev 248)
@@ -1,37 +0,0 @@
-#!/bin/sh
-# preinst script for oval-agent
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-# * <new-preinst> `install'
-# * <new-preinst> `install' <old-version>
-# * <new-preinst> `upgrade' <old-version>
-# * <old-preinst> `abort-upgrade' <new-version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-
-case "$1" in
- install|upgrade)
- ;;
-
- abort-upgrade)
- ;;
-
- *)
- echo "preinst called with unknown argument \`$1'" >&2
- exit 1
- ;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
-
-
Deleted: trunk/oval-server/debian/prerm.ex
===================================================================
--- trunk/oval-server/debian/prerm.ex 2007-09-04 21:10:52 UTC (rev 247)
+++ trunk/oval-server/debian/prerm.ex 2007-09-04 21:12:51 UTC (rev 248)
@@ -1,40 +0,0 @@
-#!/bin/sh
-# prerm script for oval-agent
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-# * <prerm> `remove'
-# * <old-prerm> `upgrade' <new-version>
-# * <new-prerm> `failed-upgrade' <old-version>
-# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
-# * <deconfigured's-prerm> `deconfigure' `in-favour'
-# <package-being-installed> <version> `removing'
-# <conflicting-package> <version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-
-case "$1" in
- remove|upgrade|deconfigure)
- ;;
-
- failed-upgrade)
- ;;
-
- *)
- echo "prerm called with unknown argument \`$1'" >&2
- exit 1
- ;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
-
-
Added: trunk/oval-server/debian/pycompat
===================================================================
--- trunk/oval-server/debian/pycompat (rev 0)
+++ trunk/oval-server/debian/pycompat 2007-09-04 21:12:51 UTC (rev 248)
@@ -0,0 +1 @@
+2
Modified: trunk/oval-server/debian/rules
===================================================================
--- trunk/oval-server/debian/rules 2007-09-04 21:10:52 UTC (rev 247)
+++ trunk/oval-server/debian/rules 2007-09-04 21:12:51 UTC (rev 248)
@@ -37,7 +37,6 @@
dh_installdirs
./setup.py install --prefix=$(CURDIR)/debian/oval-server/usr --install-lib=$(CURDIR)/debian/oval-server/usr/share/python-support/oval-server
- install -m644 oval-server.cfg $(CURDIR)/debian/oval-server/etc/oval/oval-server.conf
# Remove the generated .pyc files
( cd debian/oval-server/usr/share/python-support/oval-server/oval && \
@@ -55,27 +54,23 @@
dh_testroot
dh_installdocs
dh_installexamples
- dh_installman
-# dh_installmenu
+ dh_installman debian/oval-server.1 debian/oval-monitor.1 debian/dsa2oval.1
# dh_installdebconf
# dh_installlogrotate
-# dh_installemacsen
-# dh_installpam
-# dh_installmime
-# dh_python
+ dh_pysupport
+ dh_python
# dh_installcron
# dh_installinfo
- for i in oval-server dsa2oval ; \
+ for i in oval-server dsa2oval oval-monitor; \
do mv debian/oval-server/usr/bin/$$i.py debian/oval-server/usr/bin/$$i; done
- dh_installchangelogs --name=oval-server
- dh_installinit
+ dh_installchangelogs
+ dh_installinit --name=oval-server
dh_install
dh_link
- dh_strip
+# dh_strip
dh_compress
dh_fixperms
-# dh_perl
# dh_makeshlibs
dh_installdeb
dh_shlibdeps
Modified: trunk/oval-server/dsa2oval.py
===================================================================
--- trunk/oval-server/dsa2oval.py 2007-09-04 21:10:52 UTC (rev 247)
+++ trunk/oval-server/dsa2oval.py 2007-09-04 21:12:51 UTC (rev 248)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2.4
# -*- coding: utf-8 -*-
# Extracts the data DSA files and creates OVAL queries to
# be used with the OVAL query interpreter (see http://oval.mitre.org)
@@ -12,9 +12,9 @@
import getopt
import logging
-from dsa2oval.definition import generator
-from dsa2oval.parser import dsa
-from dsa2oval.parser import wml
+from oval.dsa2oval.definition import generator
+from oval.dsa2oval.parser import dsa
+from oval.dsa2oval.parser import wml
dsaref = {}
@@ -133,4 +133,4 @@
parsedirs (opts['-d'], '.data', 2)
if opts.has_key('-f'):
parsefile (opts['-f'])
- printdsas(dsaref)
\ No newline at end of file
+ printdsas(dsaref)
Modified: trunk/oval-server/oval-monitor.py
===================================================================
--- trunk/oval-server/oval-monitor.py 2007-09-04 21:10:52 UTC (rev 247)
+++ trunk/oval-server/oval-monitor.py 2007-09-04 21:12:51 UTC (rev 248)
@@ -1,10 +1,10 @@
-#!/usr/bin/env python
+#!/usr/bin/python2.4
# -*- coding: utf-8 -*-
# # Written by Pavel Vinogradov
# Licensed under the GNU General Public License version 2.
from ConfigParser import SafeConfigParser
-from oval.dba.dba import dba
+from oval.dba.dba import dba, dbaNotAccesible
import os, sys, time, getopt
import traceback, exceptions
@@ -16,7 +16,7 @@
print """usage: python %s [-h] [-c <config>] [-a <agent ip>] [-d <dsa id>]
\t-h\tthis help
-\t-c\tpath to config file (by default oval-server.cfg
+\t-c\tpath to config file (by default /etc/oval/server.conf
\t-a\tagent id
\t-d\tDebian Security Annnounce id
""" % prog
@@ -35,9 +35,26 @@
#Init static fields in dba and Dsa2Oval classes
dba.dbPath = self.dbPath
self.db = dba ()
- except:
- pass
+ except Exception, e:
+ raise e
+ def getAgentAffectedVuln (self, agentID):
+ cursor = self.db.getCursor()
+
+ cursor.execute ('SELECT vulnDSA from affected WHERE agentID = %d and status = 1' % agentID)
+ result = cursor.fetchall()
+ return result
+
+ def getAgentNottestedVuln (self, agentID):
+ cursor = self.db.getCursor()
+
+ cursor.execute ("""SELECT vulnDSA FROM vulnerabilities
+ WHERE vulnDSA NOT IN (
+ SELECT vulnDSA FROM affected where agentID = %d);
+ """ % agentID)
+ result = cursor.fetchall()
+ return result
+
def reportAgent (self, agentID):
cursor = self.db.getCursor()
@@ -45,25 +62,18 @@
dsas = cursor.fetchall()
count = 0
- print 'Agent %d\n' % agentID
+ print 'Agent %d:' % agentID
for dsa in dsas:
if dsa[1] == 1:
- print 'Affected to DSA ID %s' % dsa[0]
+ print '\tAffected to DSA ID %s' % dsa[0]
else:
count += 1
- print 'Not affected to %d DSA' % count
+ print '\tNot affected to %d DSA' % count
- print '--------------------------'
-# cursor.execute ("""SELECT vulnerabilities.vulnDSA FROM vulnerabilities
-# LEFT JOIN affected
-# ON vulnerabilities.vulnDSA = affected.vulnDSA
-# WHERE affected.agentID = %d AND vulnerabilities.vulnTimestamp > affected.vulnTimestamp OR affected.vulnTimestamp IS NULL;""" % agentID)
-#
-# dsas = cursor.fetchall()
-# count = 0
-# for dsa in dsas:
-# print 'Not tested again DSA ID %s' %dsa[0]
-# count += 1
+ print '\t--------------------------'
+ dsas = self.getAgentNottestedVuln (agentID)
+ for dsa in dsas:
+ print '\tNot tested again DSA ID %s' %dsa[0]
def reportDSA (self, dsaID):
cursor = self.db.getCursor()
@@ -74,11 +84,14 @@
print '\t%d \t %s' % (agent[0], agent[1])
print '------------------------------'
-# cursor.execute ('SELECT agents.agentID from agents LEFT JOIN affected ON agents.agentID = affected.agentID WHERE vulnDSA = %d' % dsaID)
-# agents = cursor.fetchall ()
-# print 'Agents not tested to DSA %d:' % dsaID
-# for agent in agents:
-# print '\t%d' % agent[0]
+ cursor.execute ("""
+ SELECT agentID, agentName from agents
+ WHERE agentID NOT IN (
+ SELECT agentID FROM affected WHERE vulnDSA = %d);""" % dsaID)
+ agents = cursor.fetchall ()
+ print 'Agents not tested to DSA %d:' % dsaID
+ for agent in agents:
+ print '\t%d \t %s' % (agent[0], agent[1])
@@ -88,9 +101,9 @@
cursor.execute ("SELECT * FROM agents;")
agents = cursor.fetchall()
- print 'Agents: (ID, \t IP)'
+ print 'Agents: (ID \t IP \t\t Aff \tNot tested)'
for agent in agents:
- print '\t %d \t %s ' % (agent[0], agent[1])
+ print '\t %d \t %s \t %s \t %s' % (agent[0], agent[1], len(self.getAgentAffectedVuln(agent[0])), len(self.getAgentNottestedVuln(agent[0])))
cursor.execute ("SELECT count(*) from vulnerabilities;")
dsas = cursor.fetchall()[0][0]
@@ -99,7 +112,7 @@
if __name__ == "__main__":
#Parse command line options.
#By default we search for config file in current directory
- opts = {'-c' : 'oval-server.cfg'}
+ opts = {'-c' : '/etc/oval/server.conf'}
try:
opt, args = getopt.getopt (sys.argv[1:], 'hc:a:d:')
@@ -133,10 +146,11 @@
except configNotFoundError, e:
sys.stderr.write (str(e))
- except KeyboardInterrupt, e:
- sys.stderr.write ('Execution interrupted by keyboard.')
+ except dbaNotAccesible, e:
+ sys.stderr.write ("ERROR: Can't access to database file\n")
+ usage(sys.argv[0])
except exceptions.SystemExit, e:
raise e
except Exception, e:
- sys.stderr.write('Unhandled error during execution: %s : %s.\n' % (e.__class__, str(e)))
+ sys.stderr.write('ERROR: Unhandled error during execution: %s : %s.\n' % (e.__class__, str(e)))
traceback.print_exc()
Deleted: trunk/oval-server/oval-server.cfg
===================================================================
--- trunk/oval-server/oval-server.cfg 2007-09-04 21:10:52 UTC (rev 247)
+++ trunk/oval-server/oval-server.cfg 2007-09-04 21:12:51 UTC (rev 248)
@@ -1,32 +0,0 @@
-[general]
-log_dir = /var/log/oval/
-log_file = oval-server.log
-#log_level = CRITICAL | ERROR | WARNING (default) | INFO | DEBUG | NOTSET
-log_level = INFO
-dsa_storage = /var/lib/oval-server/dsa
-db = /var/lib/oval-server/oval-server.db
-
-[server]
-type = http
-ip = 127.0.0.1
-port = 8989
-workdir = /var/cache/oval-server/definitions
-
-[source]
-type = local
-name = "Local OVAL definitions source"
-source = /var/cache/oval-server/repos
-update_interval = 1
-
-#type = http
-#name = "OVAL http repository"
-#source = /~blaze/debian/dsa/
-#server = server
-#update_interval = 1
-
-#type = ftp
-#name = "OVAL ftp repository"
-#source = debian/dsa
-#server = server
-#update_interval = 1
-
Modified: trunk/oval-server/oval-server.py
===================================================================
--- trunk/oval-server/oval-server.py 2007-09-04 21:10:52 UTC (rev 247)
+++ trunk/oval-server/oval-server.py 2007-09-04 21:12:51 UTC (rev 248)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2.4
# -*- coding: utf-8 -*-
#
# Written by Pavel Vinogradov
@@ -24,7 +24,7 @@
print """usage: python %s [-h] [-c <config>]
\t-h\tthis help
-\t-c\tpath to config file (by default oval-server.cfg""" % prog
+\t-c\tpath to config file (by default /etc/oval/server.conf""" % prog
class httpThread(Thread):
@@ -188,7 +188,7 @@
if __name__ == "__main__":
#Parse command line options.
#By default we search for config file in current directory
- opts = {'-c' : 'oval-server.cfg'}
+ opts = {'-c' : '/etc/oval/server.conf'}
try:
opt, args = getopt.getopt (sys.argv[1:], 'hc:')
Copied: trunk/oval-server/server.conf (from rev 247, trunk/oval-server/oval-server.cfg)
===================================================================
--- trunk/oval-server/server.conf (rev 0)
+++ trunk/oval-server/server.conf 2007-09-04 21:12:51 UTC (rev 248)
@@ -0,0 +1,32 @@
+[general]
+log_dir = /var/log/oval/
+log_file = oval-server.log
+#log_level = CRITICAL | ERROR | WARNING (default) | INFO | DEBUG | NOTSET
+log_level = INFO
+dsa_storage = /var/lib/oval-server/dsa
+db = /var/lib/oval-server/oval-server.db
+
+[server]
+type = http
+ip = 127.0.0.1
+port = 8989
+workdir = /var/cache/oval-server/definitions
+
+[source]
+type = local
+name = "Local OVAL definitions source"
+source = /var/cache/oval-server/repos
+update_interval = 1
+
+#type = http
+#name = "OVAL http repository"
+#source = /~blaze/debian/dsa/
+#server = server
+#update_interval = 1
+
+#type = ftp
+#name = "OVAL ftp repository"
+#source = debian/dsa
+#server = server
+#update_interval = 1
+
Modified: trunk/oval-server/setup.py
===================================================================
--- trunk/oval-server/setup.py 2007-09-04 21:10:52 UTC (rev 247)
+++ trunk/oval-server/setup.py 2007-09-04 21:12:51 UTC (rev 248)
@@ -24,7 +24,7 @@
url = "http://oval.alioth.debian.org",
license = "GPL",
- packages = ["oval.dba", "oval.dsa2oval", "oval.dsa2oval.definition", "oval.dsa2oval.parser", "oval.dsaSync", "oval.server" ],
+ packages = ["oval.dba", "oval.dsa2oval", "oval.dsa2oval.definition", "oval.dsa2oval.parser", "oval.dsaSync", "oval.server", "oval" ],
- scripts = ["oval-server.py", "dsa2oval.py"]
+ scripts = ["oval-server.py", "dsa2oval.py", "oval-monitor.py"]
)
More information about the Oval-commits
mailing list