summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Thode <prometheanfire@gentoo.org>2014-04-11 15:19:16 +0000
committerMatthew Thode <prometheanfire@gentoo.org>2014-04-11 15:19:16 +0000
commitc464f653ea23818d2380ee0a19cd4afce76491a4 (patch)
tree180808edc57ce9dc09a855ef88510a9361af0c78 /app-admin/glance
parentDescribe multiload-nandhp for XFCE_PLUGINS="" (diff)
downloadgentoo-2-c464f653ea23818d2380ee0a19cd4afce76491a4.tar.gz
gentoo-2-c464f653ea23818d2380ee0a19cd4afce76491a4.tar.bz2
gentoo-2-c464f653ea23818d2380ee0a19cd4afce76491a4.zip
fix for CVE-2014-0162
(Portage version: 2.2.8-r1/cvs/Linux x86_64, signed Manifest commit with key 0x2471eb3e40ac5ac3)
Diffstat (limited to 'app-admin/glance')
-rw-r--r--app-admin/glance/ChangeLog9
-rw-r--r--app-admin/glance/files/CVE-2014-0162-2013.2.3.patch223
-rw-r--r--app-admin/glance/glance-2013.2.3-r1.ebuild (renamed from app-admin/glance/glance-2013.2.3.ebuild)5
-rw-r--r--app-admin/glance/metadata.xml2
4 files changed, 236 insertions, 3 deletions
diff --git a/app-admin/glance/ChangeLog b/app-admin/glance/ChangeLog
index edf934980394..2e4384139999 100644
--- a/app-admin/glance/ChangeLog
+++ b/app-admin/glance/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for app-admin/glance
# Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-admin/glance/ChangeLog,v 1.37 2014/04/06 06:07:42 prometheanfire Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-admin/glance/ChangeLog,v 1.38 2014/04/11 15:19:16 prometheanfire Exp $
+
+*glance-2013.2.3-r1 (11 Apr 2014)
+
+ 11 Apr 2014; Matthew Thode <prometheanfire@gentoo.org>
+ +files/CVE-2014-0162-2013.2.3.patch, +glance-2013.2.3-r1.ebuild,
+ -glance-2013.2.3.ebuild, metadata.xml:
+ fix for CVE-2014-0162
*glance-2013.2.3 (06 Apr 2014)
diff --git a/app-admin/glance/files/CVE-2014-0162-2013.2.3.patch b/app-admin/glance/files/CVE-2014-0162-2013.2.3.patch
new file mode 100644
index 000000000000..782d54a37c4f
--- /dev/null
+++ b/app-admin/glance/files/CVE-2014-0162-2013.2.3.patch
@@ -0,0 +1,223 @@
+From 13069a4017d36a549576a21ca3ec5b15c411effc Mon Sep 17 00:00:00 2001
+From: Zhi Yan Liu <zhiyanl@cn.ibm.com>
+Date: Sat, 29 Mar 2014 03:35:35 +0800
+Subject: [PATCH] To prevent remote code injection on Sheepdog store
+
+Change-Id: Iae92eaf9eb023f36a1bab7c20ea41c985f2bf51b
+Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
+---
+ glance/store/sheepdog.py | 61 +++++++++++++++++-------------
+ glance/tests/unit/test_sheepdog_store.py | 3 +-
+ glance/tests/unit/test_store_location.py | 13 ++++---
+ 3 files changed, 45 insertions(+), 32 deletions(-)
+
+diff --git a/glance/store/sheepdog.py b/glance/store/sheepdog.py
+index d10aea7..2f75441 100644
+--- a/glance/store/sheepdog.py
++++ b/glance/store/sheepdog.py
+@@ -25,6 +25,7 @@ from glance.common import exception
+ from glance.openstack.common import excutils
+ import glance.openstack.common.log as logging
+ from glance.openstack.common import processutils
++from glance.openstack.common import uuidutils
+ import glance.store
+ import glance.store.base
+ import glance.store.location
+@@ -32,7 +33,7 @@ import glance.store.location
+
+ LOG = logging.getLogger(__name__)
+
+-DEFAULT_ADDR = 'localhost'
++DEFAULT_ADDR = '127.0.0.1'
+ DEFAULT_PORT = '7000'
+ DEFAULT_CHUNKSIZE = 64 # in MiB
+
+@@ -63,18 +64,14 @@ class SheepdogImage:
+ self.chunk_size = chunk_size
+
+ def _run_command(self, command, data, *params):
+- cmd = ("collie vdi %(command)s -a %(addr)s -p %(port)s %(name)s "
+- "%(params)s" %
+- {"command": command,
+- "addr": self.addr,
+- "port": self.port,
+- "name": self.name,
+- "params": " ".join(map(str, params))})
++ cmd = ["collie", "vdi"]
++ cmd.extend(command)
++ cmd.extend(["-a", self.addr, "-p", self.port, self.name])
++ cmd.extend(params)
+
+ try:
+- return processutils.execute(
+- cmd, process_input=data, shell=True)[0]
+- except processutils.ProcessExecutionError as exc:
++ return processutils.execute(*cmd, process_input=data)[0]
++ except (processutils.ProcessExecutionError, OSError) as exc:
+ LOG.error(exc)
+ raise glance.store.BackendException(exc)
+
+@@ -84,7 +81,7 @@ class SheepdogImage:
+
+ Sheepdog Usage: collie vdi list -r -a address -p port image
+ """
+- out = self._run_command("list -r", None)
++ out = self._run_command(["list", "-r"], None)
+ return long(out.split(' ')[3])
+
+ def read(self, offset, count):
+@@ -94,7 +91,7 @@ class SheepdogImage:
+
+ Sheepdog Usage: collie vdi read -a address -p port image offset len
+ """
+- return self._run_command("read", None, str(offset), str(count))
++ return self._run_command(["read"], None, str(offset), str(count))
+
+ def write(self, data, offset, count):
+ """
+@@ -103,7 +100,7 @@ class SheepdogImage:
+
+ Sheepdog Usage: collie vdi write -a address -p port image offset len
+ """
+- self._run_command("write", data, str(offset), str(count))
++ self._run_command(["write"], data, str(offset), str(count))
+
+ def create(self, size):
+ """
+@@ -111,7 +108,7 @@ class SheepdogImage:
+
+ Sheepdog Usage: collie vdi create -a address -p port image size
+ """
+- self._run_command("create", None, str(size))
++ self._run_command(["create"], None, str(size))
+
+ def delete(self):
+ """
+@@ -119,7 +116,7 @@ class SheepdogImage:
+
+ Sheepdog Usage: collie vdi delete -a address -p port image
+ """
+- self._run_command("delete", None)
++ self._run_command(["delete"], None)
+
+ def exist(self):
+ """
+@@ -127,7 +124,7 @@ class SheepdogImage:
+
+ Sheepdog Usage: collie vdi list -r -a address -p port image
+ """
+- out = self._run_command("list -r", None)
++ out = self._run_command(["list", "-r"], None)
+ if not out:
+ return False
+ else:
+@@ -138,7 +135,7 @@ class StoreLocation(glance.store.location.StoreLocation):
+ """
+ Class describing a Sheepdog URI. This is of the form:
+
+- sheepdog://image
++ sheepdog://image-id
+
+ """
+
+@@ -149,10 +146,14 @@ class StoreLocation(glance.store.location.StoreLocation):
+ return "sheepdog://%s" % self.image
+
+ def parse_uri(self, uri):
+- if not uri.startswith('sheepdog://'):
+- raise exception.BadStoreUri(uri, "URI must start with %s://" %
+- 'sheepdog')
+- self.image = uri[11:]
++ valid_schema = 'sheepdog://'
++ if not uri.startswith(valid_schema):
++ raise exception.BadStoreUri(_("URI must start with %s://") %
++ valid_schema)
++ self.image = uri[len(valid_schema):]
++ if not uuidutils.is_uuid_like(self.image):
++ raise exception.BadStoreUri(_("URI must contains well-formated "
++ "image id"))
+
+
+ class ImageIterator(object):
+@@ -192,7 +193,7 @@ class Store(glance.store.base.Store):
+
+ try:
+ self.chunk_size = CONF.sheepdog_store_chunk_size * 1024 * 1024
+- self.addr = CONF.sheepdog_store_address
++ self.addr = CONF.sheepdog_store_address.strip()
+ self.port = CONF.sheepdog_store_port
+ except cfg.ConfigFileValueError as e:
+ reason = _("Error in store configuration: %s") % e
+@@ -200,10 +201,18 @@ class Store(glance.store.base.Store):
+ raise exception.BadStoreConfiguration(store_name='sheepdog',
+ reason=reason)
+
++ if ' ' in self.addr:
++ reason = (_("Invalid address configuration of sheepdog store: %s")
++ % self.addr)
++ LOG.error(reason)
++ raise exception.BadStoreConfiguration(store_name='sheepdog',
++ reason=reason)
++
+ try:
+- processutils.execute("collie", shell=True)
+- except processutils.ProcessExecutionError as exc:
+- reason = _("Error in store configuration: %s") % exc
++ cmd = ["collie", "vdi", "list", "-a", self.addr, "-p", self.port]
++ processutils.execute(*cmd)
++ except Exception as e:
++ reason = _("Error in store configuration: %s") % e
+ LOG.error(reason)
+ raise exception.BadStoreConfiguration(store_name='sheepdog',
+ reason=reason)
+diff --git a/glance/tests/unit/test_sheepdog_store.py b/glance/tests/unit/test_sheepdog_store.py
+index 8eef86b..bea7e29 100644
+--- a/glance/tests/unit/test_sheepdog_store.py
++++ b/glance/tests/unit/test_sheepdog_store.py
+@@ -57,4 +57,5 @@ class TestStore(base.StoreClearingUnitTest):
+ 'fake_image_id',
+ utils.LimitingReader(StringIO.StringIO('xx'), 1),
+ 2)
+- self.assertEqual(called_commands, ['list -r', 'create', 'delete'])
++ self.assertEqual([['list', '-r'], ['create'], ['delete']],
++ called_commands)
+diff --git a/glance/tests/unit/test_store_location.py b/glance/tests/unit/test_store_location.py
+index 7eec171..2464ebb 100644
+--- a/glance/tests/unit/test_store_location.py
++++ b/glance/tests/unit/test_store_location.py
+@@ -52,7 +52,7 @@ class TestStoreLocation(base.StoreClearingUnitTest):
+ 'rbd://imagename',
+ 'rbd://fsid/pool/image/snap',
+ 'rbd://%2F/%2F/%2F/%2F',
+- 'sheepdog://imagename',
++ 'sheepdog://244e75f1-9c69-4167-9db7-1aa7d1973f6c',
+ 'cinder://12345678-9012-3455-6789-012345678901',
+ ]
+
+@@ -367,15 +367,18 @@ class TestStoreLocation(base.StoreClearingUnitTest):
+ """
+ Test the specific StoreLocation for the Sheepdog store
+ """
+- uri = 'sheepdog://imagename'
++ uri = 'sheepdog://244e75f1-9c69-4167-9db7-1aa7d1973f6c'
+ loc = glance.store.sheepdog.StoreLocation({})
+ loc.parse_uri(uri)
+- self.assertEqual('imagename', loc.image)
++ self.assertEqual('244e75f1-9c69-4167-9db7-1aa7d1973f6c', loc.image)
+
+- bad_uri = 'sheepdog:/image'
++ bad_uri = 'sheepdog:/244e75f1-9c69-4167-9db7-1aa7d1973f6c'
+ self.assertRaises(exception.BadStoreUri, loc.parse_uri, bad_uri)
+
+- bad_uri = 'http://image'
++ bad_uri = 'http://244e75f1-9c69-4167-9db7-1aa7d1973f6c'
++ self.assertRaises(exception.BadStoreUri, loc.parse_uri, bad_uri)
++
++ bad_uri = 'image; name'
+ self.assertRaises(exception.BadStoreUri, loc.parse_uri, bad_uri)
+
+ def test_cinder_store_good_location(self):
+--
+1.7.9.5
+
+
diff --git a/app-admin/glance/glance-2013.2.3.ebuild b/app-admin/glance/glance-2013.2.3-r1.ebuild
index 26a181e20931..4739209804a7 100644
--- a/app-admin/glance/glance-2013.2.3.ebuild
+++ b/app-admin/glance/glance-2013.2.3-r1.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-admin/glance/glance-2013.2.3.ebuild,v 1.1 2014/04/06 06:07:42 prometheanfire Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-admin/glance/glance-2013.2.3-r1.ebuild,v 1.1 2014/04/11 15:19:16 prometheanfire Exp $
EAPI=5
PYTHON_COMPAT=( python2_7 )
@@ -85,7 +85,8 @@ RDEPEND=">=dev-python/greenlet-0.3.2[${PYTHON_USEDEP}]
dev-python/pyopenssl[${PYTHON_USEDEP}]
>=dev-python/six-1.4.1[${PYTHON_USEDEP}]"
-PATCHES=( "${FILESDIR}/${PN}-2013.2-sphinx_mapping.patch" )
+PATCHES=( "${FILESDIR}/${PN}-2013.2-sphinx_mapping.patch"
+ "${FILESDIR}/CVE-2014-0162-2013.2.3.patch" )
pkg_setup() {
enewgroup glance
diff --git a/app-admin/glance/metadata.xml b/app-admin/glance/metadata.xml
index abed32058d85..d9757a109a9d 100644
--- a/app-admin/glance/metadata.xml
+++ b/app-admin/glance/metadata.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
+ <herd>openstack</herd>
<maintainer>
<email>prometheanfire@gentoo.org</email>
+ <name>Matthew Thode</name>
</maintainer>
<longdescription lang="en">
Provides services for discovering, registering, and retrieving virtual