summaryrefslogtreecommitdiff
path: root/cmd/podman/main_remote.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-09-16 10:48:34 -0500
committerbaude <bbaude@redhat.com>2019-09-17 13:42:02 -0500
commit0d9b952aeab95c59b28bcea42f719d06363b45b5 (patch)
treefd3e5357f6051da6a6d1410bf34dc37836612d02 /cmd/podman/main_remote.go
parent143caa98bf07eef1a4d46da2cc56603a3ef739b8 (diff)
downloadpodman-0d9b952aeab95c59b28bcea42f719d06363b45b5.tar.gz
podman-0d9b952aeab95c59b28bcea42f719d06363b45b5.tar.bz2
podman-0d9b952aeab95c59b28bcea42f719d06363b45b5.zip
support non-standard ssh port for remote-client
when using the remote client, users may need to specify a non-standard port for ssh connections. we can do so on the command line and within the remote-client configuration file. Fixes: #3987 Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman/main_remote.go')
-rw-r--r--cmd/podman/main_remote.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/cmd/podman/main_remote.go b/cmd/podman/main_remote.go
index a005e925c..f617422e6 100644
--- a/cmd/podman/main_remote.go
+++ b/cmd/podman/main_remote.go
@@ -3,6 +3,7 @@
package main
import (
+ "github.com/pkg/errors"
"os/user"
"github.com/spf13/cobra"
@@ -18,6 +19,7 @@ func init() {
rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.ConnectionName, "connection", "", "remote connection name")
rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.RemoteConfigFilePath, "remote-config-path", "", "alternate path for configuration file")
rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.RemoteUserName, "username", username, "username on the remote host")
+ rootCmd.PersistentFlags().IntVar(&MainGlobalOpts.Port, "port", 22, "port on remote host")
rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.RemoteHost, "remote-host", "", "remote host")
// TODO maybe we allow the altering of this for bridge connections?
// rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.VarlinkAddress, "varlink-address", adapter.DefaultAddress, "address of the varlink socket")
@@ -42,3 +44,11 @@ func setRLimits() error {
}
func setUMask() {}
+
+// checkInput can be used to verify any of the globalopt values
+func checkInput() error {
+ if MainGlobalOpts.Port < 0 || MainGlobalOpts.Port > 65536 {
+ return errors.Errorf("remote port must be between 0 and 65536")
+ }
+ return nil
+}