summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2025-12-17 21:36:47 +0100
committerGitHub <noreply@github.com>2025-12-17 21:36:47 +0100
commit5a22bd6e6ba87c6666b8cacecb1e8c071b81f2cd (patch)
tree6e044b10e3fa1648de2b6e8c6a3838da8e4dfa0d /src/conf_mode
parent3d5ebd5956c4e4333e66097d6d339c2329c21295 (diff)
parent197809bf77d841fe57bdcbaeeb3b078145aab140 (diff)
downloadvyos-1x-5a22bd6e6ba87c6666b8cacecb1e8c071b81f2cd.tar.gz
vyos-1x-5a22bd6e6ba87c6666b8cacecb1e8c071b81f2cd.zip
Merge pull request #4892 from c-po/getpwall
login: T8086: replace getpwall() based user enumeration to avoid NSS/TACACS timeouts
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/system_login.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/conf_mode/system_login.py b/src/conf_mode/system_login.py
index 2692f427f..3cff7a806 100755
--- a/src/conf_mode/system_login.py
+++ b/src/conf_mode/system_login.py
@@ -21,8 +21,6 @@ import json
from copy import deepcopy
from passlib.hosts import linux_context
from psutil import users
-from pwd import getpwall
-from pwd import getpwuid
from sys import exit
from time import sleep
@@ -38,6 +36,7 @@ from vyos.template import is_ipv4
from vyos.utils.auth import EPasswdStrength
from vyos.utils.auth import evaluate_strength
from vyos.utils.auth import get_current_user
+from vyos.utils.auth import get_local_passwd_entries
from vyos.utils.auth import get_local_users
from vyos.utils.auth import get_user_home_dir
from vyos.utils.auth import MIN_USER_UID
@@ -136,7 +135,7 @@ def verify(login):
raise ConfigError(f'Attempting to delete current user: {tmp}')
if 'user' in login:
- system_users = getpwall()
+ system_users = get_local_passwd_entries()
for user, user_config in login['user'].items():
# Linux system users range up until UID 1000, we can not create a
# VyOS CLI user which already exists as system user
@@ -432,7 +431,7 @@ def apply(login):
# retrieve current owner of home directory and adjust on demand
dir_owner = None
try:
- dir_owner = getpwuid(os.stat(home_dir).st_uid).pw_name
+ dir_owner = get_local_passwd_entries(os.stat(home_dir).st_uid).pw_name
except:
pass