
Hello community, here is the log from the commit of package apport checked in at Fri Nov 28 16:20:12 CET 2008. -------- --- apport/apport.changes 2008-11-14 15:37:20.000000000 +0100 +++ apport/apport.changes 2008-11-28 13:39:51.000000000 +0100 @@ -1,0 +2,15 @@ +Fri Nov 28 13:32:50 CET 2008 - jblunck@suse.de + +- Add self signed crashdb.opensuse.org certificate for year 2009 +- Change the URLs for the official release with openSUSE 11.1 +- Raise HTTPError exception when the report has an X-Apport-Error header + +------------------------------------------------------------------- +Fri Nov 28 09:45:25 CET 2008 - jblunck@suse.de + +- Adapt unit tests to the new crashdb server +- Use M2Crypto library instead of OpenSSL since that actually works +- Changes necessary for the openSUSE crashdb server +- Extend the unit tests + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- apport-0.114-rev1184.tar.bz2 CA.cert New: ---- apport-0.114-rev1188.tar.bz2 crashdb-2009.crt ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ apport.spec ++++++ --- /var/tmp/diff_new_pack.XXl676/_old 2008-11-28 16:19:54.000000000 +0100 +++ /var/tmp/diff_new_pack.XXl676/_new 2008-11-28 16:19:54.000000000 +0100 @@ -18,12 +18,12 @@ # norootforbuild -%define revno -rev1184 +%define revno -rev1188 Name: apport Summary: Automatic crash handler Version: 0.114 -Release: 6 +Release: 7 License: GPL v2 or later Url: https://launchpad.net/apport BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -36,7 +36,7 @@ Source0: %{name}-%{version}%{revno}.tar.bz2 Source1: rc.apport Source2: crashdb.conf -Source3: CA.cert +Source3: crashdb-2009.crt Group: System/Monitoring %description @@ -153,7 +153,7 @@ %__install -m755 debian/apport.cron.daily %{buildroot}/etc/cron.daily/apport # openSUSE crashdb files %__install -m755 %SOURCE2 %{buildroot}/etc/apport/crashdb.conf -%__install -m755 %SOURCE3 %{buildroot}/usr/share/apport/CA.cert +%__install -m755 %SOURCE3 %{buildroot}/etc/apport/crashdb.crt # rm unneeded files %__rm -f %{buildroot}/usr/share/apport/general-hooks/automatix.py %__rm -rf %{buildroot}/usr/share/apport/testsuite/ @@ -213,7 +213,7 @@ %files crashdb-opensuse %defattr(-,root,root) %config /etc/apport/crashdb.conf -%config /usr/share/apport/CA.cert +%config /etc/apport/crashdb.crt %doc doc/crashdb-conf.txt %dir %py_sitedir/apport/crashdb_impl %py_sitedir/apport/crashdb_impl/* @@ -229,6 +229,15 @@ /usr/share/apport/*.ui %changelog +* Fri Nov 28 2008 jblunck@suse.de +- Add self signed crashdb.opensuse.org certificate for year 2009 +- Change the URLs for the official release with openSUSE 11.1 +- Raise HTTPError exception when the report has an X-Apport-Error header +* Fri Nov 28 2008 jblunck@suse.de +- Adapt unit tests to the new crashdb server +- Use M2Crypto library instead of OpenSSL since that actually works +- Changes necessary for the openSUSE crashdb server +- Extend the unit tests * Fri Nov 14 2008 jblunck@suse.de - Fix support for proper signature checking - Fix get_available_version() to really return the latest available package ++++++ apport-0.114-rev1184.tar.bz2 -> apport-0.114-rev1188.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/apport-0.114/apport/crashdb_impl/HTTPSValidateCertificateConnection.py new/apport-0.114/apport/crashdb_impl/HTTPSValidateCertificateConnection.py --- old/apport-0.114/apport/crashdb_impl/HTTPSValidateCertificateConnection.py 2008-11-14 15:35:34.000000000 +0100 +++ new/apport-0.114/apport/crashdb_impl/HTTPSValidateCertificateConnection.py 2008-11-28 13:37:03.000000000 +0100 @@ -17,7 +17,7 @@ ''' import urllib2, httplib, socket -import OpenSSL +from M2Crypto import SSL import os class HTTPSValidateCertificateConnection(httplib.HTTPConnection): @@ -26,34 +26,24 @@ default_port = httplib.HTTPS_PORT cert_location = '/etc/ssl/certs/' - def __init__(self, host, port=None): - httplib.HTTPConnection.__init__(self, host, port) - - def _verify(self, conn, cert, errnum, depth, ok): - # This obviously has to be updated -# print '_verify (ok=%d, state=%s):' % ( ok, conn.state_string() ) -# print 'Got certificate: %s' % cert.get_subject() -# print 'Issued by: %s' % cert.get_issuer() - -# peer_cert = conn.get_peer_certificate() -# if peer_cert != None: -# print 'Peer (%s) certificate: %s' % (conn.getpeername(), peer_cert.get_issuer()) -# print ' errnum %s, errdepth %d' % (errnum, depth) - return ok + def __init__(self, host, port=None, strict=None, + timeout=socket._GLOBAL_DEFAULT_TIMEOUT): + httplib.HTTPConnection.__init__(self, host, port, strict, timeout) def connect(self): "Connect to a host on a given (SSL) port." - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.connect((self.host, self.port)) - ctx = OpenSSL.SSL.Context(OpenSSL.SSL.SSLv23_METHOD) - # Demand a certificate - ctx.set_verify(OpenSSL.SSL.VERIFY_PEER, self._verify) - ctx.set_verify_depth(10) + # Setup SSL context to demand a certificate + ctx = SSL.Context('sslv23') + ctx.set_verify(SSL.verify_peer | SSL.verify_fail_if_no_peer_cert, 10) ctx.load_verify_locations(HTTPSValidateCertificateConnection.cert_location) - ssl = OpenSSL.SSL.Connection(ctx, sock) - ssl.connect_ex((self.host, self.port)) - self.sock = httplib.FakeSocket(sock, ssl) + + # Create real socket + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + ssl = SSL.Connection(ctx, sock) + self.sock = ssl + self.sock.connect((self.host, self.port)) + self.connected = True def set_cert_location(cls, value): cls.cert_location = value @@ -70,11 +60,11 @@ class __HTTPSValidateCertificateConnectionTest(unittest.TestCase): def test_connect(self): - HTTPSValidateCertificateConnection.set_cert_location('CA.cert') + HTTPSValidateCertificateConnection.set_cert_location('/usr/share/apport/CA.cert') opener = urllib2.build_opener(HTTPSValidateCertificateHandler) try: answer = opener.open('https://imap.suse.de').read() - except OpenSSL.SSL.Error: + except SSL.Error: self.fail() unittest.main() diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/apport-0.114/apport/crashdb_impl/opensuse_crashdb.py new/apport-0.114/apport/crashdb_impl/opensuse_crashdb.py --- old/apport-0.114/apport/crashdb_impl/opensuse_crashdb.py 2008-11-14 15:35:34.000000000 +0100 +++ new/apport-0.114/apport/crashdb_impl/opensuse_crashdb.py 2008-11-28 13:37:03.000000000 +0100 @@ -31,6 +31,7 @@ self.report_baseurl = options.get('report_baseurl') self.comment_baseurl = options.get('comment_baseurl') + self.comment_rawurl = options.get('comment_rawurl') if not self.report_baseurl: raise RuntimeError, "No report_baseurl defined" @@ -54,7 +55,13 @@ tmp.seek(0) result = opener.open(self.report_baseurl, - { 'FORM_SUBMIT': '1', 'data': tmp }) + { 'FORM_SUBMIT': '1', 'report': tmp }) + + if result.info().has_key('X-Apport-Error'): + raise urllib2.HTTPError(result.geturl(), 400, + result.info().get('X-Apport-Error'), + result.headers, result.fp) + uuid = result.info().get('X-Apport-Report-UUID') assert uuid return uuid @@ -75,11 +82,17 @@ def download(self, id): '''Download the problem report from given ID and return a Report.''' - url = self.comment_baseurl % ( id ) + url = self.comment_rawurl % ( id ) cookies = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookies), HTTPSValidateCertificateHandler) - result = opener.open(url) + try: + result = opener.open(url) + except urllib2.HTTPError: + return None + except urllib2.URLError: + return None + encoding = result.headers.get('Content-Encoding') tmp = tempfile.TemporaryFile() while 1: @@ -183,18 +196,144 @@ if __name__=="__main__": import unittest + from cStringIO import StringIO class _OpensuseCrashDBTest(unittest.TestCase): def setUp(self): - self.crashes = CrashDatabase(None, None, - { 'cert_location': - 'CA.cert', - 'comment_baseurl': - 'http://bolzano.suse.de/breakpad/%s' - }) + if True: + self.crashes = CrashDatabase(None, None, + { 'cert_location': + '/etc/apport/crashdb.crt', + 'report_baseurl': + 'https://crashdb.opensuse.org:80/log/new', + 'comment_baseurl': + 'https://crashdb.opensuse.org:80/log/show/%s', + 'comment_rawurl': + 'https://crashdb.opensuse.org:80/log/raw/%s', + }) + else: + # For testing with a local server installation + self.crashes = CrashDatabase(None, None, + { 'cert_location': + 'crashdb.crt', + 'report_baseurl': + 'http://localhost:3000/log/new', + 'comment_baseurl': + 'http://localhost:3000/log/show/%s', + 'comment_rawurl': + 'http://localhost:3000/log/raw/%s', + }) def test_download(self): - report = self.crashes.download('2e35da3a-d6d9-4994-1bcb-c241cba3ab4b') - self.assertEqual(report['Date'], 'Wed Aug 20 10:48:06 2008') + report = self.crashes.download('00000000000000000000000000000000') + self.assert_(report != None, "Couldn't download test report") + self.assertEqual(report['Date'], 'Mon Oct 20 09:55:27 2008') + + def _md5sum(self, report): + try: + import hashlib + m = hashlib.md5() + except ImportError: + # for Python << 2.5 + import md5 + m = md5.new() + + io = StringIO() + report.write(io) + io.seek(0) + + while True: + d = io.read(8096) + if not d: + break + m.update(d) + + return m.hexdigest() + + def test_upload_bugreport(self): + + report = apport.Report() + + report['ProblemType'] = 'Bug' + report['Architecture'] = 'i386' + report['Date'] = 'Thu Jan 1 01:00:00 CET 1970' + report['Uname'] = 'Linux 0.1-1-default i386' + report['ExecutablePath'] = '/bin/cat' + report['ProcEnviron'] = 'PATH=/bin' + report['ProcCmdline'] = '/bin/cat' + report['ProcStatus'] = '''Name: cat +State: R (running)''' + report['ProcMaps'] = '''00400000-0040a000 r-xp 00000000 fd:01 524521 /bin/cat''' + report['Package'] = 'coreutils' + report['Dependencies'] = 'rpmlib(VersionedDependencies) <= 3.0.3-1' + + report['Ignore'] = 'True' + + try: + uuid = self.crashes.upload(report) + except urllib2.HTTPError, e: + print "There was an http error: %s" % e + print e.info() + + self.assertEqual(uuid, self._md5sum(report)) + + def test_upload_crashreport(self): + + report = apport.Report() + try: + report.load(open('/suse/jblunck/Work/apport/reports/_usr_lib_gvfs_gvfsd-trash.16484.crash.processed')) + except IOError: + self.fail('Couldn\'t find test report') + report['Ignore'] = 'True' + + try: + uuid = self.crashes.upload(report) + except urllib2.HTTPError, e: + print "There was an http error: %s" % e + print e.info() + + self.assertEqual(uuid, self._md5sum(report)) + + def test_upload_emptyreport(self): + + report = apport.Report() + + try: + uuid = self.crashes.upload(report) + except urllib2.HTTPError, e: + self.assert_(e.info().has_key('X-Apport-Error')) + self.assertEqual(e.code, 400) + return + else: + self.fail('Expected a HTTPError') + + def test_upload_emptyignorereport(self): + + report = apport.Report() + report['Ignore'] = 'True' + + try: + uuid = self.crashes.upload(report) + except urllib2.HTTPError, e: + self.assert_(e.info().has_key('X-Apport-Error')) + self.assertEqual(e.code, 400) + return + else: + self.fail('Expected a HTTPError') + + def test_upload_invalidreport(self): + + report = apport.Report() + report['Foo'] = 'Bar' + report['Ignore'] = 'True' + + try: + uuid = self.crashes.upload(report) + except urllib2.HTTPError, e: + self.assert_(e.info().has_key('X-Apport-Error')) + self.assertEqual(e.code, 400) + return + else: + self.fail('Expected a HTTPError') unittest.main() ++++++ crashdb-2009.crt ++++++ -----BEGIN CERTIFICATE----- MIID4DCCA0mgAwIBAgIJAN4dfoqCbt0uMA0GCSqGSIb3DQEBBQUAMIGnMQswCQYD VQQGEwJERTEPMA0GA1UECBMGQmF5ZXJuMRIwEAYDVQQHFAlOw7xybmJlcmcxITAf BgNVBAoTGFNVU0UgTGludXggUHJvZHVjdHMgR21iSDERMA8GA1UECxMIb3BlblNV U0UxHTAbBgNVBAMTFGNyYXNoZGIub3BlbnN1c2Uub3JnMR4wHAYJKoZIhvcNAQkB Fg9qYmx1bmNrQHN1c2UuZGUwHhcNMDgxMTI4MTIyMTUwWhcNMDkxMjMxMTIyMTUw WjCBpzELMAkGA1UEBhMCREUxDzANBgNVBAgTBkJheWVybjESMBAGA1UEBxQJTsO8 cm5iZXJnMSEwHwYDVQQKExhTVVNFIExpbnV4IFByb2R1Y3RzIEdtYkgxETAPBgNV BAsTCG9wZW5TVVNFMR0wGwYDVQQDExRjcmFzaGRiLm9wZW5zdXNlLm9yZzEeMBwG CSqGSIb3DQEJARYPamJsdW5ja0BzdXNlLmRlMIGfMA0GCSqGSIb3DQEBAQUAA4GN ADCBiQKBgQDSCSmsLlMelmYbmGqbNdv8P+DZ5Ae7GnweyDntymPvcw67eSssQHKS 4nELd5ieCKvFYy1sQWXaV3IAgUnhRLXNhGNixY6jS53wuAeroN9X3ACDMye8WVjl QzqQY67HMzQoZtLoJQwUvkgKazI4uoOYQxcUaPLbXh4VijY6IiybiwIDAQABo4IB EDCCAQwwHQYDVR0OBBYEFMYb3Hy8J8zTN55hX8uWyDVq9A9NMIHcBgNVHSMEgdQw gdGAFMYb3Hy8J8zTN55hX8uWyDVq9A9NoYGtpIGqMIGnMQswCQYDVQQGEwJERTEP MA0GA1UECBMGQmF5ZXJuMRIwEAYDVQQHFAlOw7xybmJlcmcxITAfBgNVBAoTGFNV U0UgTGludXggUHJvZHVjdHMgR21iSDERMA8GA1UECxMIb3BlblNVU0UxHTAbBgNV BAMTFGNyYXNoZGIub3BlbnN1c2Uub3JnMR4wHAYJKoZIhvcNAQkBFg9qYmx1bmNr QHN1c2UuZGWCCQDeHX6Kgm7dLjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUA A4GBAGK3v26pW6C1K3cJJjuLHS09uCGBFLd+5mLk4sGDNBzOgMGC/69LYu5gIWc/ fWWlfnVauWmsuGDOXuHav7eWmeSP8uEFtKds8JDHMdQ6SJ4mkhYRYgqLov5ARllj pDI5/Xr7JNl/fz1U8WaS5dvAQ0+/VGTCGHo9rbh9vRs4S+bZ -----END CERTIFICATE----- ++++++ crashdb.conf ++++++ --- /var/tmp/diff_new_pack.XXl676/_old 2008-11-28 16:19:54.000000000 +0100 +++ /var/tmp/diff_new_pack.XXl676/_new 2008-11-28 16:19:54.000000000 +0100 @@ -6,9 +6,10 @@ 'opensuse': { 'impl': 'opensuse_crashdb', 'bug_pattern_base': None, - 'report_baseurl': 'http://bolzano.suse.de/breakpad/target.php', - 'comment_baseurl': 'http://bolzano.suse.de/breakpad/%s', - 'cert_location': '/usr/share/apport/CA.cert', + 'report_baseurl': 'https://crashdb.opensuse.org:80/log/new', + 'comment_baseurl': 'https://crashdb.opensuse.org:80/log/show/%s', + 'comment_rawurl': 'https://crashdb.opensuse.org:80/log/raw/%s', + 'cert_location': '/etc/apport/crashdb.crt', 'distro': 'opensuse' }, 'debug': { ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@Hilbert.suse.de