Check for NOPASSWD in sudo configuration can't be disabled

Bug #1741225 reported by Florian Haas
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack-Ansible
Fix Released
Medium
Kevin Carter

Bug Description

If I understand things correctly, then there is currently no way to disable the check for NOPASSWD in the target system's sudo configuration — other than running a playbook with "--skip-tags V-71947".

I think that's questionable if you're running ansible-hardening against a cloud guest instance. Consider an OpenStack guest VM where user accounts simply do not have passwords, and the default user (for example, "ubuntu" on Ubuntu guest systems) is configured with NOPASSWD by default, as per /etc/sudoers.d/90-cloud-init-users.

I guess it's open to debate what's the better option for security here. Sure you could argue that having passwords is better than having none, and you should enforce the "no NOPASSWD" rule by requiring people to set passwords for all those ubuntu users. But considering that cloud instances are usually deployed en masse, my guess is that enforcing sudo passwords would just lead to identical sudo passwords being deployed to a large number of machines. Specifically if those machines are managed with Ansible, where a single playbook run can only do one --ask-become-pass prompt.

Would you accept a patch introducing a security_sudoers_nopasswd_check_enable variable (defaulting to yes, preserving the prior behavior) with an additional condition on that variable applying to the V-71947 tagged tasks?

Revision history for this message
Major Hayden (rackerhacker) wrote :

Nice catch, Florian. Your idea for a patch sounds fine! Thanks for digging into that.

Changed in openstack-ansible:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ansible-hardening (master)

Fix proposed to branch: master
Review: https://review.openstack.org/565959

Changed in openstack-ansible:
assignee: nobody → Kevin Carter (kevin-carter)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ansible-hardening (master)

Reviewed: https://review.openstack.org/565959
Committed: https://git.openstack.org/cgit/openstack/ansible-hardening/commit/?id=1cafaf8cce7c36a1dd568e746d60fb5528285ce2
Submitter: Zuul
Branch: master

commit 1cafaf8cce7c36a1dd568e746d60fb5528285ce2
Author: Kevin Carter <email address hidden>
Date: Thu May 3 00:19:10 2018 -0500

    Add option to skip sudoers NOPASSWD check

    This change adds the option `security_sudoers_nopasswd_check_enable`
    when running check "V-71947". This change allows users to skip this
    check via ansible extra variable instead of having to skip tags. While
    this change has a functional benifit in some environments, it is being
    done with the primary intention of providing a better experience to
    deploying running clouds where services like cloud-init may be present.

    Change-Id: I0d0c95534ace0b00fa64c2f243ad91ce5844d85a
    Closes-Bug: #1741225
    Signed-off-by: Kevin Carter <email address hidden>

Changed in openstack-ansible:
status: In Progress → Fix Released
Revision history for this message
Florian Haas (fghaas) wrote :

Thanks so much for adding this, Kevin!

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/ansible-hardening stein-eol

This issue was fixed in the openstack/ansible-hardening stein-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/ansible-hardening train-eol

This issue was fixed in the openstack/ansible-hardening train-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/ansible-hardening ussuri-eol

This issue was fixed in the openstack/ansible-hardening ussuri-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/ansible-hardening yoga-eom

This issue was fixed in the openstack/ansible-hardening yoga-eom release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/ansible-hardening victoria-eom

This issue was fixed in the openstack/ansible-hardening victoria-eom release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/ansible-hardening wallaby-eom

This issue was fixed in the openstack/ansible-hardening wallaby-eom release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/ansible-hardening xena-eom

This issue was fixed in the openstack/ansible-hardening xena-eom release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.