summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2025-12-09 23:15:15 +0100
committerChristian Breunig <christian@breunig.cc>2025-12-17 21:27:23 +0100
commit5566e6035b42e99eb874c3c5a35fe72e8435df38 (patch)
tree1ffcb1016fcf4b028021d28846f06d465882dba4 /src
parentcd11ba957a33933742304b4efbba77461e803cb3 (diff)
downloadvyos-1x-5566e6035b42e99eb874c3c5a35fe72e8435df38.tar.gz
vyos-1x-5566e6035b42e99eb874c3c5a35fe72e8435df38.zip
login: T8086: replace getpwall() occurances with get_local_passwd_entries()
Switch to our custom implementation to avoid NSS/TACACS timeouts as explained in commit 4c9eaaa96e06 ("login: replace getpwall() user enumeration to avoid NSS/TACACS timeouts").
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/system_login.py4
-rwxr-xr-xsrc/op_mode/show_users.py4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/conf_mode/system_login.py b/src/conf_mode/system_login.py
index 2692f427f..4da1d10ae 100755
--- a/src/conf_mode/system_login.py
+++ b/src/conf_mode/system_login.py
@@ -21,7 +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 +37,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 +136,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
diff --git a/src/op_mode/show_users.py b/src/op_mode/show_users.py
index c60b9932b..086c8b1e2 100755
--- a/src/op_mode/show_users.py
+++ b/src/op_mode/show_users.py
@@ -13,15 +13,15 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
import argparse
-import pwd
import struct
import sys
from time import ctime
from tabulate import tabulate
from vyos.config import Config
-
+from vyos.utils.auth import get_local_passwd_entries
class UserInfo:
def __init__(self, uid, name, user_type, is_locked, login_time, tty, host):