Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSH agent forwarding patches re-merged as one patch. #696

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
dfa183d
SSH agent forwarding patches re-merged as one patch.
rinne Nov 28, 2015
a20cf61
Merge branch 'upstream-master' into agent-forwarding-merge-20151128
rinne Dec 17, 2015
6fd7489
Merge branch 'upstream-master' into agent-forwarding-merge-20151128
rinne Jan 16, 2016
0d8e7b1
Merge branch 'upstream-master' into agent-forwarding-merge-20151128.
rinne Jan 19, 2016
2247416
Merge branch 'upstream-master' into agent-forwarding-merge-20151128
rinne Feb 20, 2016
84bc2ef
adds an empty virtual destructor to OutOfBandPlugin
jkraemer Mar 21, 2016
9c7ed93
Merge branch 'upstream-master' into agent-forwarding-merge-20151128 a…
rinne Mar 31, 2016
55a4c24
Merge pull request #2 from jkraemer/agent-forwarding-merge-20151128-b…
rinne Mar 31, 2016
7cc103c
Merge branch 'upstream-master' into agent-forwarding-merge-20151128 a…
rinne May 24, 2016
b17fd49
Merge branch 'upstream-master' into agent-forwarding-merge-20151128
rinne Jun 7, 2016
a91bd99
Merge branch 'upstream-master' into agent-forwarding-merge-20151128
rinne Jul 30, 2016
a09c3ac
Merge branch 'upstream-master' into agent-forwarding-merge-20151128
rinne Aug 20, 2016
641091f
Merge branch 'upstream-master' into agent-forwarding-merge-20151128 a…
rinne Oct 13, 2016
fb8b10e
Merge branch 'upstream-master' into agent-forwarding-merge-20151128
rinne Nov 23, 2016
651a033
Fixed dragging OOB send buffer in case of idle conn.
rinne Nov 23, 2016
25b59ee
Merge branch 'upstream-master' into agent-forwarding-merge-20151128
rinne Dec 10, 2016
502da12
Merge branch 'upstream-master' into agent-forwarding-merge-20151128
rinne Jan 5, 2017
60e149a
Merge branch 'upstream-master' into agent-forwarding-merge-20151128
rinne Jan 8, 2017
0310486
Merge branch 'agent-forwarding-merge-20151128' into upstream-master
rinne Feb 16, 2017
bee41a8
Merge remote-tracking branch 'remotes/mobile-shell/master' into agent…
rinne Mar 3, 2017
9ebe3ed
Merge remote-tracking branch 'remotes/mobile-shell/master' into agent…
rinne Mar 12, 2017
ae7d70d
Merge branch 'master' into agent-forwarding-merge-20151128
rinne Mar 20, 2017
395893e
Merge branch 'master' into agent-forwarding-merge-20151128
rinne Mar 29, 2017
ad0a093
Merge branch 'master' into agent-forwarding-merge-20151128
rinne Apr 24, 2017
3325d82
Merge branch 'master' into agent-forwarding-merge-20151128
rinne Jul 24, 2017
47c9d7e
Merge branch 'master' into agent-forwarding-merge-20151128
rinne Aug 3, 2017
d805ec1
Merge branch 'master' into agent-forwarding-merge-20151128
rinne Aug 9, 2017
968f3cc
Merge branch 'master' into agent-forwarding-merge-20151128
rinne Aug 30, 2017
953a7f5
Merge branch 'master' into agent-forwarding-merge-20151128
rinne Oct 27, 2017
34b5f40
Merge branch 'master' into agent-forwarding-merge-20151128
rinne Mar 4, 2018
5fb068c
Merge branch 'master' into agent-forwarding-merge-20151128
rinne Aug 31, 2018
4179d4c
Merge incompatibility std::max fix.
rinne Aug 31, 2018
116e505
Merge branch 'master' into agent-forwarding-merge-20151128
rinne Apr 17, 2019
b065360
Merge branch 'upstream-master' into agent-forwarding-merge-20151128
rinne Oct 17, 2019
4a8a58d
Merge branch 'master' into agent-forwarding-merge-20151128
rinne Nov 8, 2020
6881716
Merge branch 'master' into agent-forwarding-merge-20151128
rinne Nov 24, 2021
b7eb061
Merge branch 'master' into agent-forwarding-merge-20151128
rinne Jan 5, 2022
a70c932
Merge branch 'upstream-master' into agent-forwarding-merge-20151128
rinne Feb 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ clean-local:
cppcheck:
cppcheck $(CPPCHECK_FLAGS) -include src/include/config.h -I src/include \
-I src/crypto -I src/frontend -I src/network -I src/protobufs \
-I src/statesync -I src/terminal -I src/util \
-I src/statesync -I src/terminal -I src/util -I src/agent \
-I /usr/include -I /usr/include/google/protobuf -I/usr/include/openssl \
src

Expand Down
17 changes: 17 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,13 @@ AC_ARG_ENABLE([completion],
[install_completion="no"])
AM_CONDITIONAL([INSTALL_COMPLETION], [test x"$install_completion" != xno])

# Handle --disable-agent-forwarding
AC_ARG_ENABLE(agent-forwarding,
AS_HELP_STRING([--disable-agent-forwarding],
[disable ssh agent forwarding in compile time]),
, enable_agent_forwarding=yes)

