Skip to content

Add subsection with recommendations for using sudo #222

@daobrien

Description

@daobrien

In an attempt to standardize how we use sudo across all courses, we've come up with the following (so far):

Using sudo in Training Courses

Need a useful intro here.

Assumptions

  1. Although security is important, it is more important to not have unnecessary classroom security distract from the immediate topic being taught.

General Recommendations

NOTE: These are recommendations, not rules. As with most things, consistency is important. Don't swap between different approaches without reason. Choose which approach works best for your situation and stick to it.

  1. In all cases, use the minimum privilege level required to achieve the task.
  2. In exercises, use sudo and sudo -i and set this up to work throughout all relevant systems in the classroom. Do not use su - without good cause.
  3. When there are a scattered minority of privileged commands in a mostly unprivileged exercise, use sudo on a per-command basis.
  4. When the exercise is majority privileged, or has a significant number of privileged commands, use sudo -i either at the beginning of the exercise, or at an appropriate step where the privileged commands begin.
  5. In the narrative, do not show the use of su or sudo, but always show privileged commands with the correct prompt.

Exceptions

  1. Some courses are specifically designed to teach sudo and its variations, the use of the related files, such as /etc/sudoers and so on. For these courses, use the required variation for the topic being taught.

Ansible Courses

  1. Ansible courses typically use a devops user with passwordless sudo ALL=ALL(ALL) access on managed nodes to enable the use of become without a become password as root to do anything.
  2. As much as possible, leave the system-wide default as become: false or become: no and if a single task needs privileges, set become: true or become: yes on that task.
  3. If most tasks in a play needs privileges, set the entire play to become: true or become: yes and possibly selectively set individual tasks to become: false or become: no.

Metadata

Metadata

Assignees

Labels

enhancementWill improve the guide but is not a bug or blocker.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions