Commit graph

24 commits

Author SHA1 Message Date
Virgil Dupras
97b5882262 Refactoring: make SudoWrapper a bit more self-contained
By looking at the code, it seems that it was a goal to make the sudo
wrapper path configurable through the Vagrantfile, but it wasn't
effective and didn't make much sense (that kind of config is a per-host
config, not a per-guest one).

This caused the cause to be needlessly complex by giving the Provider
the responsibility of instanciating the wrapper. This commit gets rid of
that.

I didn't get rid of `sudo_wrapper` injection in `Driver` and
`Driver::CLI` constructors because they're needed for tests. I'm not
ready to tackle this yet.
2018-01-13 08:32:27 -05:00
Virgil Dupras
d35ee4aed0
Merge pull request #410 from ChaosCloud/abk
vagrant-lxc-wrapper need to allow sudoer first-found binary path
2017-12-11 17:07:21 -05:00
Virgil Dupras
10c53c54d7 Support alternative lxcpath in sudo wrapper
The previously hardcoded lxc path prevented the sudo wrapper from
working in environment with alternative `lxcpath`.

I had to move `sudo_wrapper` from `provider` to `LXC` because the
concept of "provider" is tied to a machine when a command sush as
`sudoers` is not.

Fixes #413 and #399
2017-12-11 11:48:19 -05:00
Frederik Leonhardt
1f805f6deb Update pipework regexp for sudo wrapper
On Vagrant 1.9+ plugin gems are installed into a different folder, their path
containing the ruby version. This updates the regular expression whitelisting
the pipework script to reflect this change.
2017-02-09 15:55:32 +13:00
AbhishekKr
848383e081 vagrant-lxc-wrapper need to allow sudoer first-found binary path
sudoer PATH may have different order than current user
2016-05-11 23:51:29 +05:30
Luke Faraone
05fdb3e000 vagrant-lxc-wrapper: Use correct ruby interpreter
Previously, we hardcoded to using the ruby binary in /opt/vagrant[..].
On some systems, this path is incorrect, so instead we use the
path of the interpreter that is executing the `vagrant lxc sudoers`
command.
2015-03-19 16:22:00 -07:00
Fabio Rehm
447d0dfc42 Experimental support for private networking [GH-298] 2015-01-11 20:59:38 -02:00
Fabio Rehm
8ffc9ef92a Remove version suffix from generated sudoers commands 2014-09-22 23:07:12 -03:00
Fabio Rehm
d0642c95fd command/sudoers: Move wrapper string out to a template and use the full path to the scripts in order to make things work properly across different distros
Closes GH-304
Closes GH-305
2014-07-24 21:58:04 -03:00
Fabio Rehm
09f855dc76 command/sudoers: Remove Cmnd_Alias from sudoers file
Since the wrapper is versioned, we would end up having multiple `LXC`
command aliases, making `sudo` unusable:

```
>>> /etc/sudoers.d/vagrant-lxc-1-0-0-alpha-3-dev: Alias `LXC' already
>>> defined near line 2 <<<
sudo: parse error in /etc/sudoers.d/vagrant-lxc-1-0-0-alpha-3-dev near
line 2
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
```
2014-06-08 23:44:02 -03:00
Fabio Rehm
b4376ef995 command/sudoers: Use Vagrant's ruby for the sudoers file
This makes things work on systems that don't have a global ruby
installation in place and fix GH-289
2014-06-08 23:36:29 -03:00
Fabio Rehm
1cf8ce50e4 command/sudoers: Fix whitelisting to take GH-277 into account 2014-05-12 23:05:42 -03:00
Eric Hartmann
3b311ad840 Fix sudoers for multiple users 2014-04-23 17:49:04 +02:00
Eric Hartmann
2666f9e38d Fix argument parsing 2014-04-23 16:27:33 +02:00
Jef Mathiot
0eae5c0926 Removed unsecure calls to SudoWrapper#su_c. 2014-04-17 12:56:56 +02:00
Jef Mathiot
94e175dc07 sudoers command now creates a safe wrapper script.
Sudoers now creates a safe wrapper script that performs sanity checks on sudo :
* wrapper generated in /usr/local/bin (name includes version to allow multiple wrappers on the same system)
* sudoers command now generates a one-line file in /etc/sudoers.d
* SudoWrapper use the new wrapper
* Removed unused Config#validate method
2014-04-09 15:53:20 +02:00
Fabio Rehm
7e9d790f6a command/sudoers: Minor tweaks to make the generated file work with latest changes 2014-03-27 20:04:38 -03:00
Fabio Rehm
328477172e command/sudoers: Add missing -p to mkdir command 2014-03-24 23:50:38 -03:00
Jef Mathiot
5a56b72360 * Ruby >1.9 hash syntax
* Improved comment on Vagrant::Registry.keys
2014-03-22 00:58:36 +01:00
Fabio Rehm
8b1573c536 doc: Let everyone know about the new vagrant lxc sudoers command 2014-03-21 20:04:35 -03:00
Fabio Rehm
64de0fca3c command/sudoers: Mention what is the default value for the user and add a REFACTOR note 2014-03-21 19:53:49 -03:00
Fabio Rehm
02fefd10c0 command/sudoers: Nitpick
* Use Ruby 1.9+ hash syntax
* Use % as the BOXES placeholder as it is the same symbol used for I18n placeholders as well
2014-03-21 19:48:36 -03:00
Fabio Rehm
19bccc9ca5 ✂️ whitespace 2014-03-21 19:38:56 -03:00
Jef Mathiot
8590c87132 Created an "lxc sudoers" command to create sudoers file for a given user (defaults to current one). 2014-03-16 18:59:18 +01:00