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 - alexschomb

#1
Für alle die sich auch diese Frage gestellt haben, hier die Lösung, welche ich anwende. Unter System > Sicherheit > Zertifikate finden sich alle Zertifikate. Auch diese welche fälschlicherweise im HAproxy noch angezeigt werden, obwohl sie von Let's Encrypt nicht mehr bedient werden oder gar abgelaufen sind. Leider ist die Übersicht der Zertifikate nicht sehr benutzerfreundlich, da man weder filtern / sortieren kann, noch mehrere Zertifikate gleichzeitig bearbeiten kann. Mit ein wenig manueler Arbeit und wachen Augen klappt es dennoch, dass man über das Mülleimersymbol die betroffenen Zertifikate von Hand löscht. Danach werden diese nicht mehr angezeigt.

Vorhanden sie sie aber dennoch und so gibt es in diversen Unterordnern von /var/etc/acme-client/ noch Verweise der Zertifikate. Theoretisch kann man diese auch stehen lassen, schöner ist es jedoch sie zu Löschen. Leider sind bis auf in dem home-Ordner nur Hashes als Zuordnung vorhanden. Am einfachsten fand ich es die Logdatei von Let's Encrypt durchzugehen (in der Shell unter /var/log/acme.sh.log, nicht im Webinterface - da dort leider nur die letzten paar Einträge angezeigt werden und es keine Suchfunktion gibt) und die Hashes der ungewünschten Zertifikate zu ermitteln. Im Anschluss die entsprechenden Ordner einfach löschen.
#2
Dieser Beitrag richtet sich im Speziellen an @fraenki, welcher leider private Nachrichten geblockt hat.

Vorab vielen Dank für deine tolle Arbeit in diesem Projekt! :)

Ich habe für ein paar Zertifikate mit deinem Let's Encrypt Plugin das Problem, dass für die selbe Domain im HAproxy auch noch abgelaufene Zertifikate verfügbar sind - parallel zu den neuen. Wie das genau zu Stande kommt bin ich mir nicht sicher, ggfs. weil ich manuell die Zertifikate neu ausgestellt habe o.ä. Hier scheint ein Bug im Let's Encrypt Plugin zu sein, denn ich habe die Zertifikate ausschließlich über das Webinterface ausgestellt.

Kannst du mir zufällig sagen wie ich via SSH die veralteten Zertifikate löschen kann ohne etwas kaputt zu machen? Im Let's Encrypt Plugin werden nur die neuen Zertifikate angezeigt, nur das HAproxy Plugin sieht die alten. Einfach das entsprechende Zertifikat aus /var/etc/acme-client/certs/ löschen?

Anbei auch der Hinweis, dass beim erstellen eines neuen Zertifikats ich dieses immer zweimal manuell ausstellen muss damit das Ausstellen erfolgreich ist ("Create domain key error."). Leider ist die Logdatei im Webinterface nur über die Suche navigierbar, da es (noch?) keine Pagination gibt.  ;)

Liebe Grüße und vielen Dank!

Alex
#3
General Discussion / HAproxy: websockets support
December 19, 2017, 12:23:13 AM
Hi,

has anyone used websocket redirection with the HAproxy plugin? How would you recommend implementing it?

Here are three common solutions for text-based HAproxy implementations:
http://blog.silverbucket.net/post/31927044856/3-ways-to-configure-haproxy-for-websockets
#4
General Discussion / HAproxy: port range
December 10, 2017, 11:25:41 AM
I was asked to establish a port porwarding for a specific TLD to an external address. The forwarding should succeed for certain ports in a port range. All other ports should be handled by OPNsense / the network behind.

As all requests will be HTTP/HTTPS only I thought that HAproxy would be a nice solution. But then I figured out that port ranges or empty values won't be accepted by the OPNsense plugin. Is there any solution how I could implement this anyway? HAproxy itself seems to support portforwardings (frontend) and empty port values (server), look at this question & answer:
https://stackoverflow.com/questions/26794547/how-to-configure-haproxy-port-range-to-range-one-by-one#33436983
#5
Sorry, I got it working on my own.

One important step for this was to create a separate frontend for all port 80 requests (0.0.0.0:80) and disable the default "letsencrypt" frontend using the same port. I set the new frontend to have no default backend and added the "redirect_to_https" and "redirect_acme_challenges" actions (ACL). I also enabled "X-Forwarded-For" although I don't know whether I really need that for the HTTP frontend with 301 redirects.

In a second step I copied the "find_acme_challenge" ACL, negated the condition and named it "not_acme_challenge". I added that new ACL to the "redirect_to_https" action (ACL) and made sure that the logical operator was set to "AND [default]". I also set the "rediret_to_https" action (ACL) to use my usual "webservers" backend that I use with the HTTPS frontend as well.

Hope that helps others as well.

P.S.: I read that v2.0 of HAproxy plugin be released soon and there is going to be a major overhaul of the UI. This tutorial might not be applicable to future versions.
#6
Quote from: fraenki on April 04, 2017, 02:31:59 PM
Quote from: Taomyn on March 17, 2017, 02:41:11 PM
I'd like to set HAProxy to redirect web requests for HTTP to HTTPS, but I can't figure out how to do it?

You need to create an ACL for this. In the current release of our HAProxy plugin it is already possible to select "Traffic is ssl" as ACL expression, but this is quite unreliable.

The next release of our HAProxy plugin (1.14) will provide the new expression "SSL/TLS connection established" to detect reliably wether it's a SSL connection or not. (https://github.com/opnsense/plugins/pull/110)

When HAProxy plugin version 1.14 is released you'll be able to configure HTTP-to-HTTPS redirects like this:
- create new ACL, choose expression "SSL/TLS connection established" (tick the "Negate condition" checkbox)
- create new ACTION, choose your new ACL, select action "http-request redirect", add to "Set value": scheme https code 301
- add the new action to your HTTP frontend (note that this will NOT work in TCP mode)

See the attached screenshots for an example.

A little bit complicated for a simple redirect, but I think this is the price one has to pay for the great flexibility that HAProxy has to offer. :)


Regards
- Frank

Hello Frank,

thanks for your how-to. Unfortunately it doesn't seem to work in my setup. I followed every of your steps, but when I curl the IP HAproxy is listening on (obviously I set the frontend to listen both to port 80 AND 443: 0.0.0.0:80 0.0.0.0:443) I just receive: "curl: (52) Empty reply from server"

HTTPs is working fine and the port in the firewall is open as well. I also disabled all let's encrypt rules in HAproxy to prevent any problems. Still I'd like to use Let's Encrypt as well, how would I do that? Both frontends would be listening on the same port 80 for the same IP. I suppose that is no problem?

Best regards and thanks for your work,

Alex