Hello all,
I am stress testing my HAProxy setup and i noticed that my backend IP is exposed! When i make same test to my nginx proxy the IP addresses is not shown to my stress tool. Is it by design or its my configuration mistake ?
I am proxying my another nginx installation with HAProxy.
echo “GET http://Frontend IP:8088/app_api.php” | vegeta -cpus=4 attack -connections=1000000 -timeout=2m -rate=30000 -workers=50 | tee results.bin | vegeta report
^CRequests [total, rate] 14470, 3902.70
Duration [total, attack, wait] 4.036639963s, 3.707685559s, 328.954404ms
Latencies [mean, 50, 95, 99, max] 20.845444ms, 0s, 0s, 272.588244ms, 4.021258059s
Bytes In [total, mean] 15390, 1.06
Bytes Out [total, mean] 0, 0.00
Success [ratio] 0.00%
Status Codes [code:count] 0:14350 404:30 429:90
Error Set:
Get http://Frontend IP:8088/app_api.php: dial tcp: lookup p1.dtv.sx on 127.0.0.53:53: no such host
Get http://Frontend IP:8088/app_api.php: dial tcp: lookup p1.dtv.sx on 127.0.0.53:53: dial udp 127.0.0.53:53: socket: too many open files
404 Not Found
429 Too Many Requests
Get http://Frontend IP:8088/app_api.php: dial tcp 0.0.0.0:0->Backend IP:8088:8000: socket: too many open files
Get http://Frontend IP:8088/app_api.php: dial tcp 0.0.0.0:0->Backend IP:8088:8000: connect: connection refused
HAProxy Configuration;
global
nbproc 1
nbthread 4
cpu-map auto:1/1-4 0-3
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
stats timeout 30s
user haproxy
group haproxy
daemon
maxconn 1000000
# Default SSL material locations
ca-base /etc/ssl/certs
crt-base /etc/ssl/private
# Default ciphers to use on SSL-enabled listening sockets.
# For more information, see ciphers(1SSL). This list is from:
# https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
# An alternative list with additional directives can be obtained from
# https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=haproxy
ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS
ssl-default-bind-options no-sslv3
defaults
log global
mode http
option httplog
option dontlognull
retries 3
#option forwardfor
option http-server-close
option redispatch
option http-buffer-request
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
maxconn 300000
backend per_ip_rates
stick-table type ip size 1m expire 10m store http_req_rate(10s)
frontend fe1
bind :8088
mode http
http-request track-sc0 src table per_ip_rates
http-request deny deny_status 429 if { sc_http_req_rate(0) gt 100 }
reqidel ^X-Forwarded-For:.*
default_backend backend_servers
backend backend_servers
mode http
balance roundrobin
option httpchk
server domain1 backendIP check port 80
listen stats
bind :19090
stats enable
stats hide-version
stats refresh 10s
stats show-legends
stats realm HAProxy\ Statistics
stats show-node
stats auth
stats uri /
HAProxy -vv ;
HA-Proxy version 1.9.6-1ppa1~bionic 2019/03/30 - https://haproxy.org/
Build options :
TARGET = linux2628
CPU = generic
CC = gcc
CFLAGS = -O2 -g -O2 -fdebug-prefix-map=/build/haproxy-YXfmbO/haproxy-1.9.6=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fno-strict-aliasing -Wdeclaration-after-statement -fwrapv -Wno-format-truncation -Wno-unused-label -Wno-sign-compare -Wno-unused-parameter -Wno-old-style-declaration -Wno-ignored-qualifiers -Wno-clobbered -Wno-missing-field-initializers -Wno-implicit-fallthrough -Wno-stringop-overflow -Wtype-limits -Wshift-negative-value -Wshift-overflow=2 -Wduplicated-cond -Wnull-dereference
OPTIONS = USE_GETADDRINFO=1 USE_ZLIB=1 USE_REGPARM=1 USE_OPENSSL=1 USE_LUA=1 USE_SYSTEMD=1 USE_PCRE2=1 USE_PCRE2_JIT=1 USE_NS=1
Default settings :
maxconn = 2000, bufsize = 16384, maxrewrite = 1024, maxpollevents = 200
Built with OpenSSL version : OpenSSL 1.1.0g 2 Nov 2017
Running on OpenSSL version : OpenSSL 1.1.0g 2 Nov 2017
OpenSSL library supports TLS extensions : yes
OpenSSL library supports SNI : yes
OpenSSL library supports : TLSv1.0 TLSv1.1 TLSv1.2
Built with Lua version : Lua 5.3.3
Built with network namespace support.
Built with transparent proxy support using: IP_TRANSPARENT IPV6_TRANSPARENT IP_FREEBIND
Built with zlib version : 1.2.11
Running on zlib version : 1.2.11
Compression algorithms supported : identity(“identity”), deflate(“deflate”), raw-deflate(“deflate”), gzip(“gzip”)
Built with PCRE2 version : 10.31 2018-02-12
PCRE2 library supports JIT : yes
Encrypted password support via crypt(3): yes
Built with multi-threading support.
Available polling systems :
epoll : pref=300, test result OK
poll : pref=200, test result OK
select : pref=150, test result OK
Total: 3 (3 usable), will use epoll.
Available multiplexer protocols :
(protocols marked as cannot be specified using ‘proto’ keyword)
h2 : mode=HTX side=FE|BE
h2 : mode=HTTP side=FE
: mode=HTX side=FE|BE
: mode=TCP|HTTP side=FE|BE
Available filters :
[SPOE] spoe
[COMP] compression
[CACHE] cache
[TRACE] trace
Thanks!
Talion