sebw / pushtify

Listen for Gotify notifications over websocket and forward them to Pushover
30 stars 6 forks source link

SSL: WRONG_VERSION_NUMBER #4

Open AntoVie opened 3 weeks ago

AntoVie commented 3 weeks ago

I've installed pushtify with this :

  services:
    pushtify:
      image: ghcr.io/sebw/pushtify:latest
      container_name: pushtify
      environment:
        - GOTIFY_TOKEN=Ai_XXXXXXXX_
        - GOTIFY_HOST=192.168.2.221:8079
        - PUSHOVER_USERKEY=uzXXXXXXXh4
      restart: unless-stopped

The build goes well then in the container logs I got this message :

[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1129)
### closed ###

Do we need to use the ssl connection to Gotify ? Because I didn't enable it in Gotify.

Thanks

sebw commented 3 weeks ago

Secure websocket is hard coded in the python code.

Replace wss:// with ws:// and rebuild the container image and you should be fine!

ristomatti commented 1 week ago

For convenience, a working Dockerfile:

FROM python:3.10.7-alpine3.16

RUN pip install ntfy && \
    pip install websocket-client && \
    rm -rf /var/cache/*

ENV GOTIFY_TOKEN=xyz
ENV GOTIFY_HOST=ws://gotify.example.org
ENV PUSHOVER_USERKEY=abcdefghijklmnopqrstuvwxyz

COPY pushtify-listener.py /usr/local/bin

ENTRYPOINT ["python3","/usr/local/bin/pushtify-listener.py"]

Modified last block of pushtify-listener.py:

if __name__ == "__main__":
    wsapp = websocket.WebSocketApp(str(gotify_host) + "/stream", header={"X-Gotify-Key": str(gotify_token)},
                              on_open=on_open,
                              on_message=on_message,
                              on_error=on_error,
                              on_close=on_close)
    wsapp.run_forever()