Browse Source

Remove NOPASSWD lines from sudoers

Bob Mottram 4 months ago
parent
commit
587c7ed03d
1 changed files with 1 additions and 6 deletions
  1. 1
    6
      tests/check-sudo.sh

+ 1
- 6
tests/check-sudo.sh View File

@@ -1,12 +1,7 @@
1 1
 #!/bin/bash
2 2
 
3 3
 if grep -i "NOPASSWD" /etc/sudoers /etc/sudoers.d/* | sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' | grep -i "NOPASSWD";then
4
-    if grep -q 'NOPASSWD' /etc/sudoers; then
5
-	sed -i 's|NOPASSWD ||g' /etc/sudoers
6
-    fi
7
-    if grep -q ' NOPASSWD' /etc/sudoers; then
8
-	sed -i 's| NOPASSWD||g' /etc/sudoers
9
-    fi
4
+    sed -i '/NOPASSWD/d' /etc/sudoers
10 5
     exit 1
11 6
 elif grep -i '!authenticate' /etc/sudoers /etc/sudoers.d/* | sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' | grep -i '!authenticate';then
12 7
     exit 1

Loading…
Cancel
Save