diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2020-10-05 16:33:09 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2020-10-05 17:51:45 -0400 |
commit | 348f2df0c09e2e3b517add5271e6eee583800be3 (patch) | |
tree | eac3576a5ea40c71de7a8390fbd772a369219d8b /cmd/podman/common/specgen.go | |
parent | 1b16fcfd14b9e761849e53ac2b83c964ad8ac5a9 (diff) | |
download | podman-348f2df0c09e2e3b517add5271e6eee583800be3.tar.gz podman-348f2df0c09e2e3b517add5271e6eee583800be3.tar.bz2 podman-348f2df0c09e2e3b517add5271e6eee583800be3.zip |
Support max_size logoptions
Docker supports log-opt max_size and so does conmon (ALthough poorly).
Adding support for this allows users to at least make sure their containers
logs do not become a DOS vector.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd/podman/common/specgen.go')
-rw-r--r-- | cmd/podman/common/specgen.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/cmd/podman/common/specgen.go b/cmd/podman/common/specgen.go index 84ae70b6a..f427830c6 100644 --- a/cmd/podman/common/specgen.go +++ b/cmd/podman/common/specgen.go @@ -575,11 +575,17 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string if len(split) < 2 { return errors.Errorf("invalid log option %q", o) } - switch { - case split[0] == "driver": + switch strings.ToLower(split[0]) { + case "driver": s.LogConfiguration.Driver = split[1] - case split[0] == "path": + case "path": s.LogConfiguration.Path = split[1] + case "max-size": + logSize, err := units.FromHumanSize(split[1]) + if err != nil { + return errors.Wrapf(err, "%s is not a valid option", o) + } + s.LogConfiguration.Size = logSize default: logOpts[split[0]] = split[1] } |