Commit Graph

53 Commits

Author SHA1 Message Date
Tuomas Haikarainen
1e4d64d300 Added permitopen option to authorized_keys
It is now possible to limit local port forwarding to specified
destination(s) by using the permitopen option in authorized_keys.

Resolves #181
2022-07-12 10:35:00 +03:00
Matt Johnston
1c8f00bd59 Leave non-interactive at default QoS class
Lower class levels are less well defined, and non-interactive
SSH can carry various different types of applications.

This change also sets lowdelay class (AF21) earlier in an an outbound
dbclient session
2022-01-27 14:34:10 +08:00
Matt Johnston
f17400e738 Replace ChanType.sepfds with Channel.bidir_fd
This handles the case where a svrchansess has separate FDs
for nopty, but a single FD for pty mode.

The use of sepfds was also previously incorrect for X11 and
agent forwarding
2021-10-11 15:42:14 +08:00
ValdikSS
8d0013bbe0
Use MAX_HOST_LEN for TCP forwarding requests (#121)
tcpip-forward request can include hostname, which is later resolved by getaddrinfo() call.
Dropbear incorrectly assumes tcpip-forward includes only IP(v4) address. Fix this.
2021-03-18 21:16:17 +08:00
Matt Johnston
5d60e5f312 Use buf_eatstring instead 2020-12-10 23:18:48 +08:00
Dirkjan Bussink
38d7da5fe5
Fix handling of replies to global requests (#112)
The current code assumes that all global requests want / need a reply.
This isn't always true and the request itself indicates if it wants a
reply or not.

It causes a specific problem with hostkeys-00@openssh.com messages.
These are sent by OpenSSH after authentication to inform the client of
potential other host keys for the host. This can be used to add a new
type of host key or to rotate host keys.

The initial information message from the server is sent as a global
request, but with want_reply set to false. This means that the server
doesn't expect an answer to this message. Instead the client needs to
send a prove request as a reply if it wants to receive proof of
ownership for the host keys.

The bug doesn't cause any current problems with due to how OpenSSH
treats receiving the failure message. It instead treats it as a
keepalive message and further ignores it.

Arguably this is a protocol violation though of Dropbear and it is only
accidental that it doesn't cause a problem with OpenSSH.

The bug was found when adding host keys support to libssh, which is more
strict protocol wise and treats the unexpected failure message an error,
also see https://gitlab.com/libssh/libssh-mirror/-/merge_requests/145
for more information.

The fix here is to honor the want_reply flag in the global request and
to only send a reply if the other side expects a reply.
2020-12-10 23:13:13 +08:00
Matt Johnston
007a5925dc fuzz: work around fuzz_connect_remote() limitations 2020-12-06 21:27:25 +08:00
François Perrad
cb945f9f67 add missing initializer (#71) 2019-01-07 23:09:45 +08:00
Matt Johnston
fe992bf4ea Split ChanType closehandler() and cleanup() so that dbclient doesn't
lose exit status messages
2018-11-14 22:57:56 +08:00
Matt Johnston
d2e71ade72 FIx remote forward listeners 2018-09-07 23:02:20 +08:00
Matt Johnston
96e1a7e6da avoid warning about port 2018-02-26 23:12:02 +08:00
Matt Johnston
0fc20c70af don't log server listen ports 2018-02-26 22:12:39 +08:00
Francois Perrad
2ef1ab0753 fix indentation 2018-02-16 23:31:58 +08:00
Michael Witten
3ee685ad1c options: Complete the transition to numeric toggles (`#if')
For the sake of review, this commit alters only the code; the affiliated
comments within the source files also need to be updated, but doing so
now would obscure the operational changes that have been made here.

* All on/off options have been switched to the numeric `#if' variant;
  that is the only way to make this `default_options.h.in' thing work
  in a reasonable manner.

* There is now some very minor compile-time checking of the user's
  choice of options.

* NO_FAST_EXPTMOD doesn't seem to be used, so it has been removed.

* ENABLE_USER_ALGO_LIST was supposed to be renamed DROPBEAR_USER_ALGO_LIST,
  and this commit completes that work.

* DROPBEAR_FUZZ seems to be a relatively new, as-yet undocumented option,
  which was added by the following commit:

    commit 6e0b539e9c
    Author: Matt Johnston <matt@ucc.asn.au>
    Date:   Tue May 23 22:29:21 2017 +0800

        split out checkpubkey_line() separately

  It has now been added to `sysoptions.h' and defined as `0' by default.

* The configuration option `DROPBEAR_PASSWORD_ENV' is no longer listed in
  `default_options.h.in'; it is no longer meant to be set by the user, and
  is instead left to be defined in `sysoptions.h' (where it was already being
  defined) as merely the name of the environment variable in question:

    DROPBEAR_PASSWORD

  To enable or disable use of that environment variable, the user must now
  toggle `DROPBEAR_USE_DROPBEAR_PASSWORD'.

* The sFTP support is now toggled by setting `DROPBEAR_SFTPSERVER', and the
  path of the sFTP server program is set independently through the usual
  SFTPSERVER_PATH.
2018-02-16 23:13:47 +08:00
Matt Johnston
e4ac7ea1ca bind to port as well with -b 2018-01-26 00:28:25 +08:00
houseofkodai
9c7ecf6d14 cli_bind_address_connect
* replaces -b dummy option in dbclient to be similar with openssh -b option
* useful in multi-wan connections
2018-01-26 00:28:25 +08:00
houseofkodai
917722257d Server chosen tcpfwd ports (#43)
Server chosen tcpfwd ports
2018-01-25 22:21:41 +08:00
Francois Perrad
598056d168 Pointer parameter could be declared as pointing to const (callback) 2017-08-19 22:39:53 +02:00
Matt Johnston
45b27b0194 merge 2017.75 2017-05-18 22:59:38 +08:00
Matt Johnston
2b891f5eb3 listenaddr must be malloced 2017-05-16 23:04:57 +08:00
Matt Johnston
32a28d0d9c Convert #ifdef to #if, other build changes 2016-05-04 15:33:40 +02:00
Francois Perrad
3e20c442de fix empty C prototypes 2016-03-16 22:41:20 +08:00
Matt Johnston
645b254173 Merge branch '20151231_indent' of https://github.com/fperrad/dropbear into fperrad-20151231_indent 2016-03-15 21:41:06 +08:00
Chocobo1
9bcd5f3c0a Fix print format specifier 2016-01-05 12:37:48 +08:00
Francois Perrad
9bda22e702 more hard tab 2016-01-01 15:02:09 +01:00
Matt Johnston
1a4db21fe4 buf_getstring and buf_putstring now use non-unsigned char* 2015-06-04 23:08:50 +08:00
Gaël PORTAY
20f1e49b73 Turn many local variables into char *
reqname, bindaddr, request_addr, desthost and orighost to be exhaustive.
2015-05-05 20:39:14 +02:00
Gaël PORTAY
224b16b247 Fix pointer differ in signess warnings [-Werror=pointer-sign] 2015-05-05 20:39:13 +02:00
Matt Johnston
364a53577e Move generic network routines to netio.c
--HG--
branch : fastopen
2015-02-20 23:16:38 +08:00
Matt Johnston
755c1458f0 async connections working
--HG--
branch : fastopen
2015-02-18 22:46:15 +08:00
Matt Johnston
9abcc7b909 connect_remote() is now always non-blocking 2015-02-14 09:56:11 +08:00
Matt Johnston
da57dd13c5 Set tcp priority as follows:
if (connecting || ptys || x11) tos = LOWDELAY;
else if (tcp_forwards) tos = 0;
else tos = BULK;

TCP forwards could be either lowdelay or bulk, hence the default priority.
2014-07-16 22:53:32 +08:00
Matt Johnston
50a5d3756f Send a failure response if a client receives a global request 2014-07-08 21:59:36 +08:00
Matt Johnston
de1deaf0bd use oldstyle comments 2013-11-14 22:03:30 +08:00
Matt Johnston
1984aabc95 Server shouldn't return "localhost" in response to -R forward connections
if that wasn't what the client requested.
2012-05-09 21:09:34 +08:00
Matt Johnston
2a02c4084a - Don't sent SSH_MSG_UNIMPLEMENTED if we don't have ENABLE_SVR_REMOTETCPFWD
- Fix build if ENABLE_SVR_REMOTETCPFWD is disabled but ENABLE_SVR_LOCALTCPFWD
  is enabled
2012-05-09 20:33:16 +08:00
Matt Johnston
b9e21e2367 Fix crash when remote forwarding was requested
--HG--
extra : convert_revision : 5c0a794976692a54ec36111291179020e2ae6c1e
2011-04-07 13:39:10 +00:00
Matt Johnston
665b768cef Fix leak found by Klocwork
--HG--
extra : convert_revision : 51ce088e100e9ea150efc6bf3d021f019a46b2f5
2011-04-07 13:38:27 +00:00
Matt Johnston
85288d7b61 - Progress for allowing specifying a listenaddr for tcp forwards
--HG--
extra : convert_revision : 48fdaa8706d1acda35e9d564adc9a1fbc96c18c8
2010-02-24 16:13:15 +00:00
Matt Johnston
c0ce2a6a97 * Patch from Frédéric Moulins adding options to authorized_keys.
Needs review.

--HG--
branch : pubkey-options
extra : convert_revision : 26872f944d79ddacff1070aab32115a6d726392c
2008-09-08 15:14:02 +00:00
Matt Johnston
4cb673b644 Fixes from Erik Hovland:
cli-authpubkey.c:
    fix leak of keybuf

cli-kex.c:
    fix leak of fingerprint fp

cli-service.c:
    remove commented out code

dropbearkey.c:
    don't attepmt to free NULL key on failure

common-kex.c:
    only free key if it is initialised

keyimport.c:
    remove dead encrypted-key code
    don't leak a FILE* loading OpenSSH keys

rsa.c, dss.c:
    check return values for some libtommath functions

svr-kex.c:
    check return value retrieving DH kex mpint

svr-tcpfwd.c:
    fix null-dereference if remote tcp forward request fails

tcp-accept.c:
    don't incorrectly free the tcpinfo var

--HG--
extra : convert_revision : 640a55bc710cbaa6d212453c750026c770e19193
2006-07-07 09:17:18 +00:00
Matt Johnston
d8e61e51de * svr-tcpfwd.c: should be MAX_NAME_LEN not MAXNAMLEN
--HG--
extra : convert_revision : f3f6f865b6d723add601feabf155a1fcc084b0aa
2006-01-15 06:39:48 +00:00
Matt Johnston
6c56271e8c * fix -L forwarding on the client, broke last rev
--HG--
extra : convert_revision : 826db75f8001f7da7b0b8c91dcf66a44bf107b49
2005-12-06 16:51:55 +00:00
Matt Johnston
a673d60963 * add -g (dbclient) and -a (dropbear) options for allowing non-local
hosts to connect to forwarded ports. Rearranged various some of the
	tcp listening code.
	* changed to /* */ style brackets in svr-authpam.c

--HG--
extra : convert_revision : c1e04e648867db464fe9818c4910e4320cd50c32
2005-12-04 16:13:11 +00:00
Matt Johnston
b131f74533 * rename infd/outfd to writefd/readfd, to avoid confusion
--HG--
extra : convert_revision : e3e7dc2cf75ad60c83a5b4307c210fee2fe90434
2005-10-20 16:53:12 +00:00
Matt Johnston
f45eafe342 * fix longstanding bug with connections being closed on failure to
connect to auth socket (server)
* differentiate between get_byte and get_bool
* get rid of some // comments
* general tidying

--HG--
extra : convert_revision : fb8d188ce33b6b45804a5ce51b9f601f83bdf3d7
2005-03-13 13:58:14 +00:00
Matt Johnston
8c1a429c44 Fixed DEBUG_TRACE macro so that we don't get semicolons left about the place
--HG--
extra : convert_revision : d928bc851e32be7bd429bf7504b148c0e4bf7e2f
2005-01-02 20:25:56 +00:00
Matt Johnston
e7677a5e8d Rearrange preprocessor parts so that compilation with various options
disabled works OK.

--HG--
extra : convert_revision : cc92f744e34125062d052b757967e167f19d6db5
2004-12-22 15:37:50 +00:00
Matt Johnston
703c9a7370 License boilerplate etc, add Mihnea as an author to some of the files
--HG--
extra : convert_revision : 75c02f80c4ed25bd4697e7f17ffac6eded54c148
2004-08-14 17:54:20 +00:00
Matt Johnston
8e1ec24f55 Merging in the changes from 0.41-0.43 main Dropbear tree
--HG--
extra : convert_revision : 4c3428781bc8faf0fd7cadd7099fbd7f4ea386e7
2004-08-12 16:41:58 +00:00