Blob Blame History Raw
From 464a9095156228c2d965344ef35b7ff3873f06b5 Mon Sep 17 00:00:00 2001
From: Gabriel Becker <ggasparb@redhat.com>
Date: Tue, 8 Sep 2020 14:17:50 +0200
Subject: [PATCH] Fix bash remediation for rule accounts_no_uid_except_zero.

When multiple offending accounts were found in the system, xargs
couldn't process properly each account found.
---
 .../root_logins/accounts_no_uid_except_zero/bash/rhel6.sh     | 2 --
 .../root_logins/accounts_no_uid_except_zero/bash/shared.sh    | 4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)
 delete mode 100644 linux_os/guide/system/accounts/accounts-restrictions/root_logins/accounts_no_uid_except_zero/bash/rhel6.sh

diff --git a/linux_os/guide/system/accounts/accounts-restrictions/root_logins/accounts_no_uid_except_zero/bash/rhel6.sh b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/accounts_no_uid_except_zero/bash/rhel6.sh
deleted file mode 100644
index 18d83405b1..0000000000
--- a/linux_os/guide/system/accounts/accounts-restrictions/root_logins/accounts_no_uid_except_zero/bash/rhel6.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-# platform = Red Hat Enterprise Linux 6
-awk -F: '$3 == 0 && $1 != "root" { print $1 }' /etc/passwd | xargs passwd -l
diff --git a/linux_os/guide/system/accounts/accounts-restrictions/root_logins/accounts_no_uid_except_zero/bash/shared.sh b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/accounts_no_uid_except_zero/bash/shared.sh
index 016bb43b34..496e9e10df 100644
--- a/linux_os/guide/system/accounts/accounts-restrictions/root_logins/accounts_no_uid_except_zero/bash/shared.sh
+++ b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/accounts_no_uid_except_zero/bash/shared.sh
@@ -1,2 +1,2 @@
-# platform = multi_platform_wrlinux,Red Hat Enterprise Linux 7,Red Hat Enterprise Linux 8,multi_platform_ol,multi_platform_rhv
-awk -F: '$3 == 0 && $1 != "root" { print $1 }' /etc/passwd | xargs passwd -l
+# platform = multi_platform_wrlinux,Red Hat Enterprise Linux 6,Red Hat Enterprise Linux 7,Red Hat Enterprise Linux 8,multi_platform_ol,multi_platform_rhv
+awk -F: '$3 == 0 && $1 != "root" { print $1 }' /etc/passwd | xargs --max-lines=1 passwd -l