HAProxy

Product description

HAProxy is free, open source software that provides a high availability load balancer and proxy server for TCP and HTTP-based applications that spreads requests across multiple servers.

For TKU November 2021 support for TLS Certificates discovery was added. (DRDC1-16963)

TLS Certificate Detail node will be linked to related Load Balancer Service node.


Architecture

HAProxy  uses the following conceptual model:

  • Frontend instance (n) <-> (n) Backend instance <-> (n) Server
    or
  • Listen instance (n) <-> (n) Server

This model translates into the BMC Discovery load balancer model:

  • Frontend instance -> Load Balancer Service
  • Listen instance -> Load Balancer Service and Load Balancer Pool
  • Backend instance -> Load Balancer Pool
  • Server -> Load Balancer Member

Load Balancer Model

 

The HAProxy_LoadBalancer pattern builds the BMC Discovery load balancer model based on additional details obtained via ssh.

All the information about configured elements is obtained from the main configuration file haproxy.cfg (location is obtained from the main process arguments)

The HAProxy software loadbalancer is modeled as a Software Instance  linked to a Load Balancer Instance.


HAProxy3.png

Triggers


PatternTrigger NodeAttributeConditionArgument
HAProxy_LoadBalancerDiscoveredProcesscmdmatchesunix_cmd "haproxy"


Versioning

Active

HAProxy_LoadBalancer pattern will run "haproxy -v" command

Package

HAProxy_LoadBalancer pattern will look for the package matching regex "haproxy$"

Modeled Components

Software Instance

The pattern creates a Software Instance with the following attributes:

AttributesValue
keyA hash of the host key and load balancer type.
typeA software instance  type.
nameA %si_name% %product_version% on %host.name%.
versionA version of the software instance.

Load Balancer Instance

The pattern creates a Load Balancer Instance with the following attributes:

AttributesValue
keyA hash of the device key and load balancer type.
typeA load balancer type.
nameA %LB_TYPE% on %host.name%.
versionA version of the software instance.

The pattern models a network service relationship between the Software Instance and the Load Balancer Instance.

Load Balancer Service

The pattern creates a Load Balancer Service with the following attributes:

AttributesValue
key

A hash of the front end or listen node name , ip address, and port.

nameA front end or listen node name.
ip_addrA front end or listen node IP address.
portA front end or listen node port.
protocolA front end or listen node protocol type.
stateA front end or listen node state.
dns_namesA dns name of a front end or listen node IP address.
_config_hashContains a hash of the front end or listen node name, IP address, port, ,protocol.

The pattern models a containment relationship between the Load Balancer Instance and a Load Balancer Service.

The pattern also models a containment relationship between the Load Balancer Service and a Load Balancer Pool.

Load Balancer Pool

The pattern creates a Load Balancer Pool with the following attributes:

AttributesValue
keyA hash of the backend or listen name and host key.
nameA pool name.
protocol

A protocol used.

algorithmA algorithm used.
_config_hashContains a hash of the pool name, state mode  and algorithm.

The pattern models a containment relationship between the Load Balancer Instance and a Load Balancer Pool.

Load Balancer Member

The pattern creates a Load Balancer Member  for every server and populates the following attributes:

AttributesValue
key

A hash name, IP address and port of the real server.

ip_addrA server IP address.
portA server port.
nameA server name.

The pattern models a containment relationship between the Load Balancer Pool and a Load Balancer Member.

TLS Certificates

HAProxy_LoadBalancer pattern will read haproxy.cfg file to get ssl_tcp_socket to pass to the command:

which openssl > /dev/null 2>&1 && echo | openssl s_client -connect %listen_ssl_tcp_socket% | openssl x509 -inform pem -noout -nameopt oneline -subject -startdate -enddate -issuer -fingerprint -sha256 -serial -text

In case multiple .pem files per one socket detected, those files will be passed to the following command:

which openssl > /dev/null 2>&1 && echo | PRIV_RUNCMD openssl x509 -inform pem -noout -nameopt oneline -subject -startdate -enddate -issuer -fingerprint -sha256 -serial -text -in %esc_pem_file%

If certificate files failed to be read then the related socket will be passed to the first command and only one TLS Certificate per socket will be modeled.

Please note that second command won't reveal certificate keys and will be executed with sudo option hence Discovery user should be added into sudoers file with sufficient privileges.

To avoid any unwanted insecure execution of the second command the following code may be added to your sudoers file:

Cmnd_Alias LSCERT=\
/usr/bin/openssl x509 -inform pem -noout -nameopt oneline -subject -startdate -enddate -issuer -fingerprint -sha256 -serial -text -in /*,\
!/usr/bin/openssl x509 -inform pem -noout -nameopt oneline -subject -startdate -enddate -issuer -fingerprint -sha256 -serial -text -in /* *,\
!/usr/bin/openssl x509 -inform pem -noout -nameopt oneline -subject -startdate -enddate -issuer -fingerprint -sha256 -serial -text -in /..

DiscoveryUser ALL=(root) NOPASSWD: LSCERT


Modeled TLS Certificate Detail node will be linked to related LB Service node.

Related topics:

TLS Certificates Discovery for Unix


Was this page helpful? Yes No Submitting... Thank you

Comments