summaryrefslogtreecommitdiffstats
path: root/vtysh/vtysh_user.c
diff options
context:
space:
mode:
authorrgirada <rgirada@vmware.com>2022-06-23 16:37:28 +0200
committerrgirada <rgirada@vmware.com>2022-06-23 20:15:47 +0200
commit264a2a273fd1bf6543cef6bccf9019d09249b1a1 (patch)
treea6051e3187cff5950631ff68c3a1fb2040f0cfb6 /vtysh/vtysh_user.c
parentMerge pull request #11453 from ribarroetavena/master (diff)
downloadfrr-264a2a273fd1bf6543cef6bccf9019d09249b1a1.tar.xz
frr-264a2a273fd1bf6543cef6bccf9019d09249b1a1.zip
vtysh: Account validity should be verified when authenticating users with PAM.
Description: SonarQube detects the following behaviour as a vulanarability. When authenticating users using PAM, it is strongly recommended to check the validity of the account (not locked, not expired ...), otherwise it leads to unauthorized access to resources. pam_acct_mgmt() should be called for account validity after calling pam_authenticate(). Signed-off-by: Rajesh Girada <rgirada@vmware.com>
Diffstat (limited to 'vtysh/vtysh_user.c')
-rw-r--r--vtysh/vtysh_user.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/vtysh/vtysh_user.c b/vtysh/vtysh_user.c
index 665e6ca90..1ed284809 100644
--- a/vtysh/vtysh_user.c
+++ b/vtysh/vtysh_user.c
@@ -71,6 +71,10 @@ static int vtysh_pam(const char *user)
fprintf(stderr, "vtysh_pam: Failure to initialize pam: %s(%d)",
pam_strerror(pamh, ret), ret);
+ if (pam_acct_mgmt(pamh, 0) != PAM_SUCCESS)
+ fprintf(stderr, "%s: Failed in account validation: %s(%d)",
+ __func__, pam_strerror(pamh, ret), ret);
+
/* close Linux-PAM */
if (pam_end(pamh, ret) != PAM_SUCCESS) {
pamh = NULL;