diff options
author | Matt Johnston <matt@ucc.asn.au> | 2022-01-30 10:14:56 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2022-01-30 10:14:56 +0800 |
commit | deb2ed63d904e8baf586bf97d494706ed58e7a9b (patch) | |
tree | c7199ab70fad3d27994e165c46b797f27c50d885 /svr-runopts.c | |
parent | 0d62392b5cd34331d3c5de84a8f398ef5e706ff2 (diff) | |
download | dropbear-deb2ed63d904e8baf586bf97d494706ed58e7a9b.tar.gz |
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.
Diffstat (limited to 'svr-runopts.c')
-rw-r--r-- | svr-runopts.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/svr-runopts.c b/svr-runopts.c index 02ec2d4..ada2e08 100644 --- a/svr-runopts.c +++ b/svr-runopts.c @@ -247,6 +247,12 @@ void svr_getopts(int argc, char ** argv) { svr_opts.inetdmode = 1; break; #endif +#if DROPBEAR_DO_REEXEC && NON_INETD_MODE + /* For internal use by re-exec */ + case '2': + svr_opts.reexec_child = 1; + break; +#endif case 'p': nextisport = 1; break; @@ -419,6 +425,19 @@ void svr_getopts(int argc, char ** argv) { if (svr_opts.forced_command) { dropbear_log(LOG_INFO, "Forced command set to '%s'", svr_opts.forced_command); } + +#if INETD_MODE + if (svr_opts.inetdmode && ( + opts.usingsyslog == 0 +#if DEBUG_TRACE + || debug_trace +#endif + )) { + /* log output goes to stderr which would get sent over the inetd network socket */ + dropbear_exit("Dropbear inetd mode is incompatible with debug -v or non-syslog"); + } +#endif + #if DROPBEAR_PLUGIN if (pubkey_plugin) { char *args = strchr(pubkey_plugin, ','); |