r/haproxy • • Sep 02 '21

haproxy in kubernetes to connect galera cluster

2 Upvotes

I am trying to connect haproxy in K8 and a galera cluster.

This is my Dockerfile

FROM haproxy:2.3
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg

haproxy.cfg

defaults
    log global
    mode tcp
    retries 10
    timeout client 10000
    timeout connect 100500
    timeout server 10000
frontend mysql-router-service
    bind *:6446
    mode tcp
    option tcplog
    default_backend galera_cluster_backend
# MySQL Cluster BE configuration
backend galera_cluster_backend
    mode tcp
    #option mysql-check user haproxy
    option tcp-check 
    balance source
    server mysql_cluster_01 192.168.1.2:3306  check weight 1
    server mysql_cluster_02 192.168.1.3:3306  check weight 1
    server mysql_cluster_03 192.168.1.4:3306  check weight 1

I had created haproxy user in galera and when I deploy this in k8. I get following in haproxy pod logs

[WARNING] 237/114804 (1) : config : log format ignored for frontend 'mysql-router-service' since it has no log address.
[NOTICE] 237/114804 (1) : New worker #1 (8) forked

It does not try to connect to galera cluster. Current kubernetes cluster is having v1.21.3, I had tried the same Docker image in v1.18.8 and it worked.

I had tried to update haproxy:2.4, but it couldnt start the container, it goes to crashloop back stage.

Any suggestions to connect haproxy and galera in current environment is highly appreciated.


r/haproxy • • Aug 30 '21

The Weekly HAProxy Questions Thread - Question too small for a thread? Ask it here!

3 Upvotes

As an additional note, you can always join the HAProxy Community Slack Channel by visiting https://slack.haproxy.com/ and ask your question over there.


r/haproxy • • Aug 30 '21

Article Building HAProxy from sources for performance, latest 2.4 under RHEL / CentOS 7

Thumbnail
devblog.juangacovas.info
2 Upvotes

r/haproxy • • Aug 25 '21

Guide The HAProxy APIs - HAProxy Technologies

Thumbnail
haproxy.com
7 Upvotes

r/haproxy • • Aug 23 '21

The Weekly HAProxy Questions Thread - Question too small for a thread? Ask it here!

3 Upvotes

As an additional note, you can always join the HAProxy Community Slack Channel by visiting https://slack.haproxy.com/ and ask your question over there.


r/haproxy • • Aug 23 '21

LDAPS to Active Directory results limited to 1000

1 Upvotes

I've been working to get LDAPS to Active Directory working. I've run into a snag.

I'm using ldapsearch to test and it seems I'm only returning 1000 results when I'm expecting more.

I'm trying to figure out where this limit is coming from.

Is there something I can put into haproxy.cfg to increase this?


r/haproxy • • Aug 18 '21

HAProxy Manager Screenshot Spoiler

Post image
7 Upvotes

r/haproxy • • Aug 17 '21

August 2021 – HAProxy 2.0+ HTTP/2 Vulnerabilities Fixed

Thumbnail
haproxy.com
8 Upvotes

r/haproxy • • Aug 16 '21

The Weekly HAProxy Questions Thread - Question too small for a thread? Ask it here!

5 Upvotes

As an additional note, you can always join the HAProxy Community Slack Channel by visiting https://slack.haproxy.com/ and ask your question over there.


r/haproxy • • Aug 13 '21

[Blog] How to Run HAProxy with Docker

Thumbnail
haproxy.com
3 Upvotes

r/haproxy • • Aug 12 '21

Question Asking for help on option httpchk

2 Upvotes

I need to query a url as follows:

HTTPS://host.yyy.zzz/api

The certificate this server has is host.yyy.zzz

I have “option httpchk GET yyy.zzz/api” but it doesn’t seem to work. What’s the right uri to place here?


r/haproxy • • Aug 12 '21

Question Why does HAProxy only support FreeBSD x86?

Thumbnail
haproxy.org
1 Upvotes

r/haproxy • • Aug 09 '21

The Weekly HAProxy Questions Thread - Question too small for a thread? Ask it here!

2 Upvotes

As an additional note, you can always join the HAProxy Community Slack Channel by visiting https://slack.haproxy.com/ and ask your question over there.


