-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Ability to configure shells for health check scripts #1358
Comments
Is this currently included in any released version? Had problems with this while playing with consul Took me a while to figure out. Thing is, the docs mention that:
|
Hi @skiold not yet - there's an open PR for this that we will review when we get a chance. |
https://www.consul.io/docs/agent/checks.html would imply that the script check is useful places other then docker. But without being able to set the shell away from /bin/false I don't see how this is true. In the meantime until this is fixed the documentation should be changed to note that script checks are only supported on docker. |
@tahoemph you are correct. We only show it in the Docker example, but it isn't called out very specifically. We can update the docs to reflect this. |
This becomes especially important as systemd in newer versions enforces SHELL with the User= parameter: https://github.com/systemd/systemd/blob/master/NEWS#L3413-L3414 And as system users (like a consul user) are usually setup with /sbin/nologin as a shell, this makes consul now picking up nologin as the shell. Resulting in failure of every check-cmd. So either you setup the system user with /bin/bash as a shell or you should be able to set it to something different within consul (globally would also be nice). Or consul should ignore SHELL's like nologin. |
Right now Consul cannot run as a pseudo-user with a bogus shell (e.g. It's not clear to me why the check command shouldn't be passed directly as args to execve(). Consider using https://github.com/mattn/go-shellwords to parse the arguments. |
ended up setting the SHELL variable in /etc/default/consul |
And we should keep it in mind that the
|
The issue mentioned by @duritong led to long troubleshooting for us when script checks that were working on all existing machines did not work on new ones (which had a slightly newer systemd). |
@carlpett you can always wrap it in |
Ah. Of course. Bit slow today :) |
Why not just make consul execute the script as god intended so the kernel could properly use shebang? Passing everything through shell is what made the bash vulnerability (shell shock) so dangerous. |
As some have suggested here I'm thinking we should drop the shell entirely and just exec the command. It's easy enough to run |
@slackpad your comment aligns with a recent breaking change in consul-template v0.18.0
|
Closing this as a duplicate of #2999. |
I couldn't run script health check because of the nologin shell. I have a simple health check of reading a file for status. However I am getting error saying "This account is currently not available" which is a linux level error. We have version 0.6.4. If I change the shell to bash its working perfectly. I tried few options, but would be great if someone can provide me a hack. Appreciate your help |
Users should be able to configure the shell for individual script based checks. Currently they default to
/bin/sh
or$SHELL
for all the script checks on a node.The text was updated successfully, but these errors were encountered: