Holger Mikolon(hol...@mikolon.com) on 2017.11.25 23:16:54 +0100:
> Hi tech@
> 
> at work I can ssh (hence cvs) to public servers only via a ProxyCommand
> specified in /etc/ssh/ssh_config.
> 
> However, with the ProxyCommand set I cannot ssh into servers in the
> internal network. So I end up changing ssh_config depending on my
> use case over and over. This bothered me enough to come up with the
> following simple diff. It adds a command line option -j to ssh/sftp/scp
> for ignoring the ProxyCommand. Of course "-j" can be changed to any
> other free letter.
> 
> Anyone else finding this useful? Comments?

well, you could also just have two config files and use

  ssh -F $HOME/.ssh/config_with_proxy

and since thats too long to type

  alias sshp="ssh -F $HOME/.ssh/config_with_proxy"

imho not worth yet another option.

/Benno

 
> Regards
> Holger
> ;-se
> 
> 
> Index: usr.bin/ssh/scp.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/ssh/scp.c,v
> retrieving revision 1.193
> diff -u -p -u -r1.193 scp.c
> --- usr.bin/ssh/scp.c 21 Oct 2017 23:06:24 -0000      1.193
> +++ usr.bin/ssh/scp.c 25 Nov 2017 21:59:05 -0000
> @@ -400,7 +400,7 @@ main(int argc, char **argv)
>       addargs(&args, "-oClearAllForwardings=yes");
>  
>       fflag = tflag = 0;
> -     while ((ch = getopt(argc, argv, "dfl:prtvBCc:i:P:q12346S:o:F:")) != -1)
> +     while ((ch = getopt(argc, argv, "dfl:prtvBCc:i:jP:q12346S:o:F:")) != -1)
>               switch (ch) {
>               /* User-visible flags. */
>               case '1':
> @@ -426,6 +426,9 @@ main(int argc, char **argv)
>                       addargs(&remote_remote_args, "%s", optarg);
>                       addargs(&args, "-%c", ch);
>                       addargs(&args, "%s", optarg);
> +                     break;
> +             case 'j':
> +                     addargs(&args, "-j");
>                       break;
>               case 'P':
>                       sshport = a2port(optarg);
> Index: usr.bin/ssh/sftp.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/ssh/sftp.c,v
> retrieving revision 1.182
> diff -u -p -u -r1.182 sftp.c
> --- usr.bin/ssh/sftp.c        3 Nov 2017 03:46:52 -0000       1.182
> +++ usr.bin/ssh/sftp.c        25 Nov 2017 21:59:05 -0000
> @@ -2303,7 +2303,7 @@ main(int argc, char **argv)
>       infile = stdin;
>  
>       while ((ch = getopt(argc, argv,
> -         "1246afhpqrvCc:D:i:l:o:s:S:b:B:F:P:R:")) != -1) {
> +         "1246afhpqrvCc:D:i:jl:o:s:S:b:B:F:P:R:")) != -1) {
>               switch (ch) {
>               /* Passed through to ssh(1) */
>               case '4':
> @@ -2318,6 +2318,9 @@ main(int argc, char **argv)
>               case 'o':
>                       addargs(&args, "-%c", ch);
>                       addargs(&args, "%s", optarg);
> +                     break;
> +             case 'j':
> +                     addargs(&args, "-j");
>                       break;
>               case 'q':
>                       ll = SYSLOG_LEVEL_ERROR;
> Index: usr.bin/ssh/ssh.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/ssh/ssh.c,v
> retrieving revision 1.469
> diff -u -p -u -r1.469 ssh.c
> --- usr.bin/ssh/ssh.c 1 Nov 2017 00:04:15 -0000       1.469
> +++ usr.bin/ssh/ssh.c 25 Nov 2017 21:59:05 -0000
> @@ -583,7 +583,7 @@ main(int ac, char **av)
>       argv0 = av[0];
>  
>   again:
> -     while ((opt = getopt(ac, av, "1246ab:c:e:fgi:kl:m:no:p:qstvx"
> +     while ((opt = getopt(ac, av, "1246ab:c:e:fgi:jkl:m:no:p:qstvx"
>           "ACD:E:F:GI:J:KL:MNO:PQ:R:S:TVw:W:XYy")) != -1) {
>               switch (opt) {
>               case '1':
> @@ -626,6 +626,9 @@ main(int ac, char **av)
>                       break;
>               case 'g':
>                       options.fwd_opts.gateway_ports = 1;
> +                     break;
> +             case 'j':
> +                     options.proxy_command = xstrdup("none");
>                       break;
>               case 'O':
>                       if (options.stdio_forward_host != NULL)
> 

Reply via email to