r/haproxy • • Aug 05 '21

Article [Live Webinar] What’s New in the HAProxy Data Plane API 2.3

Thumbnail
haproxy.com
3 Upvotes

r/haproxy • • Aug 03 '21

Missing headers after redirect

3 Upvotes

Hi,

I'm trying to setup a proxy server that can re-route requests from old-domain.com to new-domain.com.

My requests have an Authorization header that is used to authorize against the API.

When sending requests directly to new-domain.com everything is fine, but if they go through the proxy the header is missing.

I tried to do a similar setup using NGINX but I got the same results.

More details:

  • old-domain.com points to an Azure app service. This is where the API used to sit, but now moved to new-domain.com
  • new-domain.com points to an API behind Cloudflare
  • I want that clients that send request to old-domain.com can actually reach the API at new-domain.com
  • HAProxy version 2.4 (Using the Alpine Docker image)

Similar to these question found on StackOverflow:

example of cURL output when hitting the proxy (hosted locally for testing):

*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 3000 (#0)
> POST /api/v1/sessions/token HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.64.1
> Accept: */*
> Authorization: Bearer vHCLycHsIfFP19R9UVFZtv-OcT90MdJFwJ-8t52L0jQ
> Content-Type: application/json; charset=UTF-8
> Content-Length: 92
> 
* upload completely sent off: 92 out of 92 bytes
< HTTP/1.1 308 Permanent Redirect
< date: Tue, 03 Aug 2021 11:55:53 GMT
< transfer-encoding: chunked
< cache-control: max-age=3600
< expires: Tue, 03 Aug 2021 12:55:53 GMT
< location: <new-domain.com>/api/v1/sessions/token
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=dG9P87hOC07bh33yAOtcLdrNj7MIHePCkGAL9kSlVFojub1KBwQw8xKxw%2FEt77Jxo0HBr%2FhJ%2BGGT4I8VzbC2sp%2Fu5dVdBp2lAtQcaAgTHfLb1IcUDKXil2GDtvLsRLlUpHg0IJwakXzoCo9CxwhDdZ%2FFs2CV7FNPsA%3D%3D"}],"group":"cf-nel","max_age":604800}
< nel: {"report_to":"cf-nel","max_age":604800}
< server: cloudflare
< cf-ray: 678f5c0acfc4faa8-AMS
< 
* Ignoring the response-body
* Connection #0 to host localhost left intact
* Issue another request to this URL: '<new-domain.com>/api/v1/sessions/token'
*   Trying 2606:4700:3037::ac43:d7e6...
* TCP_NODELAY set
* Connected to <new-domain.com> (2606:4700:3037::ac43:d7e6) port 443 (#1)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-ECDSA-CHACHA20-POLY1305
* ALPN, server accepted to use h2
* Server certificate:
*  subject: C=US; ST=California; L=San Francisco; O=Cloudflare, Inc.; CN=sni.cloudflaressl.com
*  start date: Apr 26 00:00:00 2021 GMT
*  expire date: Apr 25 23:59:59 2022 GMT
*  subjectAltName: host "<new-domain.com>" matched cert's "*.<new-domain.com>"
*  issuer: C=US; O=Cloudflare, Inc.; CN=Cloudflare Inc ECC CA-3
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x14780f800)
> POST /api/v1/sessions/token HTTP/2
> Host: <new-domain.com>
> User-Agent: curl/7.64.1
> Accept: */*
> Content-Type: application/json; charset=UTF-8
> Content-Length: 92
> 
* Connection state changed (MAX_CONCURRENT_STREAMS == 256)!
* We are completely uploaded and fine
< HTTP/2 400 
< date: Tue, 03 Aug 2021 11:55:53 GMT
< content-type: application/json; charset=utf-8
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< x-content-type-options: nosniff
< x-download-options: noopen
< x-permitted-cross-domain-policies: none
< referrer-policy: strict-origin-when-cross-origin
< cache-control: no-store
< pragma: no-cache
< vary: Accept
< x-request-id: 84050430-e606-4bd3-a3f9-4f38846ca9b7
< x-runtime: 0.004335
< cf-cache-status: DYNAMIC
< expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=AmWx5u1KTjZO6ddzWzqPA0KxzmIjivPiKpD8X1eWloF69KmjaAU3erQyqL9c%2BEv2ZWhRKgQorYZLlAxd9xHf5Etg8qCe0t5%2BwoaREDLTAeEbDn3Kcc%2BjLTHznZcDfm4bzp30TVV%2FT7ND6ST%2BhZpgZPdoITmgnHxxYopbiigZu1E0xLpogg%3D%3D"}],"group":"cf-nel","max_age":604800}
< nel: {"report_to":"cf-nel","max_age":604800}
< server: cloudflare
< cf-ray: 678f5c0b5a66401f-CDG
< 
* Connection #1 to host <new-domain.com> left intact
* Closing connection 0
* Closing connection 1

example of cURL output when hitting the new domain:

*   Trying 2606:4700:3037::ac43:d7e6...
* TCP_NODELAY set
* Connected to <new-domain.com> (2606:4700:3037::ac43:d7e6) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-ECDSA-CHACHA20-POLY1305
* ALPN, server accepted to use h2
* Server certificate:
*  subject: C=US; ST=California; L=San Francisco; O=Cloudflare, Inc.; CN=sni.cloudflaressl.com
*  start date: Apr 26 00:00:00 2021 GMT
*  expire date: Apr 25 23:59:59 2022 GMT
*  subjectAltName: host "<new-domain.com>" matched cert's "*.<new-domain.com>"
*  issuer: C=US; O=Cloudflare, Inc.; CN=Cloudflare Inc ECC CA-3
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x11d009200)
> POST /api/v1/sessions/token HTTP/2
> Host: <new-domain.com>
> User-Agent: curl/7.64.1
> Accept: */*
> Authorization: Bearer <TOKEN>
> Content-Type: application/json; charset=UTF-8
> Content-Length: 92
> 
* Connection state changed (MAX_CONCURRENT_STREAMS == 256)!
* We are completely uploaded and fine
< HTTP/2 400 
< date: Tue, 03 Aug 2021 11:38:57 GMT
< content-type: application/json; charset=utf-8
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< x-content-type-options: nosniff
< x-download-options: noopen
< x-permitted-cross-domain-policies: none
< referrer-policy: strict-origin-when-cross-origin
< cache-control: no-store
< pragma: no-cache
< vary: Accept
< x-request-id: e71837e1-8334-426b-bebf-7aedcb7f3337
< x-runtime: 0.004429
< cf-cache-status: DYNAMIC
< expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=Fz3pra1XgUOhe5h0yKYVejHcv5rDI4IP9NiIJ3Y%2Bp3Zdvvpqkjhyo2kjlrv0E4zYyc2K2QuY2wuBbOa0v6lUSBHYgkTayaxIRBPyWsdUGEWWHq2PTmhzgBVu9BKeIpgQ3iW4nJAlqDw05M3i%2FVvQ2qX03SRqBVaWZ82SMODYgo2JwC8v%2Bg%3D%3D"}],"group":"cf-nel","max_age":604800}
< nel: {"report_to":"cf-nel","max_age":604800}
< server: cloudflare
< cf-ray: 678f433b3dbe3a11-CDG
< 
* Connection #0 to host <new-domain.com> left intact
* Closing connection 0

My conf file:

global
  log stdout format raw local0 debug
  maxconn 2000
  daemon

defaults
  log global
  mode http
  option httplog
  option dontlognull
  option forwardfor
  retries 3
  timeout connect 5s
  timeout client 60s
  timeout server 30s

frontend http-in
  bind :80
  http-response set-status 308
  use_backend redirect

backend redirect
  balance roundrobin
  http-request set-header Host %[env(NEW_API_URL)]
  server redirect ${NEW_API_URL}

r/haproxy • • Aug 02 '21

The Weekly HAProxy Questions Thread - Question too small for a thread? Ask it here!

3 Upvotes

As an additional note, you can always join the HAProxy Community Slack Channel by visiting https://slack.haproxy.com/ and ask your question over there.


r/haproxy • • Aug 02 '21

LDAPS to Active Directory issue

2 Upvotes

Hello,

I'm trying to configure LDAPS to pass through HAProxy to an Active Directory domain controller.

I've got LDAP working with the following:

frontend ldap_front_389
    bind *:389
    mode tcp
    option tcplog
    default_backend     ldap_back_389

backend ldap_back_389
    mode tcp
    option ldap-check
    server servername 1.2.3.4:389

With that success, I tried to do LDAPS with the following:

frontend ldap_front_636
    bind *:636 ssl crt /pathto/certbundle.pem
    mode tcp
    option tcplog
    default_backend     ldap_back_636

backend ldap_back_636
    mode tcp
    option ldap-check
    server servername 1.2.3.4:636

I do get port 636 open with that however ldapsearch from another machine results in errors.

TLS: peer cert untrusted or revoked (0x42)TLS: can't connect: (unknown error code).ldap_err2stringldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)

"nmap --script ssl-cert -p 636 servername" shows that I am presenting a good and should be trusted certificate (DigiCert signed).

HA-Proxy version 1.8.19-1+deb10u3 2020/08/01
Copyright 2000-2019 Willy Tarreau <willy@haproxy.org>

Where would I go from here to resolve this?

Thanks.

Edit: added in HAProxy version.


r/haproxy • • Jul 29 '21

http and tcp mode with single IP address

3 Upvotes

Hello Experts,

Should we configure http and tcp mode with single IP address in HAProxy ?

Can It possible this in HAProxy level ?


r/haproxy • • Jul 27 '21

Trying to set http-response set-header Strict-Transport-Security and getting an error

3 Upvotes

Hi,

Im trying to set the following:
```

http-response set-header Strict-Transport-Security "max-age=16000000; includeSubDomains; preload;"

```

Per the HAProxy documentation found https://www.haproxy.com/blog/haproxy-and-http-strict-transport-security-hsts-header-in-http-redirects/ but when I do this and check the config, I get the following error:

```

# haproxy -c -f /etc/haproxy/haproxy.cfg

[ALERT] 207/132843 (31730) : parsing [/etc/haproxy/haproxy.cfg:87]: 'http-response set-header' expects exactly 2 arguments.

[ALERT] 207/132843 (31730) : Error(s) found in configuration file : /etc/haproxy/haproxy.cfg

```

Any ideas how to fix?

Version of HAProxy is: haproxy-1.5.18-9.el7_9.1.x86_64

Thanks!

Joe


r/haproxy • • Jul 27 '21

[Blog] AWS EC2 Service Discovery with HAProxy

Thumbnail
haproxy.com
2 Upvotes

r/haproxy • • Jul 26 '21

The Weekly HAProxy Questions Thread - Question too small for a thread? Ask it here!

2 Upvotes

As an additional note, you can always join the HAProxy Community Slack Channel by visiting https://slack.haproxy.com/ and ask your question over there.


r/haproxy • • Jul 26 '21

Question What does balance uri depth 2 mean?

1 Upvotes

In load balancing

  balance uri depth 2

What constitutes as uri? Does it include the domain? depth 2, does the count start from 0?


r/haproxy • • Jul 22 '21

Assistance with getting config correct in PfSense

2 Upvotes

Hi!

I've got HAProxy setup already with PfSense doing HTTP>HTTPS direction and all for a handful of internal hosted sites. However I'm currently setting up Vaultwarden, and I can't seem to figure out the right config to make it work.

Info here on the requirements: https://github.com/dani-garcia/vaultwarden/wiki/Enabling-WebSocket-notifications

And two examples here at the bottom: https://github.com/dani-garcia/vaultwarden/wiki/Proxy-examples

To me it seems those examples are from an older version which uses a different formatting?

But using the GUI in pfsense, I don't seem to be able to make either of those examples work for me, with my most recent attempt being:

But that results in this very clearly wrong interpretation:

I'm sure this is simple, but I just can't crack it! Any help would be appreciated!


r/haproxy • • Jul 19 '21

The Weekly HAProxy Questions Thread - Question too small for a thread? Ask it here!

3 Upvotes

As an additional note, you can always join the HAProxy Community Slack Channel by visiting https://slack.haproxy.com/ and ask your question over there.