From ee057d52448870009dc13a587dad401c9380d247 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Fri, 4 Sep 2020 16:25:49 +0200 Subject: [PATCH] * Added `-r` command-line option to restconf daemon to NOT lower privileges to wwwuser if started from root. --- CHANGELOG.md | 1 + apps/restconf/restconf_main_evhtp.c | 16 +++++++++--- apps/restconf/restconf_main_fcgi.c | 38 ++++++++++++++++------------- 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2078fa48..7be5a47a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ Developers may need to change their code ### Minor changes +* Added `-r` command-line option to restconf daemon to NOT lower privileges to wwwuser if started from root. * Changed CLI help strings behaviour on query (?) for long and multi-line help strings. * If multiple strings (eg "\n" in text), indent before each new line * Primarily for auto-cli where long help strings are generated from YANG descriptions, but applies as well for manual long/multi-line help strings diff --git a/apps/restconf/restconf_main_evhtp.c b/apps/restconf/restconf_main_evhtp.c index 4145d034..dcedb2cc 100644 --- a/apps/restconf/restconf_main_evhtp.c +++ b/apps/restconf/restconf_main_evhtp.c @@ -80,7 +80,7 @@ #include "restconf_root.h" /* Command line options to be passed to getopt(3) */ -#define RESTCONF_OPTS "hD:f:l:p:d:y:a:u:o:P:sc" +#define RESTCONF_OPTS "hD:f:l:p:d:y:a:u:ro:scP:" /* See see listen(5) */ #define SOCKET_LISTEN_BACKLOG 16 @@ -589,6 +589,7 @@ usage(clicon_handle h, "\t-y \t Load yang spec file (override yang main module)\n" "\t-a UNIX|IPv4|IPv6 Internal backend socket family\n" "\t-u \t Internal socket domain path or IP addr (see -a)\n" + "\t-r \t\t Do not drop privileges if run as root\n" "\t-o