vagrant-landrush / landrush

A Vagrant plugin that provides a simple DNS server for Vagrant guests
MIT License
667 stars 78 forks source link

Add `sudoers` rules to README to support passwordless provisioning #190

Closed gretel closed 8 years ago

gretel commented 8 years ago

Automation should not be prevented by having to enter passwords. So i came up with sudoers rules. on OS X. The location of the sudoers.d is a bit cumbersome but i guess the commands itself should be the same on many unices.

sudo visudo -f /private/etc/sudoers.d/vagrant
Cmnd_Alias VAGRANT_LANDRUSH_HOST_MKDIR = /bin/mkdir /etc/resolver/*
Cmnd_Alias VAGRANT_LANDRUSH_HOST_CP = /bin/cp /*/vagrant_landrush_host_config /etc/resolver/*
Cmnd_Alias VAGRANT_LANDRUSH_HOST_CHMOD = /bin/chmod 644 /etc/resolver/*

%admin ALL=(root) NOPASSWD: VAGRANT_LANDRUSH_HOST_MKDIR, VAGRANT_LANDRUSH_HOST_CP, VAGRANT_LANDRUSH_HOST_CHMOD
hferentschik commented 8 years ago

So what you are suggesting is to add something to the README, which suggest a manual sudoer config change, so that from then on onwards using Landrush will never ask for the root password again. Sounds reasonable. We might want to add a FAQ section to the README or maybe a Tip&Tricks section. Have you thought about where you want to put this? Maybe you want to create a pull request with the suggested changes?

That said, I am confused about the location of your sudoer config - /private/etc/sudoers.d/vagrant. This file does not even exist for me. What's about /etc/sudoers? Is that not the file to edit?

gretel commented 8 years ago

@hferentschik having sudoers adjusted is something i have done for quite some plugins - waiting for passwords prevents automated task from running whithout user interaction.

The location of the sudoers.d is a bit cumbersome but i guess the commands itself should be the same on many unices.

i was referring to osx, which i am using. going to PR if my time allows which i doubt unfortunately. regards

hferentschik commented 8 years ago

Resolved by pull request #208