summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-08-23 13:44:19 -0400
committerGitHub <noreply@github.com>2021-08-23 13:44:19 -0400
commit6a3741598cc30216a1a8db7d2c917e19bc37002b (patch)
tree955957dfceb7ee0a7598cd122461960858109173 /cmd/podman
parent062900c264c8228ba660b73a938fcad3b8c28ab8 (diff)
parent319c85e89ee2ee565da12680cca041335296a0c0 (diff)
downloadpodman-6a3741598cc30216a1a8db7d2c917e19bc37002b.tar.gz
podman-6a3741598cc30216a1a8db7d2c917e19bc37002b.tar.bz2
podman-6a3741598cc30216a1a8db7d2c917e19bc37002b.zip
Merge pull request #11205 from Shivkumar13/shivkumar-tls-fix
Support for --tls-verify flag in podman-run & podman-create
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/common/create.go9
-rw-r--r--cmd/podman/common/create_opts.go1
-rw-r--r--cmd/podman/containers/create.go4
3 files changed, 13 insertions, 1 deletions
diff --git a/cmd/podman/common/create.go b/cmd/podman/common/create.go
index 602ad5d94..401cf2e09 100644
--- a/cmd/podman/common/create.go
+++ b/cmd/podman/common/create.go
@@ -544,6 +544,15 @@ func DefineCreateFlags(cmd *cobra.Command, cf *ContainerCLIOpts) {
)
_ = cmd.RegisterFlagCompletionFunc(podIDFileFlagName, completion.AutocompleteDefault)
+ // Flag for TLS verification, so that `run` and `create` commands can make use of it.
+ // Make sure to use `=` while using this flag i.e `--tls-verify=false/true`
+ tlsVerifyFlagName := "tls-verify"
+ createFlags.BoolVar(
+ &cf.TLSVerify,
+ tlsVerifyFlagName, true,
+ "Require HTTPS and verify certificates when contacting registries for pulling images",
+ )
+
createFlags.BoolVar(
&cf.Privileged,
"privileged", false,
diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go
index 0fdf3ce08..e046e5a19 100644
--- a/cmd/podman/common/create_opts.go
+++ b/cmd/podman/common/create_opts.go
@@ -112,6 +112,7 @@ type ContainerCLIOpts struct {
Sysctl []string
Systemd string
Timeout uint
+ TLSVerify bool
TmpFS []string
TTY bool
Timezone string
diff --git a/cmd/podman/containers/create.go b/cmd/podman/containers/create.go
index d16fa0865..7583a024e 100644
--- a/cmd/podman/containers/create.go
+++ b/cmd/podman/containers/create.go
@@ -10,6 +10,7 @@ import (
"github.com/containers/common/pkg/completion"
"github.com/containers/common/pkg/config"
"github.com/containers/image/v5/transports/alltransports"
+ "github.com/containers/image/v5/types"
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/utils"
@@ -261,7 +262,7 @@ func createInit(c *cobra.Command) error {
}
func pullImage(imageName string) (string, error) {
- pullPolicy, err := config.ValidatePullPolicy(cliVals.Pull)
+ pullPolicy, err := config.ParsePullPolicy(cliVals.Pull)
if err != nil {
return "", err
}
@@ -287,6 +288,7 @@ func pullImage(imageName string) (string, error) {
Variant: cliVals.Variant,
SignaturePolicy: cliVals.SignaturePolicy,
PullPolicy: pullPolicy,
+ SkipTLSVerify: types.NewOptionalBool(!cliVals.TLSVerify), // If Flag changed for TLS Verification
})
if pullErr != nil {
return "", pullErr