summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb@openbsd.org <tb@openbsd.org>2019-01-21 22:50:42 +0000
committerDamien Miller <djm@mindrot.org>2019-01-22 22:42:01 +1100
commit622dedf1a884f2927a9121e672bd9955e12ba108 (patch)
treede34eb30dd40556cf73ed5e6e6ef3b8c945436b0
parentc882d74652800150d538e22c80dd2bd3cdd5fae2 (diff)
upstream: Add a -J option as a shortcut for -o Proxyjump= to scp(1)
and sftp(1) to match ssh(1)'s interface. ok djm OpenBSD-Commit-ID: a75bc2d5f329caa7229a7e9fe346c4f41c2663fc
-rw-r--r--scp.117
-rw-r--r--scp.c8
-rw-r--r--sftp.118
-rw-r--r--sftp.c14
4 files changed, 43 insertions, 14 deletions
diff --git a/scp.1 b/scp.1
index 0e5cc1b2d..9fb6c23cb 100644
--- a/scp.1
+++ b/scp.1
@@ -8,9 +8,9 @@
8.\" 8.\"
9.\" Created: Sun May 7 00:14:37 1995 ylo 9.\" Created: Sun May 7 00:14:37 1995 ylo
10.\" 10.\"
11.\" $OpenBSD: scp.1,v 1.81 2018/09/20 06:58:48 jmc Exp $ 11.\" $OpenBSD: scp.1,v 1.82 2019/01/21 22:50:42 tb Exp $
12.\" 12.\"
13.Dd $Mdocdate: September 20 2018 $ 13.Dd $Mdocdate: January 21 2019 $
14.Dt SCP 1 14.Dt SCP 1
15.Os 15.Os
16.Sh NAME 16.Sh NAME
@@ -106,6 +106,19 @@ Selects the file from which the identity (private key) for public key
106authentication is read. 106authentication is read.
107This option is directly passed to 107This option is directly passed to
108.Xr ssh 1 . 108.Xr ssh 1 .
109.It Fl J Ar destination
110Connect to the target host by first making a
111.Nm
112connection to the jump host described by
113.Ar destination
114and then establishing a TCP forwarding to the ultimate destination from
115there.
116Multiple jump hops may be specified separated by comma characters.
117This is a shortcut to specify a
118.Cm ProxyJump
119configuration directive.
120This option is directly passed to
121.Xr ssh 1 .
109.It Fl l Ar limit 122.It Fl l Ar limit
110Limits the used bandwidth, specified in Kbit/s. 123Limits the used bandwidth, specified in Kbit/s.
111.It Fl o Ar ssh_option 124.It Fl o Ar ssh_option
diff --git a/scp.c b/scp.c
index eb17c3416..ae51137ee 100644
--- a/scp.c
+++ b/scp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: scp.c,v 1.198 2018/11/16 03:03:10 djm Exp $ */ 1/* $OpenBSD: scp.c,v 1.199 2019/01/21 22:50:42 tb Exp $ */
2/* 2/*
3 * scp - secure remote copy. This is basically patched BSD rcp which 3 * scp - secure remote copy. This is basically patched BSD rcp which
4 * uses ssh to do the data transfer (instead of using rcmd). 4 * uses ssh to do the data transfer (instead of using rcmd).
@@ -424,7 +424,7 @@ main(int argc, char **argv)
424 addargs(&args, "-oRequestTTY=no"); 424 addargs(&args, "-oRequestTTY=no");
425 425
426 fflag = tflag = 0; 426 fflag = tflag = 0;
427 while ((ch = getopt(argc, argv, "dfl:prtvBCc:i:P:q12346S:o:F:")) != -1) 427 while ((ch = getopt(argc, argv, "dfl:prtvBCc:i:P:q12346S:o:F:J:")) != -1)
428 switch (ch) { 428 switch (ch) {
429 /* User-visible flags. */ 429 /* User-visible flags. */
430 case '1': 430 case '1':
@@ -446,6 +446,7 @@ main(int argc, char **argv)
446 case 'c': 446 case 'c':
447 case 'i': 447 case 'i':
448 case 'F': 448 case 'F':
449 case 'J':
449 addargs(&remote_remote_args, "-%c", ch); 450 addargs(&remote_remote_args, "-%c", ch);
450 addargs(&remote_remote_args, "%s", optarg); 451 addargs(&remote_remote_args, "%s", optarg);
451 addargs(&args, "-%c", ch); 452 addargs(&args, "-%c", ch);
@@ -1319,7 +1320,8 @@ usage(void)
1319{ 1320{
1320 (void) fprintf(stderr, 1321 (void) fprintf(stderr,
1321 "usage: scp [-346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]\n" 1322 "usage: scp [-346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]\n"
1322 " [-l limit] [-o ssh_option] [-P port] [-S program] source ... target\n"); 1323 " [-J destination] [-l limit] [-o ssh_option] [-P port]\n"
1324 " [-S program] source ... target\n");
1323 exit(1); 1325 exit(1);
1324} 1326}
1325 1327
diff --git a/sftp.1 b/sftp.1
index 722a34419..ce12fc537 100644
--- a/sftp.1
+++ b/sftp.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: sftp.1,v 1.123 2019/01/16 23:23:45 djm Exp $ 1.\" $OpenBSD: sftp.1,v 1.124 2019/01/21 22:50:42 tb Exp $
2.\" 2.\"
3.\" Copyright (c) 2001 Damien Miller. All rights reserved. 3.\" Copyright (c) 2001 Damien Miller. All rights reserved.
4.\" 4.\"
@@ -22,7 +22,7 @@
22.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24.\" 24.\"
25.Dd $Mdocdate: January 16 2019 $ 25.Dd $Mdocdate: January 21 2019 $
26.Dt SFTP 1 26.Dt SFTP 1
27.Os 27.Os
28.Sh NAME 28.Sh NAME
@@ -37,6 +37,7 @@
37.Op Fl D Ar sftp_server_path 37.Op Fl D Ar sftp_server_path
38.Op Fl F Ar ssh_config 38.Op Fl F Ar ssh_config
39.Op Fl i Ar identity_file 39.Op Fl i Ar identity_file
40.Op Fl J Ar destination
40.Op Fl l Ar limit 41.Op Fl l Ar limit
41.Op Fl o Ar ssh_option 42.Op Fl o Ar ssh_option
42.Op Fl P Ar port 43.Op Fl P Ar port
@@ -181,6 +182,19 @@ Selects the file from which the identity (private key) for public key
181authentication is read. 182authentication is read.
182This option is directly passed to 183This option is directly passed to
183.Xr ssh 1 . 184.Xr ssh 1 .
185.It Fl J Ar destination
186Connect to the target host by first making a
187.Nm
188connection to the jump host described by
189.Ar destination
190and then establishing a TCP forwarding to the ultimate destination from
191there.
192Multiple jump hops may be specified separated by comma characters.
193This is a shortcut to specify a
194.Cm ProxyJump
195configuration directive.
196This option is directly passed to
197.Xr ssh 1 .
184.It Fl l Ar limit 198.It Fl l Ar limit
185Limits the used bandwidth, specified in Kbit/s. 199Limits the used bandwidth, specified in Kbit/s.
186.It Fl o Ar ssh_option 200.It Fl o Ar ssh_option
diff --git a/sftp.c b/sftp.c
index 0f3f89d33..44aa19d96 100644
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp.c,v 1.189 2019/01/16 23:23:45 djm Exp $ */ 1/* $OpenBSD: sftp.c,v 1.190 2019/01/21 22:50:42 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -2362,11 +2362,10 @@ usage(void)
2362 2362
2363 fprintf(stderr, 2363 fprintf(stderr,
2364 "usage: %s [-46aCfpqrv] [-B buffer_size] [-b batchfile] [-c cipher]\n" 2364 "usage: %s [-46aCfpqrv] [-B buffer_size] [-b batchfile] [-c cipher]\n"
2365 " [-D sftp_server_path] [-F ssh_config] " 2365 " [-D sftp_server_path] [-F ssh_config] [-i identity_file]\n"
2366 "[-i identity_file] [-l limit]\n" 2366 " [-J destination] [-l limit] [-o ssh_option] [-P port]\n"
2367 " [-o ssh_option] [-P port] [-R num_requests] " 2367 " [-R num_requests] [-S program] [-s subsystem | sftp_server]\n"
2368 "[-S program]\n" 2368 " destination\n",
2369 " [-s subsystem | sftp_server] destination\n",
2370 __progname); 2369 __progname);
2371 exit(1); 2370 exit(1);
2372} 2371}
@@ -2409,7 +2408,7 @@ main(int argc, char **argv)
2409 infile = stdin; 2408 infile = stdin;
2410 2409
2411 while ((ch = getopt(argc, argv, 2410 while ((ch = getopt(argc, argv,
2412 "1246afhpqrvCc:D:i:l:o:s:S:b:B:F:P:R:")) != -1) { 2411 "1246afhpqrvCc:D:i:l:o:s:S:b:B:F:J:P:R:")) != -1) {
2413 switch (ch) { 2412 switch (ch) {
2414 /* Passed through to ssh(1) */ 2413 /* Passed through to ssh(1) */
2415 case '4': 2414 case '4':
@@ -2419,6 +2418,7 @@ main(int argc, char **argv)
2419 break; 2418 break;
2420 /* Passed through to ssh(1) with argument */ 2419 /* Passed through to ssh(1) with argument */
2421 case 'F': 2420 case 'F':
2421 case 'J':
2422 case 'c': 2422 case 'c':
2423 case 'i': 2423 case 'i':
2424 case 'o': 2424 case 'o':