Bug 1667292

Summary: vrrp_script broken from v1.3.0 with syntax "</dev/tcp/127.0.0.1/22"
Product: Red Hat Enterprise Linux 7 Reporter: Sangam <sababu>
Component: keepalivedAssignee: Ryan O'Hara <rohara>
Status: CLOSED ERRATA QA Contact: Brandon Perkins <bperkins>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.3CC: cfeist, cluster-maint, jomurphy
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: keepalived-1.3.5-16.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1699041 (view as bug list) Environment:
Last Closed: 2019-08-06 13:13:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1699041    

Description Sangam 2019-01-18 03:00:40 UTC
Description of problem:

 vrrp_script broken from v1.3.0 when we try to verify local port with "</dev/tcp/127.0.0.1/22"

Version-Release number of selected component (if applicable):
Starting keepalived v1.3.0


How reproducible:
We can reproduce with a normal keepalived setup with a vrrp_script to check a local port "22" using the below syntax.

vrrp_script chk_sshd {
       script "</dev/tcp/127.0.0.1/22"
}



Steps to Reproduce:
1. Configure keepalived with vrrp_script as shown above.
2. start keepalived, vrrp_script fails.
3.

Actual results: Vrrp_script fails and gets disabled.


Expected results: vrrp_script should succeed.


Additional info:
Keepalived configuration
========================
[root@keepalived-master keepalived]# cat keepalived.conf
! Configuration File for keepalived
vrrp_script chk_sshd {
       script "</dev/tcp/127.0.0.1/22"
}

vrrp_instance VI_1 {

    state MASTER
    interface ens12
    virtual_router_id 80
    smtp_alert
    priority 110
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 056282
    }
    virtual_ipaddress {
        192.168.101.200/24 dev ens12
    }
    track_script {
     chk_sshd
    }
}



Logs showing failure
=====================
Jan 15 12:19:34 keepalived-master systemd[1]: Stopping LVS and VRRP High Availability Monitor...
Jan 15 12:19:34 keepalived-master Keepalived_vrrp[3672]: VRRP_Instance(VI_1) sent 0 priority
Jan 15 12:19:34 keepalived-master Keepalived_vrrp[3672]: VRRP_Instance(VI_1) removing protocol VIPs.
Jan 15 12:19:35 keepalived-master systemd[1]: Starting LVS and VRRP High Availability Monitor...
Jan 15 12:19:35 keepalived-master systemd[1]: PID file /var/run/keepalived.pid not readable (yet?) after start.
Jan 15 12:19:35 keepalived-master Keepalived[3699]: Starting Healthcheck child process, pid=3700
Jan 15 12:19:35 keepalived-master Keepalived[3699]: Starting VRRP child process, pid=3701
Jan 15 12:19:35 keepalived-master systemd[1]: Started LVS and VRRP High Availability Monitor.
Jan 15 12:19:35 keepalived-master Keepalived_healthcheckers[3700]: Initializing ipvs
Jan 15 12:19:35 keepalived-master Keepalived_healthcheckers[3700]: Opening file '/etc/keepalived/keepalived.conf'.
Jan 15 12:19:35 keepalived-master Keepalived_vrrp[3701]: Registering Kernel netlink reflector
Jan 15 12:19:35 keepalived-master Keepalived_vrrp[3701]: Registering Kernel netlink command channel
Jan 15 12:19:35 keepalived-master Keepalived_vrrp[3701]: Registering gratuitous ARP shared channel
Jan 15 12:19:35 keepalived-master Keepalived_vrrp[3701]: Opening file '/etc/keepalived/keepalived.conf'.
Jan 15 12:19:35 keepalived-master Keepalived_vrrp[3701]: WARNING - default user 'keepalived_script' for script execution does not exist - please create.
Jan 15 12:19:35 keepalived-master Keepalived_vrrp[3701]: Unable to access script ``</dev/tcp/127.0.0.1/22``
Jan 15 12:19:35 keepalived-master Keepalived_vrrp[3701]: Disabling track script chk_sshd since not found
Jan 15 12:19:35 keepalived-master Keepalived_vrrp[3701]: VRRP_Instance(VI_1) removing protocol VIPs.

NOTE :    If we use 'bash -c /dev/tcp/127.0.0.1/22' it works with v1.3.0 as well. However the documentation refers to the above syntax. 

     It seems to be fixed upstream, please refer below.

https://github.com/acassen/keepalived/commit/5cd5fff78de11178c51ca245ff5de61a86b85049

     Its easily reproducible locally with the above configuration.

Comment 8 Ryan O'Hara 2019-06-14 17:21:18 UTC
Modified the patch to fix uninitialized variable that was causing segfault. Should be working now.

Comment 12 errata-xmlrpc 2019-08-06 13:13:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:2285