-
Notifications
You must be signed in to change notification settings - Fork 295
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
Add "sudo" option to link
plugin
#125
Comments
link
plugin
The idea sounds good! Having a
|
Great!
According to the
So I think the password should be asked by
Yeah sure. Just to let you know I'm not used to code in Python, but I'm rigorous in my work and I love to learn. I will try my best and will submit a PR. |
|
I personally think that shelling out is not a good practice. Likewise running dotbot as a super user or making system config's symbolic links somewhere in the a user's home directory is a terrible idea. In issue #128 I suggest to mimic the options for the I'll reflect upon this subject, and I'll look around to find out how to achieve this with syscalls and subprocess privileges. (However, I'm not a programmer ...) Please let me hear your thoughts. |
+1 |
I encourage users to manage Still it would be cool indeed if Dotbot could drop privileges and change file attributes without shelling out. |
Using this ugly line now 😭 |
@ShikherVerma i'd use |
I have nothing against adding some kind of |
@anishathalye you are welcome to take inspiration from my dotbot-yum plugin where I implemented a "sudo: true" param - https://gitlab.com/flyingchipmunk/dotbot-yum edit: ah scratch that just went and looked at link.py, it's using os.symlink(...), not easy to shoehorn sudo in there. Maybe an option for folks is to have a different install_links.conf.yaml with only the link directives and sudo dotbot -c install_links.conf.yaml That way the security is handled by the os layer instead of managing it in link.py |
Ok, does somebody want a separate plugin that will do link with sudo rights? It would add a keyword, say, Most probably there will be a need to shell out though if the password is prompted on Python side and passed via STDIN the whole thing should be more or less secure. |
We can even include such functionality in Dotbot core, as long as we have some reasonable way to do it. I don't think there's too much to worry about security: everything in this scenario is trusted (Dotbot + everything else in your dotfiles). Also, it's fine to have it start out as a plugin, and if there's interest, we can merge it into core at some point. |
Good point! I'll do my best to squeeze out some time to make a pilot version of a plugin. I'll let you know when there will be something. |
@anishathalye Can you clarify what the major hurdle is for implementing this functionality into core? You mention implementing it in a "reasonable" way a couple of times. Can you clarify what that means? To answer the questions you asked... 1. When would the user enter the password?Without too much thought here, I would imagine this would happen when the code first encounters a In 99% of the cases, the user would just have to enter the password one time because, according to the sudo man page...
which is well beyond the time it would take to execute the entire program (and, if not, the user will just have to enter it a second time if sudo is needed again). Is there something that I'm missing here that makes this more complicated? 2. Would you be interested in implementing this?Yep, very much so. Only interested if this goes directly into core though. Not a plugin. |
I don't really have a set of rules that I can write down to explain what I mean by "reasonable" implementation. One example of something that I think won't be good enough is shelling out to |
Fair enough. Thanks for chiming back. Might take a stab at this either this weekend or next if time allows. (unless @ddnomad has already got something together that satisfies those provisions). |
@dsifford mine version is just a sketch right now and I do shell out. Thus you definitely can take a stab yourself. |
@ddnomad @anishathalye Gonna unfortunately tap out of this one. Ergonomics are too weird to contribute. I really don't want to install vagrant just to run tests (though, I do appreciate the reason it's being used -- encapsulation). I still think that simply adding a "sudo" field that accepts a boolean that, when true, runs |
@dsifford That would need special configuration for windows users though as people might use dotbot for non-unix/linux OS'. |
@sirwindfield Why would windows users even use the |
No idea, aren't there protected directories too? o.O Anyway, I just had a small idea. Maybe link each normal file first and after that, re-run the script (automatically) passing it a flag like |
Just came across this issue, this is something I've been looking for ever since I've started using Definitely keeping an eye on this one! |
Isn't this a security issue? Linking a system file to a user-writable target would let any process running as that user change the file, which kind of defeats the purpose of having system files in the first place. For some files (e.g. systemd unit overrides) this would effectively allow the user to run arbitrary processes at root, without even noticing. Personally I use - shell:
- command: sudo -n install -D -m644 systemd/timesyncd.conf /etc/systemd/timesyncd.conf
stderr: true
|
I actually want those systemd overrides. In this case, one would also need to Using I used to |
any news on this? |
I think the See these files: install-sudo, install.sudo.conf.yaml, and install.conf.yaml |
Yeah, I think that's the recommended approach, at a high level. Have two separate You could use variations of that, e.g. having an |
I honestly didn't even thinking about having the |
Hi, |
You could add it to the plugins list for extra visibility. |
Added some plugins to the plugin list :) |
I know this is really outdated, but the new install scripts solve this problem by allowing you to add |
Dotbot is used by multiple users — including me — to symlink files in folders that need
root
privileges.It would be nice to add an option (just like
path
orcreate
) to thelink
plugin to describe if the target needs to be symlinked withroot
privileges. We could name this optionsudo
orroot
.For example:
Running
./install
would create two symlinks:/etc/some/restricted/path/whatever.conf
created asroot
~/.vimrc
created as regular current userIf you prefer to keep Dotbot simple, we could create a plugin that extends the
link
plugin.The text was updated successfully, but these errors were encountered: