Skip to content

Commit c651842

Browse files
romanmichalvasko
authored andcommitted
session server UPDATE add system authentication
1 parent fb3f7cf commit c651842

File tree

6 files changed

+304
-79
lines changed

6 files changed

+304
-79
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,9 @@ find_package(LibYANG ${LIBYANG_DEP_SOVERSION} REQUIRED)
278278
target_link_libraries(netconf2 ${LIBYANG_LIBRARIES})
279279
include_directories(${LIBYANG_INCLUDE_DIRS})
280280

281+
# header file compatibility - shadow.h
282+
check_include_file("shadow.h" HAVE_SHADOW)
283+
281284
# function compatibility - getpeereid on QNX
282285
if(${CMAKE_SYSTEM_NAME} MATCHES "QNX")
283286
target_link_libraries(netconf2 -lsocket)

modules/[email protected]

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,15 +265,28 @@ module libnetconf2-netconf-server {
265265
"Grouping for the SSH Keyboard interactive authentication method.";
266266

267267
container keyboard-interactive {
268-
presence "Indicates that PAM configuration file name has been configured and that
269-
the given client supportsthe SSH Keyboard Interactive authentication method.";
268+
presence "Indicates that the given client supports the SSH Keyboard Interactive authentication method.";
270269
description
271270
"Keyboard interactive SSH authentication method.";
272271

273272
reference
274273
"RFC 4256:
275274
Generic Message Exchange Authentication for
276275
the Secure Shell Protocol (SSH)";
276+
277+
choice method {
278+
mandatory true;
279+
description
280+
"Method to perform the authentication with.";
281+
282+
container use-system-auth {
283+
presence
284+
"Indicates that the system will handle the authentication.";
285+
286+
description
287+
"Authentication is done using the system's mechanisms.";
288+
}
289+
}
277290
}
278291
}
279292

src/server_config.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2344,13 +2344,13 @@ nc_server_config_password(const struct lyd_node *node, NC_OPERATION op)
23442344
}
23452345

