TheKevJames / puppet-homebrew

homebrew (+brewcask! +taps!) package installer and provider
https://forge.puppet.com/thekevjames/homebrew
Apache License 2.0
18 stars 44 forks source link

Unable to install java8 due to sudo asking for password #106

Closed forsberg closed 6 years ago

forsberg commented 6 years ago

Tried the following manifest


package { 
   'caskroom/versions':
       provider => tap;
} -> package {
  'java8':
       provider => brew;
}

This fails with exit code 1 which I found out, after some debugging, is due to brew running the MacOS installer via sudo, and sudo is asking for the password of the main user (which have admin rights).

The silly thing here is that puppet runs as root (via sudo), then puppet-homebrew changes back uid to the main user to run brew, and then sudo fails to regain root permissions to install the java .pkg.

Obviously, this is quite specific to the java8 formulae, but nevertheless, it would be good if homebrew could somehow trick sudo into understanding that it stored the credentials for the main user just a few seconds ago, and hence should be able to run the package install as root. On the other hand, this could be seen as dangerous, security-wise, I don't know.
TheKevJames commented 6 years ago

I'm sorry, but I don't think there's anything we can do about this -- the old workaround used to be to run homebrew as root, but they removed that capability a couple years back (see #40 for discussion).

You might have some luck tuning how long sudo keeps you authenticated, but of course that doesn't work very well for un-managed Puppet usage.

I'm going to close this as wontfix, but if you (or anyone else) comes up with a way to support this workflow, I'd be happy to review&merge&release.