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

No support for sudo #8

Closed
skx opened this issue Sep 7, 2018 · 2 comments · Fixed by #11
Closed

No support for sudo #8

skx opened this issue Sep 7, 2018 · 2 comments · Fixed by #11
Assignees
Labels
question Further information is requested

Comments

@skx
Copy link
Owner

skx commented Sep 7, 2018

We connect as one user - often root - and have no facility for doing things as other users. Short of the obvious:

Run "su - nobody -s /bin/sh -c /usr/bin/id"

It might be nice to allow "Sudo" as an alternative to "Run". Of course if we're prompted for a password it become complex again, quickly..

If we do go down this road we'd need:

  • Sudo "command"
  • SudoIfChanged "command"

At that point it might be worth taking a step back and removing IfChanged, instead adding If support. So we could just run:

if ( CopyFile .... )  {
   Run "blah"
   Sudo "blah"
}

Of course that's a slippery slope, but perhaps one worth sliding down. Comments welcome.

@skx skx self-assigned this Sep 7, 2018
@skx skx added the question Further information is requested label Sep 7, 2018
@bastiao
Copy link

bastiao commented Sep 8, 2018

It may be a nice idea to have the "Sudo" command. If it is detected in the recipe, it will be nice ask at first time, in beginning, and execute the sudo commands by that shell, when it is needed. I did not check how it is currently implemented - so I don't have any clue.

Anyway ask the password, does not allow to automatize scripts and may be only useful in very narrow use cases.

Another nice features - a bit of topic here:

  • it is to have the capability to have few documentation to use deployr in other Go applications.
  • is supports to pass the -i in "ssh" for the private key (could be different in some use cases)

Overall, the goals of the tool are nice.

@skx
Copy link
Owner Author

skx commented Sep 12, 2018

I think it should be possible for me to detect ahead of execution if the use of Sudo is present. I'll aim to implement that shortly.

As for use via go-programs, I think that the godoc should be readable, but I suspect I'm not really suited to being used directly by other utilities. You can see cmd_run.go has the setup of a deployment - it's a little longer than it should be as it has to sort out:

  • lexer
  • parser
  • evaluator

If people do want to drive the packages via their code I'd support it to the extent that bug-reports come in.

Your idea of allowing ssh -i .. (i.e. non-hardwired public-key) is good. Will report a separate bug to handle that, and ssh-agent, shortly.

Apologies for the delay I've been traveling :)

@skx skx closed this as completed in #11 Sep 12, 2018
skx added a commit that referenced this issue Sep 12, 2018
Add support for Sudo, which closes #8.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants