Public bug reported:
The /usr/share/doc/keepalived/samples/keepalived.conf.vrrp.localcheck
sample configuration file shows how to check if a TCP port is open using
a `script`, e.g.:
vrrp_script chk_http_port {
script "</dev/tcp/127.0.0.1/80" # connects and exits
interval 1 # check every second
weight -2 # default prio: -2 if connect fails
}
however this works only on systems where `/bin/sh` is Bash, and
therefore doesn't work on Ubuntu. This happens because `script`
basically passes the script name to stdlib's system(), which in turn
does (see system(3)):
execl("/bin/sh", "sh", "-c", command, (char *) NULL);
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.
As the sample file comes from upstream I filed an upstream issue [1].
Possible workarounds are (warning: untested!):
script "bash -c '</dev/tcp/127.0.0.1/80'"
script "nc -z 127.0.0.1 80"
[1] https://github.com/acassen/keepalived/issues/1926
** Affects: keepalived (Ubuntu)
Importance: Low
Status: Triaged
** Changed in: keepalived (Ubuntu)
Status: New => Triaged
** Changed in: keepalived (Ubuntu)
Importance: Undecided => Low
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1934300
Title:
script "</dev/tcp/127.0.0.1/80" relies on /bin/sh being bash
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/keepalived/+bug/1934300/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs