Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
Doel
Give one user full admin rights and give a team only the commands it needs. Test both, and make sure the sudo files have no errors.
Voordat je begint
- Work on server1 as root (
sudo -i). - The web server does not need to be installed: sudo checks the rule before the command runs.
Taken
Vink een taak aan als hij klaar is. Alleen je browser onthoudt dit.
- Create the user
devops1with full admin rights through sudo. - Create the group
webadminsand the userweb1as a member of it. - Members of
webadminsmay run only these commands as root:systemctl restart httpd,systemctl status httpdandjournalctl -u httpd. Put the rule in its own file. - Create the user
backup1. It may run/usr/bin/rsyncas root without a password. - Test as
web1: list the allowed commands, run one allowed command and trycat /etc/shadowwith sudo (this must fail). - Check that all sudo files have a correct syntax.
Controleer je werk
Hints
Toon de hints
- Full rights on RHEL: membership of the group
wheel. - Use
visudo -f /etc/sudoers.d/NAME. A group in a rule starts with%. - Use full paths in the rules:
/usr/bin/systemctl,/usr/bin/journalctl. NOPASSWD:goes right before the command list.
Oplossing
Toon de oplossing
- devops1 in wheel.
- Group and user.
- A rule file for the group.
visudo -f /etc/sudoers.d/webadmins/etc/sudoers.d/webadmins%webadmins ALL=(root) /usr/bin/systemctl restart httpd, /usr/bin/systemctl status httpd, /usr/bin/journalctl -u httpd - backup1 without a password for rsync./etc/sudoers.d/backup1
backup1 ALL=(root) NOPASSWD: /usr/bin/rsync - Test as web1.
- Check the syntax of all files.
visudo -c
Mijn notities
Nog geen notities.