I am getting started with self hosting and one of the things I would love to host is a Signal TLS proxy using Docker.

Problem is that I have ports 80 and 443 taken by Nginx Proxy Manager (also in a Docker container), through which I forward to different services depending on the subdomain.

I tried modifying the docker-compose.yml file to use ports 9443 and 980 and have it working using a certificate created on NPM, but to no avail.

Being a beginner, it can well be that I don’t understand reverse proxies well enough, but that’s why, with your help I would love to take this opportunity to learn more.

Thanks in advance.

  • litchralee@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    5
    ·
    21 hours ago

    I’ll take a stab at the question. But I’ll need to lay some foundational background information.

    When an adversarial network is blocking connections to the Signal servers, the Signal app will not function. Outbound messages will still be encrypted, but they can’t be delivered to their intended destination. The remedy is to use a proxy, which is a server that isn’t blocked by the adversarial network and which will act as a relay, forwarding all packets to the Signal servers. The proxy cannot decrypt any of the messages, and a malicious proxy is no worse than blocking access to the Signal servers directly. A Signal proxy specifically forwards only to/from the Signal servers; this is not an open proxy.

    The Signal TLS Proxy repo contains a Docker Compose file, which will launch Nginx as a reverse proxy. When a Signal app connects to the proxy at port 80 or 443, the proxy will – in the background – open a connection to the Signal servers. That’s basically all it does. They ostensibly wrote the proxy as a Docker Compose file, because that’s fairly easy to set up for most people.

    But now, in your situation, you already have a reverse proxy for your selfhosting stack. While you could run Signal’s reverse proxy in the background and then have your main reverse proxy forward to that one, it would make more sense to configure your main reverse proxy to directly do what the Signal reverse proxy would do.

    That is, when your main proxy sees one of the dozen subdomains for the Signal server, it should perform reverse proxying to those subdomains. Normally, for the rest of your self hosting arrangement, the reverse proxy would target some container that is running on your LAN. But in this specific case, the target is actually out on the public Internet. So the original connection comes in from the Internet, and the target is somewhere out there too. Your reverse proxy simply is a relay station.

    There is nothing particularly special about Signal choosing to use Nginx in reverse proxy mode, in that repo. But it happens to be that you are already using Nginx Proxy Manager. So it’s reasonable to try porting Signal’s configuration file so that it runs natively with your Nginx Proxy Manager.

    What happens if Signal updates that repo to include a new subdomain? Well, you wouldn’t receive that update unless you specifically check for it. And then update your proxy configuration. So that’s one downside.

    But seeing as the Signal app demands port 80 and 443, and you already use those ports for your reverse proxy, there is no way to avoid programming your reverse proxy to know the dozen subdomains. Your main reverse proxy cannot send the packets to the Signal reverse proxy if your main proxy cannot even identify that traffic.

    • biofaust@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      21 hours ago

      Thank you for your answer. From what I can understand, the Stream settings in NPM do not allow for the function performed by ssl_preread_server_name. That means I would have to modify things in the NPM container itself, right?

      • litchralee@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        3
        ·
        20 hours ago

        Sadly, I’m not familiar enough with Nginx Proxy Manager to know. But I would imagine that there must be a different way to achieve the same result.

        BTW, when I read “NPM”, I first think of Node.JS Package Manager. The title of your post may be confusing, and you might consider editing it to spell out the name of Nginx Proxy Manager.