Commit Graph

95 Commits

Author SHA1 Message Date
Matt Johnston
86ac8411a0 Add manpage entry for -z, change help text
Fixes #193 on github (with previous patch)
2022-11-10 12:26:25 +08:00
Petr Štetiar
2864c3d154 Make IP Type-Of-Service feature optional
Add new -z commandline option which when set, disables new IP TOS
feature.

References: https://github.com/openwrt/openwrt/issues/10405
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2022-11-10 11:58:43 +08:00
Matt Johnston
71d78653c7 Merge pull request #160 from Jackkal/two-factor-authentication
Two-factor authentication support (pubkey and password)
2022-11-09 17:33:48 +08:00
Matt Johnston
9f55ff216b Add check for -t -s clash
multiauthmethod with noauthpass isn't allowed
2022-11-09 17:33:04 +08:00
Matt Johnston
ab6ea4d697 Fix plugin argument
This broke in the re-exec changes, it was altering the argv
argument in-place, but argv was re-used later.

Fixes #194 github issue
2022-11-09 13:14:22 +08:00
Matt Johnston
544f28a051 Fix MAX_UNAUTH_CLIENTS regression
Since re-exec change in 2022.82 Dropbear count
treat authenticated sessions towards the unauthenticated
session limit. This is fixed by passing the childpipe FD
through to the re-execed process.
2022-06-08 21:26:20 +08:00
Jackkal
0c9318a0b2 Two-factor authentication support (pubkey and password) 2022-04-29 15:43:15 +02:00
Matt Johnston
dd305c1533 Fix IPv6 address parsing for dbclient -b
Now can correctly handle '-b [ipv6address]:port'

Code is shared with dropbear -p, though they handle colon-less arguments
differently
2022-04-01 14:13:52 +08:00
Begley Brothers Inc
f4be5a3c8b Allow user space file locations (rootless support)
Why:
Running dropbear as a user (rootless) is aided if
files and programs can be saved/removed without
needing sudo.

What:
Use the same convention as DROPBEAR_DEFAULT_CLI_AUTHKEY;
if not starting with '/', then is relative to hedge's /home/hedge:
*_PRIV_FILENAME
DROPBEAR_PIDFILE
SFTPSERVER_PATH

default_options.h commentary added.

Changes kept to a minimum, so log entry in svr_kex.c#163
is refactored.
From:
    Generated hostkey is <path> ... <finger-print>
to:
    Generated hostkey path is <path>
    Generated hostkey fingerprint is <fp>
Otherwise the unexpanded path was reported.

Patch modified by Matt Johnston

