summaryrefslogtreecommitdiff
path: root/svr-runopts.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2022-01-30 10:14:56 +0800
committerMatt Johnston <matt@ucc.asn.au>2022-01-30 10:14:56 +0800
commitdeb2ed63d904e8baf586bf97d494706ed58e7a9b (patch)
treec7199ab70fad3d27994e165c46b797f27c50d885 /svr-runopts.c
parent0d62392b5cd34331d3c5de84a8f398ef5e706ff2 (diff)
downloaddropbear-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.c19
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, ',');