Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Defaults requiretty" didn't work with Vagrant #101

Closed
ozbillwang opened this issue Mar 5, 2015 · 12 comments
Closed

"Defaults requiretty" didn't work with Vagrant #101

ozbillwang opened this issue Mar 5, 2015 · 12 comments

Comments

@ozbillwang
Copy link
Contributor

The option Defaults requiretty is enabled in both files/sudoers.rhel5 and files/sudoers.rhel6 as default. But when apply this puppet module in Vagrant CentOS 6.5 instance, always get the error:

sudo: sorry, you must have a tty to run sudo

the fix is here: comment it.

This is the explanation:

http://unix.stackexchange.com/questions/122616/why-do-i-need-a-tty-to-run-sudo-if-i-can-sudo-without-a-password
https://bugzilla.redhat.com/show_bug.cgi?id=1020147

Any suggestion that I can still librarian-puppet this module, but get that line commented?

Or could you please comment this line in your code directly?

@ozbillwang
Copy link
Contributor Author

a closed issue has been discussed before (#76)

Seems you insisted not to change. But the fact is, you should comment it out from your code, which default requiretty is problematic and breaks valid usage, confirmed by Redhat.

It is bug and fixed by redhat at March 2014.

* Mon Mar 10 2014 Daniel Kopecek <dkopecek@redhat.com> - 1.8.8-3
- remove bundled copy of zlib before compilation
- drop the requiretty Defaults setting from sudoers

@saz
Copy link
Owner

saz commented Mar 5, 2015

I think, there should be some information in the docs, how to solve this problem, as it is easily solvable without any change in this module.

Maybe you'll got some time to create a pull request?

@ozbillwang
Copy link
Contributor Author

I have raised the pull request. #102

@saz
Copy link
Owner

saz commented Mar 5, 2015

I'm good with the change, but this needs to be addressed in a better way:

  1. remove the line, including any comment. Do not comment them out (especially since the comment is wrong)
  2. remove the lines from all rhel files (5, 6 and 7)

I think this should solve the problem completely.

ozbillwang added a commit to ozbillwang/puppet-sudo that referenced this issue Mar 8, 2015
@ozbillwang
Copy link
Contributor Author

My latest pull request has been passed the validation. Waiting for the merge.

@ozbillwang
Copy link
Contributor Author

@saz , any updates for my pull request?

@ozbillwang
Copy link
Contributor Author

For anyone who stuck with this issue, and still waiting the pull request to be merged. Run below command in your Vagrantfile, it will bypass this issue.

config.vm.provision "shell", :inline => "echo 'Defaults:vagrant !requiretty' >>  /etc/sudoers.d/vagrant"

@bkc1
Copy link

bkc1 commented Apr 29, 2015

This requiretty/vagrant issue is a major pain. I am still a puppet novice but the saz-sudo module looks to be one of the better forge module options that has with Hiera capability. Could a true/false parameter be added in enable/disable(comment out) requiretty for Centos/RHEL flavors?

the following doesn't seem to work for me:
config.vm.provision "shell", :inline => "echo 'Defaults:vagrant !requiretty' >> /etc/sudoers.d/vagrant"

@vindir
Copy link
Contributor

vindir commented May 13, 2015

This is pretty easy to fix by adding an entry overriding the default. Something like the below makes it a non-issue when added to hieradata or done via the manifest itself.

sudo::configs:
    'requiretty':
        'content'   : "Defaults   !requiretty"
    'visiblepw':
        'content'   : "Defaults   visiblepw"

via the manifest it just becomes:

    class { 'sudo': }
    sudo::conf { 'requiretty':
      content  => "Defaults   !requiretty"
      priority => 10,
    }
    sudo::conf { 'visiblepw':
      content  => "Defaults   visiblepw"
      priority => 10,
    }

@vindir
Copy link
Contributor

vindir commented May 13, 2015

Also worth noting... if this issue is resolved, it should probably remove the !visiblepw default entries in all of the centos files as well since they are related configs.

@ozbillwang
Copy link
Contributor Author

@vindir
Good work, anyway, it is better solution than mine.

@saz
Copy link
Owner

saz commented Jun 4, 2015

This should be fixed in the current master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants