summaryrefslogtreecommitdiffhomepage
path: root/svr-runopts.c
diff options
context:
space:
mode:
authorfabriziobertocci <fabriziobertocci@gmail.com>2019-05-15 09:43:57 -0400
committerMatt Johnston <matt@ucc.asn.au>2019-05-15 21:43:57 +0800
commit8c6aaf8d361e95ba3d9b371b86abaae1fd0e436f (patch)
tree42854eeaf56ed1955b6a1ec8c8e1e2df23524db8 /svr-runopts.c
parentcae6e6af1006d6afa33e030e21aeabafd8721be7 (diff)
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 *
Diffstat (limited to 'svr-runopts.c')
-rw-r--r--svr-runopts.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/svr-runopts.c b/svr-runopts.c
index d6c78df..19ce14c 100644
--- a/svr-runopts.c
+++ b/svr-runopts.c
@@ -46,16 +46,16 @@ static void printhelp(const char * progname) {
"-b bannerfile Display the contents of bannerfile"
" before user login\n"
" (default: none)\n"
- "-r keyfile Specify hostkeys (repeatable)\n"
+ "-r keyfile Specify hostkeys (repeatable)\n"
" defaults: \n"
#if DROPBEAR_DSS
- " dss %s\n"
+ " - dss %s\n"
#endif
#if DROPBEAR_RSA
- " rsa %s\n"
+ " - rsa %s\n"
#endif
#if DROPBEAR_ECDSA
- " ecdsa %s\n"
+ " - ecdsa %s\n"
#endif
#if DROPBEAR_DELAY_HOSTKEY
"-R Create hostkeys as required\n"
@@ -99,6 +99,10 @@ static void printhelp(const char * progname) {
"-W <receive_window_buffer> (default %d, larger may be faster, max 1MB)\n"
"-K <keepalive> (0 is never, default %d, in seconds)\n"
"-I <idle_timeout> (0 is never, default %d, in seconds)\n"
+#if DROPBEAR_EPKA
+ "-A <authplugin>[,<options>]\n"
+ " Enable external public key auth through <authplugin>\n"
+#endif
"-V Version\n"
#if DEBUG_TRACE
"-v verbose (compiled with DEBUG_TRACE)\n"
@@ -129,6 +133,9 @@ void svr_getopts(int argc, char ** argv) {
char* maxauthtries_arg = NULL;
char* keyfile = NULL;
char c;
+#if DROPBEAR_EPKA
+ char* pubkey_plugin = NULL;
+#endif
/* see printhelp() for options */
@@ -156,6 +163,10 @@ void svr_getopts(int argc, char ** argv) {
#if DROPBEAR_SVR_REMOTETCPFWD
svr_opts.noremotetcp = 0;
#endif
+#if DROPBEAR_EPKA
+ svr_opts.pubkey_plugin = NULL;
+ svr_opts.pubkey_plugin_options = NULL;
+#endif
#ifndef DISABLE_ZLIB
opts.compress_mode = DROPBEAR_COMPRESS_DELAYED;
@@ -274,6 +285,11 @@ void svr_getopts(int argc, char ** argv) {
case 'u':
/* backwards compatibility with old urandom option */
break;
+#if DROPBEAR_EPKA
+ case 'A':
+ next = &pubkey_plugin;
+ break;
+#endif
#if DEBUG_TRACE
case 'v':
debug_trace = 1;
@@ -394,6 +410,17 @@ 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 DROPBEAR_EPKA
+ if (pubkey_plugin) {
+ char *args = strchr(pubkey_plugin, ',');
+ if (args) {
+ *args='\0';
+ ++args;
+ }
+ svr_opts.pubkey_plugin = pubkey_plugin;
+ svr_opts.pubkey_plugin_options = args;
+ }
+#endif
}
static void addportandaddress(const char* spec) {