Check for socore in /etc/sudoers prior to append

Related to Issue #42
This commit is contained in:
Dustin Lee
2018-11-13 18:36:57 -05:00
committed by GitHub
parent 034a0ed7b2
commit ca627994ab

View File

@@ -741,10 +741,14 @@ set_updates() {
update_sudoers() { update_sudoers() {
# Update Sudoers so that socore can accept keys without a password if ! grep -qE '^socore\ ALL=\(ALL\)\ NOPASSWD:(\/usr\/bin\/salt\-key|\/opt\/so\/saltstack)' /etc/sudoers; then
echo "socore ALL=(ALL) NOPASSWD:/usr/bin/salt-key" | sudo tee -a /etc/sudoers # Update Sudoers so that socore can accept keys without a password
echo "socore ALL=(ALL) NOPASSWD:/opt/so/saltstack/pillar/firewall/addfirewall.sh" | sudo tee -a /etc/sudoers echo "socore ALL=(ALL) NOPASSWD:/usr/bin/salt-key" | sudo tee -a /etc/sudoers
echo "socore ALL=(ALL) NOPASSWD:/opt/so/saltstack/pillar/data/addtotab.sh" | sudo tee -a /etc/sudoers echo "socore ALL=(ALL) NOPASSWD:/opt/so/saltstack/pillar/firewall/addfirewall.sh" | sudo tee -a /etc/sudoers
echo "socore ALL=(ALL) NOPASSWD:/opt/so/saltstack/pillar/data/addtotab.sh" | sudo tee -a /etc/sudoers
else
echo "User socore already granted sudo privileges"
fi
} }