# Syslog
AC_ARG_ENABLE([syslog],
[AS_HELP_STRING([--enable-syslog], [Enable connection logging in mosh-server @<:@no@:>@])],
[enable_syslog="$enableval"],
Expand Down Expand Up @@ -221,6 +228,7 @@ AC_SEARCH_LIBS([clock_gettime], [rt])

# Checks for header files.
AC_CHECK_HEADERS(m4_normalize([
errno.h
fcntl.h
langinfo.h
limits.h
Expand Down Expand Up @@ -248,7 +256,10 @@ AC_CHECK_HEADERS([endian.h sys/endian.h])
AC_CHECK_HEADERS([utmpx.h])
AC_CHECK_HEADERS([termio.h])
AC_CHECK_HEADERS([sys/uio.h])
AC_CHECK_HEADERS([sys/un.h])
AC_CHECK_HEADERS([sys/types.h])
AC_CHECK_HEADERS([memory tr1/memory])
AC_LANG_PUSH(C++)

# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
Expand Down Expand Up @@ -471,6 +482,11 @@ AC_CHECK_DECL([IUTF8],
[AC_MSG_WARN([No IUTF8 termios mode; character-erase of multibyte character sequence probably does not work properly in canonical mode on this platform.])],
[[#include <termios.h>]])

if test "$enable_agent_forwarding" = "yes"; then
AC_DEFINE([SUPPORT_AGENT_FORWARDING], [], [
Define to enable support for SSH agent forwarding])
fi

# Checks for protobuf
PKG_CHECK_MODULES([protobuf], [protobuf])

Expand Down Expand Up @@ -530,6 +546,7 @@ AC_CONFIG_FILES([
src/protobufs/Makefile
src/statesync/Makefile
src/terminal/Makefile
src/agent/Makefile
src/util/Makefile
scripts/Makefile
src/examples/Makefile
Expand Down
9 changes: 9 additions & 0 deletions man/mosh.1
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ OpenSSH command to remotely execute mosh-server on remote machine (default: "ssh

An alternate ssh port can be specified with, \fIe.g.\fP, \-\-ssh="ssh \-p 2222".

.TP
.B \-\-forward-agent
Enable ssh authentication agent forwarding. If you use this, please be
aware of the security implications.

.TP
.B \-\-ssh-pty\fP
.B \-\-no-ssh-pty\fP
Expand All @@ -138,6 +143,10 @@ intervening control character keystrokes.
.B \-a
Synonym for \-\-predict=always

.TP
.B \-A
Synonym for \-\-forward-agent

.TP
.B \-n
Synonym for \-\-predict=never
Expand Down
19 changes: 18 additions & 1 deletion scripts/mosh.pl
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ BEGIN

my $term_init = 1;

my $forward_agent = 0;

my $localhost = undef;

my $ssh_pty = 1;
Expand Down Expand Up @@ -118,6 +120,8 @@ BEGIN
(example: "ssh -p 2222")
(default: "ssh")

-A --forward-agent enable ssh agent forwarding

--no-ssh-pty do not allocate a pseudo tty on ssh connection

--no-init do not send terminal initialization string
Expand Down Expand Up @@ -164,6 +168,8 @@ sub predict_check {
'6' => sub { $family = 'inet6' },
'p=s' => \$port_request,
'ssh=s' => sub { @ssh = shellwords($_[1]); },
'A' => \$forward_agent,
'forward-agent!' => \$forward_agent,
'ssh-pty!' => \$ssh_pty,
'init!' => \$term_init,
'local' => \$localhost,
Expand Down Expand Up @@ -376,6 +382,10 @@ sub predict_check {
}
my @server = ( 'new' );

if ( $forward_agent ) {
push @server, ( '-A' );
}

push @server, ( '-c', $colors );

push @server, @bind_arguments;
Expand Down Expand Up @@ -462,7 +472,14 @@ sub predict_check {
$ENV{ 'MOSH_KEY' } = $key;
$ENV{ 'MOSH_PREDICTION_DISPLAY' } = $predict;
$ENV{ 'MOSH_NO_TERM_INIT' } = '1' if !$term_init;
exec {$client} ("$client", "-# @cmdline |", $ip, $port);

my @client_av = ();
if ( $forward_agent ) {
push @client_av, ( '-A' );
}
push @client_av, ( $ip, $port );

exec {$client} ("$client", "-# @cmdline |", @client_av);
}

sub shell_quote { join ' ', map {(my $a = $_) =~ s/'/'\\''/g; "'$a'"} @_ }
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SUBDIRS = include protobufs util crypto terminal network statesync frontend examples tests
SUBDIRS = include protobufs util crypto terminal network statesync agent frontend examples tests
7 changes: 7 additions & 0 deletions src/agent/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
AM_CPPFLAGS = -I$(srcdir)/../util -I$(srcdir)/../crypto -I$(srcdir)/../network -I../protobufs $(protobuf_CFLAGS) $(TINFO_CFLAGS)
AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS)

noinst_LIBRARIES = libmoshagent.a

libmoshagent_a_SOURCES = agent.h agent.cc

Loading