23462346
static int
2347-
nc_server_config_kb_int(const struct lyd_node *node, NC_OPERATION op)
2347+
nc_server_config_use_system_auth(const struct lyd_node *node, NC_OPERATION op)
23482348
{
23492349
int ret = 0;
23502350
struct nc_auth_client *auth_client;
23512351
struct nc_ch_client *ch_client = NULL;
23522352

2353-
assert(!strcmp(LYD_NAME(node), "keyboard-interactive"));
2353+
assert(!strcmp(LYD_NAME(node), "use-system-auth"));
23542354

23552355
/* LOCK */
23562356
if (is_ch(node) && nc_server_config_get_ch_client_with_lock(node, &ch_client)) {
@@ -3915,8 +3915,8 @@ nc_server_config_parse_netconf_server(const struct lyd_node *node, NC_OPERATION
39153915
ret = nc_server_config_truststore_reference(node, op);
39163916
} else if (!strcmp(name, "password")) {
39173917
ret = nc_server_config_password(node, op);
3918-
} else if (!strcmp(name, "keyboard-interactive")) {
3919-
ret = nc_server_config_kb_int(node, op);
3918+
} else if (!strcmp(name, "use-system-auth")) {
3919+
ret = nc_server_config_use_system_auth(node, op);
39203920
} else if (!strcmp(name, "none")) {
39213921
ret = nc_server_config_none(node, op);
39223922
} else if (!strcmp(name, "host-key-alg")) {

src/server_config.h

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -383,24 +383,7 @@ int nc_server_config_del_ssh_user_password(const char *endpt_name, const char *u
383383
/**
384384
* @brief Creates new YANG configuration data nodes for an SSH user's keyboard interactive authentication method.
385385
*
386-
* @param[in] ctx libyang context.
387-
* @param[in] endpt_name Arbitrary identifier of the endpoint.
388-
* If an endpoint with this identifier already exists, its user might be changed.
389-
* @param[in] user_name Arbitrary identifier of the user.
390-
* If an user with this identifier already exists, its contents will be changed.
391-
* @param[in] pam_config_name Name of the PAM configuration file.
392-
* @param[in] pam_config_dir Optional. The absolute path to the directory in which the configuration file
393-
* with the name pam_config_name is located. A newer version (>= 1.4) of PAM library is required to be able to specify
394-
* the path. If NULL is passed, then the PAM's system directories will be searched (usually /etc/pam.d/).
395-
* @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created.
396-
* Otherwise the new YANG data will be added to the previous data and may override it.
397-
* @return 0 on success, non-zero otherwise.
398-
*/
399-
400-
/**
401-
* @brief Creates new YANG configuration data nodes for an SSH user's keyboard interactive authentication method.
402-
*
403-
* To set the PAM configuration filename, see ::nc_server_ssh_set_pam_conf_filename().
386+
* One of Linux PAM, local users, or user callback is used to authenticate users with this SSH method (see \ref ln2doc_kbdint "the documentation").
404387
*
405388
* @param[in] ctx libyang context.
406389
* @param[in] endpt_name Arbitrary identifier of the endpoint.
@@ -1043,7 +1026,7 @@ int nc_server_config_del_ch_ssh_user_password(const char *client_name, const cha
10431026
/**
10441027
* @brief Creates new YANG configuration data nodes for a Call Home SSH user's keyboard interactive authentication method.
10451028
*
1046-
* To set the PAM configuration filename, see ::nc_server_ssh_set_pam_conf_filename().
1029+
* One of Linux PAM, local users, or user callback is used to authenticate users with this SSH method (see \ref ln2doc_kbdint "the documentation").
10471030
*
10481031
* @param[in] ctx libyang context.
10491032
* @param[in] client_name Arbitrary identifier of the Call Home client.

src/server_config_util_ssh.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -484,10 +484,10 @@ nc_server_config_add_ssh_user_interactive(const struct ly_ctx *ctx, const char *
484484
NC_CHECK_ARG_RET(NULL, ctx, endpt_name, user_name, config, 1);
485485

486486
ret = asprintf(&path, "/ietf-netconf-server:netconf-server/listen/endpoint[name='%s']/ssh/ssh-server-parameters/"
487-
"client-authentication/users/user[name='%s']", endpt_name, user_name);
487+
"client-authentication/users/user[name='%s']/libnetconf2-netconf-server:keyboard-interactive", endpt_name, user_name);
488488
NC_CHECK_ERRMEM_GOTO(ret == -1, path = NULL; ret = 1, cleanup);
489489

490-
ret = nc_server_config_append(ctx, path, "libnetconf2-netconf-server:keyboard-interactive", NULL, config);
490+
ret = nc_server_config_append(ctx, path, "use-system-auth", NULL, config);
491491
if (ret) {
492492
goto cleanup;
493493
}
@@ -507,11 +507,11 @@ nc_server_config_add_ch_ssh_user_interactive(const struct ly_ctx *ctx, const cha
507507
NC_CHECK_ARG_RET(NULL, ctx, client_name, endpt_name, user_name, config, 1);
508508

509509
ret = asprintf(&path, "/ietf-netconf-server:netconf-server/call-home/netconf-client[name='%s']/endpoints/"
510-
"endpoint[name='%s']/ssh/ssh-server-parameters/client-authentication/users/user[name='%s']",
511-
client_name, endpt_name, user_name);
510+
"endpoint[name='%s']/ssh/ssh-server-parameters/client-authentication/users/user[name='%s']/"
511+
"libnetconf2-netconf-server:keyboard-interactive", client_name, endpt_name, user_name);
512512
NC_CHECK_ERRMEM_GOTO(ret == -1, path = NULL; ret = 1, cleanup);
513513

514-
ret = nc_server_config_append(ctx, path, "libnetconf2-netconf-server:keyboard-interactive", NULL, config);
514+
ret = nc_server_config_append(ctx, path, "use-system-auth", NULL, config);
515515
if (ret) {
516516
goto cleanup;
517517
}

0 commit comments

Comments
 (0)