SaraSmiseth / prosody

Prosody XMPP server docker image
https://hub.docker.com/r/sarasmiseth/prosody
20 stars 7 forks source link

Mod_onions Support #41

Open grugel-maintro opened 1 year ago

grugel-maintro commented 1 year ago

I run the container as an onion Service with the following docker-compose file:

version: '3.7'

services:
  tor:
    image: prosody_tor:latest #goldy/tor but compiled for armV8
    links:
      - prosody
    restart: unless-stopped
    ports:
      - "9051:9051"
    volumes:
      - ./onion/:/var/lib/tor/hidden_service/
#      - /mnt/cloud/prosody/onion/tor-conf:/etc/tor/
    environment:
      PROSODY_TOR_SERVICE_HOSTS: 5000:prosody:5000,5222:prosody:5222,5223:prosody:5223,5269:prosody:5269,5281:prosody:5281
      TOR_SOCKS_PORT: 0.0.0.0:9051
    hostname: tor
  prosody:
    build: ./prosody
    restart: unless-stopped
    ports:
      - "5000:5000"
      - "5222:5222"
      - "5223:5223"
      - "5269:5269"
      - "5281:5281"
#      - "53:53"
    environment:
      E2E_POLICY_CHAT: "required"
      E2E_POLICY_MUC: "required"
      ALLOW_REGISTRATION: "true"
      PROSODY_ADMINS: "admin@xxx.onion"
      DOMAIN: xxx.onion
      STORAGE: "internal"
      HTTP_PROXY: "socks5h://tor:9051"
      HTTPS_PROXY: "socks5h://tor:9051"
    volumes:
      - ./data:/usr/local/var/lib/prosody
      - ./certs:/usr/local/etc/prosody/certs
    hostname: prosody

I would love to be able to use S2S over the tor socks5 proxy and tried to include the mod_onions mod in your image and added the mod onion configs to 01-modules.cfg.lua like this:

onions_tor_all = true; -- pass all s2s connections through Tor
onions_only = true; -- allow all connection attempts to non-onion servers
onions_socks5_host = "172.18.0.3"; --hotname for proxy (172.18.0.3 address of tor interface)
onions_socks5_port = "9051";

The onion container should be configured to open up the socks5 port on 0.0.0.0:9051 so it should be possible for prosody to connect to the address of the container. It still doesn't work (module is installed in the /usr/local/lib/prosody/modules folder). Do you have any idea what could be the issue?

I would love to fork your project at a point to make the image available as a onion service to protect meta data a bit better when using xmpp. Im not really experienced in docker jet and if you have a better suggestion on how to make this project in a way where it isn't antagonistic to the direction you want to go with this image pls tell me.