Signed-off-by: Begley Brothers Inc <begleybrothers@gmail.com>
2022-03-30 13:51:57 +08:00
Matt Johnston
d142639e38 Add -v variable debug levels for server too
-vvvv is equivalent to the old -v
2022-03-24 14:44:13 +08:00
Matt Johnston
3521b58690 Revert "Don't include sk keys at all in KEX list"
This reverts git commit f972813ecd.
The sk algorithms need to remain in the sigalgs list so that they
are included in the server-sig-algs ext-info message sent by
the server. RFC8308 for server-sig-algs requires that all algorithms are
listed (though OpenSSH client 8.4p1 tested doesn't require that)
2022-03-24 13:42:08 +08:00
Matt Johnston
c7b7c9a99d Add re-exec for server
This allows ASLR to re-randomize the address
space for every connection, preventing some
vulnerabilities from being exploitable by
repeated probing.

Overhead (memory and time) is yet to be confirmed.

At present this is only enabled on Linux. Other BSD platforms
with fexecve() would probably also work though have not been tested.
2022-01-30 10:14:56 +08:00
Matt Johnston
f972813ecd Don't include sk keys at all in KEX list 2022-01-23 17:29:39 +08:00
egor-duda
5edd2ce32e
Implement server-side support for sk-ecdsa U2F-backed keys (#142)
* Implement server-side support for sk-ecdsa U2F-backed keys

* Fix out-of-bounds read on normal ecdsa-sha2-[identifier] keys

* Fix one more potential out-of-bounds read

* Check if nistp256 curve is used in sk-ecdsa-sha2- key

It's the only allowed curve per PROTOCOL.u2f specification

* Implement server-side support for sk-ed25519 FIDO2-backed keys

* Keys with type sk-* make no sense as host keys, so they should be
disabled

* fix typo

* Make sk-ecdsa call buf_ecdsa_verify

This reduces code duplication, the SK code just handles the
different message format.

* Reduce sk specific code

The application id can be stored in signkey, then we don't need
to call sk-specific functions from svr-authpubkey

* Remove debugging output, which causes compilation errors with DEBUG_TRACE disabled

* Proper cleanup of sk_app

Co-authored-by: Matt Johnston <matt@codeconstruct.com.au>
2022-01-22 21:53:04 +08:00
Matt Johnston
043b0fbd1b Increase max window size to 10MB, fallback rather than
exiting if an invalid value is given.
2021-10-12 23:32:10 +08:00
Roland Vollgraf
2157d52352
pass on sever process environment to child processes (option -e) (#118) 2021-08-19 23:13:41 +08:00
Matt Johnston
701d43b859 send and handle SSH_MSG_EXT_INFO only at the correct point
- other fixes for rsa pubkey auth
- only include ext-info handling when rsa pubkey auth is compiled
2020-05-24 14:16:58 +08:00
Matt Johnston
331d4a714f Make server send SSH_MSG_EXT_INFO
Ensure that only valid hostkey algorithms are sent in the first kex guess
2020-05-21 23:00:22 +08:00
Vladislav Grishenko
3d12521735
Add Ed25519 support (#91)
* Add support for Ed25519 as a public key type

Ed25519 is a elliptic curve signature scheme that offers
better security than ECDSA and DSA and good performance. It may be
used for both user and host keys.

OpenSSH key import and fuzzer are not supported yet.

Initially inspired by Peter Szabo.

* Add curve25519 and ed25519 fuzzers

* Add import and export of Ed25519 keys
2020-03-12 00:09:45 +08:00
Matt Johnston
fa116e983b Rename EPKA -> Plugin 2019-05-15 21:59:45 +08:00
fabriziobertocci
8c6aaf8d36 External Public-Key Authentication API (#72)
* Implemented dynamic loading of an external plug-in shared library to delegate public key authentication

* Moved conditional compilation of the plugin infrastructure into the configure.ac script to be able to add -ldl to dropbear build only when the flag is enabled

* Added tags file to the ignore list

* Updated API to have the constructor to return function pointers in the pliugin instance. Added support for passing user name to the checkpubkey function. Added options to the session returned by the plugin and have dropbear to parse and process them

* Added -rdynamic to the linker flags when EPKA is enabled

* Changed the API to pass a previously created session to the checkPubKey function (created during preauth)

* Added documentation to the API

* Added parameter addrstring to plugin creation function

* Modified the API to retrieve the auth options. Instead of having them as field of the EPKASession struct, they are stored internally (plugin-dependent) in the plugin/session and retrieved through a pointer to a function (in the session)

* Changed option string to be a simple char * instead of unsigned char *
2019-05-15 21:43:57 +08:00
Matt Johnston
56855744b8 Only advertise a single server ecdsa key when -R (generate as required) is
specified. Fixes -R now that default ecdsa key size has changed.
2018-03-08 22:25:33 +08:00
Matt Johnston
9bbce01e1b merge from main
--HG--
branch : fuzz
2018-02-28 21:28:59 +08:00
Matt Johnston
6eabc0fe87 add guard HAVE_GETGROUPLIST 2018-02-27 21:49:10 +08:00
Matt Johnston
5df73215f8 merge from main
--HG--
branch : fuzz
2018-02-26 22:44:48 +08:00
François Perrad
2e836bb553 more linting (#58)
* const parameter

* fix indentation
2018-02-26 21:31:15 +08:00
Matt Johnston
36ccfd21e7 Fix restricted group code for BSDs, move to separate function 2018-02-26 21:17:13 +08:00
Matt Johnston
094972ea84 Merge branch 'master' of git://github.com/stellarpower/dropbear into stellarpower-master 2018-02-22 23:06:45 +08:00
CamVan Nguyen
4c95d595c0 Only load dropbear default host keys if a key is not specified 2018-02-22 21:55:15 +08:00
stellarpower
d17dedfa4f Added the -G option to allow logins only for users that are members of a certain group. This allows finer control of an instance on who can and cannot login over a certain instance (e.g. password and not key). Needs double-checking and ensuring it meets platform requirements. 2018-02-20 02:11:55 +00:00
Matt Johnston
7e8094d53a merge from main
--HG--
branch : fuzz
2018-02-17 19:29:51 +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
597f7eb5e9 merge up to date
--HG--
branch : fuzz
2018-01-23 22:46:07 +08:00
Matt Johnston
74ace058a6 Use MAX_AUTH_TRIES rather than DEFAULT_AUTH_TRIES, don't limit argument range 2017-06-27 22:20:38 +08:00
Kevin Darbyshire-Bryant
e255101299 dropbear server: support -T max auth tries
Add support for '-T n' for a run-time specification for maximum number
of authentication attempts where 'n' is between 1 and compile time
option MAX_AUTH_TRIES.

A default number of tries can be specified at compile time using
'DEFAULT_AUTH_TRIES' which itself defaults to MAX_AUTH_TRIES for
backwards compatibility.

Signed-off-by: Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
2017-06-25 11:53:58 +01:00
Matt Johnston
88ce30beb6 merge from main
--HG--
branch : fuzz
2017-06-14 23:31:42 +08:00
Francois Perrad
5f76e4c1ed when pointer, use NULL instead of 0 2017-06-02 18:14:31 +02:00
Matt Johnston
4dae8edb76 merge main to fuzz
--HG--
branch : fuzz
2017-05-18 23:45:10 +08:00
Matt Johnston
fb719e3d0b fuzz harness
--HG--
branch : fuzz
2017-05-13 22:50:54 +08:00
Matt Johnston
9f24cdf74c copy over some fuzzing code from AFL branch
--HG--
branch : fuzz
2017-05-12 23:14:54 +08:00
Matt Johnston
32a28d0d9c Convert #ifdef to #if, other build changes 2016-05-04 15:33:40 +02:00
Matt Johnston
103036c546 Add manpage and log for forced_command 2016-04-12 21:05:40 +08:00
Jeremy Kerr
ac9a4c839f Add -c <command> option to force a specific command
This change adds a -c option to dropbear, to force the session to use a
specific command, in a similar fashion to OpenSSH's ForceCommand
configuration option.

This is useful to provide a simple fixed service over ssh, without
requiring an authorized key file for the per-key forced_command option.

This setting takes precedence over the channel session's provided
command, and the per-key forced_command setting.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
2016-04-12 21:01:08 +08:00
Konstantin Tokarev
2d6bbf341d Moved usingsyslog from svr_runopts to runopts. 2015-12-15 16:43:29 +03:00
Matt Johnston
e81b6fbc6e ports and addresses must be malloced to avoid segfault on exit 2015-12-02 22:37:20 +08:00
Matt Johnston
eedeb009ec mention dropbearkey too 2015-11-25 23:05:41 +08:00
Matt Johnston
d8bc6abcf0 Mention "dropbear -R" if no hostkeys 2015-11-25 23:05:14 +08:00
Guilhem Moulin
7fb1bec84a Enable bundling 2015-11-06 23:54:24 +08:00
Matt Johnston
e4827025be Warn rather than fail if flags have trailing parts 2015-10-28 21:37:35 +08:00
Matt Johnston
23cc2bfb8c don't silently ignore extra flag arguments 2015-10-21 22:05:50 +08:00