You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When /bin/sh is Bash then script "</dev/tcp/127.0.0.1/80" works because /dev/tcp/host/port is a special syntax telling Bash to tcp-connect to host:port, however other shells will just try to open /dev/tcp/127.0.0.1/80 as a file and fail.
The samples file should at least warn about this, but ideally it should suggest a different syntax, like (untested):
Issue acassen#1926 identified that
script "</dev/tcp/127.0.0.1/80"
is bash specific, and a vrrp_script using that will fail if /bin/sh
is not Bash.
This commit adds a note to the keepalived.conf.vrrp.localcheck sample
script when using shells other than Bash.
Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
Describe the bug
https://github.com/acassen/keepalived/blob/master/doc/samples/keepalived.conf.vrrp.localcheck has examples showing how to check if a TCP port is open using a
script
, e.g.:however this works only on systems where
/bin/sh
is Bash. This is not the case on many distributions, like: Debian, Ubuntu, and derivatives.This happens because
script
basically passes the script name to stdlib'ssystem()
, which in turn does (seesystem(3)
):When
/bin/sh
is Bash thenscript "</dev/tcp/127.0.0.1/80"
works because/dev/tcp/host/port
is a special syntax telling Bash to tcp-connect tohost:port
, however other shells will just try to open/dev/tcp/127.0.0.1/80
as a file and fail.The samples file should at least warn about this, but ideally it should suggest a different syntax, like (untested):
To Reproduce
Try using the examples in
keepalived.conf.vrrp.localcheck
.Keepalived version
As of today the tip of
master
is affected.Distro (please complete the following information):
The text was updated successfully, but these errors were encountered: