Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - AlexH

#1
German - Deutsch / Probleme mit HAProxy und ACL's
September 19, 2020, 10:20:14 AM
Hallo zusammen,

ich habe folgendes Problem:
Ich betreibe einen Reverseproxy mit Nginx in einer VM. Dieser macht SSL-Offloading für mehrere Seiten, unter anderem für eine Nextcloudinstallation.
In der Vergangenheit war dieses Setup für mich ausreichend. Nun soll aber noch ein Dockerhost hinzu kommen. Auf diesem soll ein Traefik-Reversproxy zum Einsatz kommen welcher dann für die Container auch SSL über Let'sEncrypt bereit stellt.

Meine Idee ist nun, auf der OpnSense den HAProxy zu bemühen, anhand von Regeln die Request entweder an den Reverseproxy oder an den Dockerhost weiter zu leiten. Aber das gelingt mir nicht.

hier meine HAProxy-Konfiguration:
#
# Automatically generated configuration.
# Do not edit this file manually.
#

global
    # NOTE: Could be a security issue, but required for some feature.
    uid                         80
    gid                         80
    chroot                      /var/haproxy
    daemon
    stats                       socket /var/run/haproxy.socket group proxy mode 775 level admin
    nbproc                      1
    nbthread                    1
    tune.ssl.default-dh-param   1024
    spread-checks               0
    tune.chksize                16384
    tune.bufsize                16384
    tune.lua.maxmem             0
    log /var/run/log syslog debug

defaults
    log     global
    option redispatch -1
    timeout client 30s
    timeout connect 30s
    timeout server 30s
    retries 3
    default-server init-addr last,libc

# autogenerated entries for ACLs


# autogenerated entries for config in backends/frontends

# autogenerated entries for stats


# Frontend: FE_HTTP ()
frontend FE_HTTP
    bind 192.168.6.210:8022 name 192.168.6.210:8022
    mode http
    option http-keep-alive
    # tuning options
    timeout client 30s

    # logging options
    option dontlog-normal
    option log-separate-errors
    option httplog
    option socket-stats
    # ACL: ist_nextcloud
    acl acl_5f646090954738.14720712 hdr_sub(host) -i nextcloud.meine-domain-A.de
    # ACL: ist_dockerhost
    acl acl_5f64aa604775d0.03724610 hdr_sub(host) -i d.meine-domain-B.de

    # ACTION: HTTP_to_Reverse
    use_backend BE_Reverseproxy_HTTP if acl_5f646090954738.14720712
    # ACTION: HTTP_Dockerhost
    use_backend BE_Dockerhost_HTTP if acl_5f64aa604775d0.03724610

# Frontend: FE_HTTPS ()
frontend FE_HTTPS
    bind 192.168.6.210:8080 name 192.168.6.210:8080
    mode tcp
    # tuning options
    timeout client 30s

    # logging options
    option dontlog-normal
    option log-separate-errors
    option tcplog
    option socket-stats
    # ACL: ist_dockerhost
    acl acl_5f64aa604775d0.03724610 hdr_sub(host) -i d.meine-domain-B.de
    # ACL: ist_nextcloud
    acl acl_5f646090954738.14720712 hdr_sub(host) -i nextcloud.meine-domain-A.de

    # ACTION: HTTPS_Dockerhost
    use_backend BE_Dockerhost_HTTPS if acl_5f64aa604775d0.03724610
    # ACTION: HTTPS_to_Reverse
    use_backend BE_Reverseproxy_HTTPS if acl_5f646090954738.14720712

# Backend: BE_Reverseproxy_HTTPS ()
backend BE_Reverseproxy_HTTPS
    # health checking is DISABLED
    mode tcp
    balance source

    # tuning options
    timeout connect 30s
    timeout server 30s
    server vm_Reverseproxy_SSL 192.168.6.3:443

# Backend: BE_Reverseproxy_HTTP ()
backend BE_Reverseproxy_HTTP
    # health checking is DISABLED
    mode http
    balance roundrobin

    # tuning options
    timeout connect 30s
    timeout server 30s
    server vm_Reverseproxy_HTTP 192.168.6.3:80

# Backend: BE_Dockerhost_HTTP ()
backend BE_Dockerhost_HTTP
    # health checking is DISABLED
    mode http
    balance source

    # tuning options
    timeout connect 30s
    timeout server 30s
    server Dockerhost_http 192.168.6.27:80

# Backend: BE_Dockerhost_HTTPS ()
backend BE_Dockerhost_HTTPS
    # health checking is DISABLED
    mode tcp
    balance roundrobin

    # tuning options
    timeout connect 30s
    timeout server 30s
    server Dockerhost_https 192.168.6.27:443


Kann mir hier jemand einen Tip geben?

Vielen Dank
Gruß
Alex
#2
Vielen Dank für den Tip mit go-mmproxy, dass tut genau das was ich brauche.

Gruß
Alex
#3
Hallo zusammen,

ich betreibe ein SSH-Jumpgateway und Reverseproxy zusammen in einer VM. Das Setup basiert auf einem SSLH-Daemon und einem Nginx als Revrsproxy. Dieses Setup möchte ich nun gerne mittels HAProxy realisieren.
Ich versuche mich gerade an dem SSH-Jumpgateway. Die SSH-Connections bekomme ich auch an das passende Backend durchgereicht. Allerdings sehe ich auf dem Backend nur die IP-Adresse von der Opnsense und nicht die Client-IP.
Wie muss ich den HAProxy auf der Opnsense konfigurieren, damit ich die Clientip am Backend sehe. Dies benötige ich für Fail2Ban.


Gruß
Alex