Commit 86012ec2 authored by Hrvoje Ribicic's avatar Hrvoje Ribicic

Disable protections against unknown compression types

Ganeti took care to restrict all possible compression invocations to
the few options that were available. This patch strips away all of
those, but does not allow any interesting and dangerous commands
provided to the import-export daemon to be executed yet.
Signed-off-by: default avatarHrvoje Ribicic <riba@google.com>
Reviewed-by: default avatarThomas Thrainer <thomasth@google.com>
parent 8677c3a9
......@@ -384,9 +384,8 @@ def ParseOptions():
type="int", default=DEFAULT_CONNECT_TIMEOUT,
help="Timeout for connection to be established (seconds)")
parser.add_option("--compress", dest="compress", action="store",
type="choice", help="Compression method",
metavar="[%s]" % "|".join(constants.IEC_ALL),
choices=list(constants.IEC_ALL), default=constants.IEC_GZIP)
type="string", help="Compression method",
default=constants.IEC_GZIP)
parser.add_option("--expected-size", dest="exp_size", action="store",
type="string", default=None,
help="Expected import/export size (MiB)")
......
......@@ -1421,13 +1421,12 @@ TIMEOUT_OPT = cli_option("--timeout", dest="timeout", type="int",
help="Maximum time to wait")
COMPRESS_OPT = cli_option("--compress", dest="compress",
default=constants.IEC_NONE,
help="The compression mode to use",
choices=list(constants.IEC_ALL))
type="string", default=constants.IEC_NONE,
help="The compression mode to use")
TRANSPORT_COMPRESSION_OPT = \
cli_option("--transport-compression", dest="transport_compression",
default=constants.IEC_NONE, choices=list(constants.IEC_ALL),
type="string", default=constants.IEC_NONE,
help="The compression mode to use during transport")
SHUTDOWN_TIMEOUT_OPT = cli_option("--shutdown-timeout",
......
......@@ -557,7 +557,6 @@ TDiskTemplate = TElemOf(constants.DISK_TEMPLATES)
TEvacMode = TElemOf(constants.NODE_EVAC_MODES)
TIAllocatorTestDir = TElemOf(constants.VALID_IALLOCATOR_DIRECTIONS)
TIAllocatorMode = TElemOf(constants.VALID_IALLOCATOR_MODES)
TImportExportCompression = TElemOf(constants.IEC_ALL)
def TSetParamsMods(fn):
......
......@@ -291,8 +291,6 @@ class CommandBuilder(object):
compr = self._opts.compress
assert compr in constants.IEC_ALL
parts = []
if self._mode == constants.IEM_IMPORT:
......
......@@ -1349,14 +1349,14 @@ pMoveTargetNodeUuid =
pMoveCompress :: Field
pMoveCompress =
withDoc "Compression mode to use during instance moves" .
defaultField [| None |] $
simpleField "compress" [t| ImportExportCompression |]
defaultField [| C.iecNone |] $
simpleField "compress" [t| String |]
pBackupCompress :: Field
pBackupCompress =
withDoc "Compression mode to use for moves during backups/imports" .
defaultField [| None |] $
simpleField "compress" [t| ImportExportCompression |]
defaultField [| C.iecNone |] $
simpleField "compress" [t| String |]
pIgnoreDiskSize :: Field
pIgnoreDiskSize =
......
......@@ -154,8 +154,6 @@ module Ganeti.Types
, RpcTimeout(..)
, rpcTimeoutFromRaw -- FIXME: no used anywhere
, rpcTimeoutToRaw
, ImportExportCompression(..)
, importExportCompressionToRaw
, HotplugTarget(..)
, hotplugTargetToRaw
, HotplugAction(..)
......@@ -873,23 +871,6 @@ $(THH.declareILADT "RpcTimeout"
, ("OneDay", 86400) -- 1 day
])
$(THH.declareLADT ''String "ImportExportCompression"
[ -- No compression
("None", "none")
-- gzip compression
, ("GZip", "gzip")
-- fast gzip compression
, ("GZipFast", "gzip-fast")
-- slow gzip compression
, ("GZipSlow", "gzip-slow")
-- lzop compression
, ("LZop", "lzop")
])
$(THH.makeJSONInstance ''ImportExportCompression)
instance THH.PyValue ImportExportCompression where
showValue = THH.showValue . importExportCompressionToRaw
-- | Hotplug action.
$(THH.declareLADT ''String "HotplugAction"
......
......@@ -80,8 +80,6 @@ $(genArbitrary ''OpCodes.ReplaceDisksMode)
$(genArbitrary ''DiskAccess)
$(genArbitrary ''ImportExportCompression)
instance Arbitrary OpCodes.DiskIndex where
arbitrary = choose (0, C.maxDisks - 1) >>= OpCodes.mkDiskIndex
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment