[CRIU] [PATCH 3/4] p.haul: add --ssh-port and --ssh-fwd-port cmdline options

Ruslan Kuprieiev kupruser at gmail.com
Mon Oct 13 03:12:46 PDT 2014


ssh-port is a ssh -p equivalent, and ssh-fwd-port is a port that is to be used
to tunnel p.haul traffic. It is just useful to be able to set such ports.

Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
---
 p.haul | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/p.haul b/p.haul
index dfda984..97b7e14 100755
--- a/p.haul
+++ b/p.haul
@@ -45,6 +45,8 @@ parser.add_argument("--force", help = "Don't do any sanity (CPU compat) checks",
 parser.add_argument("--ssh", help = "Use ssh tunnel to encrypt data", action = "store_true", default = False)
 parser.add_argument("--ssh-user", help = "Remote username", default = None)
 parser.add_argument("--ssh-compression", help = "Use compression in the tunnel", action = "store_true", default = False)
+parser.add_argument("--ssh-port", help = "SSH port to connect to on the remote host (just like -p in ssh)")
+parser.add_argument("--ssh-fwd-port", help = "Port to forward through the tunnel", type = int, default = default_ssh_forward_port)
 
 args = vars(parser.parse_args())
 
@@ -54,13 +56,17 @@ dst = parse_dest(args.pop("to"))
 use_ssh = args.pop("ssh")
 ssh_user = args.pop("ssh_user")
 use_compression = args.pop("ssh_compression")
+ssh_port = args.pop("ssh_port")
+ssh_fwd_port = args.pop("ssh_fwd_port")
 ssh_cmd = ""
 
 if use_ssh:
 	ssh_cmd = "ssh -f -N "
 	if use_compression:
 		ssh_cmd += "-C "
-	ssh_cmd += "-L " + str(default_ssh_forward_port) + ":localhost:" + str(dst[1]) + " "
+	if ssh_port:
+		ssh_cmd += "-p " + str(ssh_port) + " "
+	ssh_cmd += "-L " + str(ssh_fwd_port) + ":localhost:" + str(dst[1]) + " "
 	if ssh_user:
 		ssh_cmd += ssh_user + "@"
 	ssh_cmd += dst[0]
-- 
1.9.3



More information about the CRIU mailing list