Closed Juggler00 closed 1 year ago
any reason you are using 8051 as port ?
SRC should be the IP and port of the host machine
I used port 8051 as this is what was listed:
telnet 192.168.3.33 2000
Trying 192.168.3.33...
Connected to 192.168.3.33.
Escape character is '^]'.
[2023-11-08 | 19:06:17: Ready]
> list
list
! # Type Info
# 0 FILE webapp/index.html-1.4.0.24 (1995, 0)
# 1 UDPC juicenet-udp-prod4-usa.enelx.com:8051 (19405)
Funny enough, overnight we had a power outage. Now when I log into the Jukebox:
telnet 192.168.3.33 2000
Trying 192.168.3.33...
Connected to 192.168.3.33.
Escape character is '^]'.
[2023-11-09 | 12:05:26: Ready]
> list
list
! # Type Info
# 0 FILE webapp/index.html-1.4.0.24 (1995, 0)
# 1 UDPC jbv1.emotorwerks.com:8042 (1952)
It appears that it has chosen a different server and port!
That's interesting. and make it more difficult to spoof the DNS.... the FW rules might be the best option filtering with the src IP for base the rule of.
jbv1.emotorwerks.com
juicenet-udp-prod4-usa.enelx.com
juicenet-udp-prod3-usa.enelx.com
juicenet-udp-prod2-usa.enelx.com
A couple of notes. I have added 5x DNS rewrite rules to my AdGuard Home:
It would be more elegant if I was able to use FW rules, but it does not appear the my Unifi router has the ability to create such a rule.
With regards to SRC, when I use the following docker-compose config, I get the error below. It appears that it is choking on the SRC IP:
juicepassproxy:
build: ./juicepassproxy
hostname: juicepassproxy
container_name: juicepassproxy
restart: unless-stopped
logging:
driver: json-file
ports:
- 8042:8042/udp
networks:
public:
environment:
- JUICEBOX_LOCAL_IP=192.168.3.33
- SRC=192.168.2.10
- MQTT_HOST=192.168.2.10
- DEBUG=true
volumes:
- /etc/localtime:/etc/localtime:ro
If instead I use host network_mode, it works. Not ideal, but I'll live with it unless someone has any pointers?
juicepassproxy:
build: ./juicepassproxy
hostname: juicepassproxy
container_name: juicepassproxy
restart: unless-stopped
logging:
driver: json-file
network_mode: host
environment:
- JUICEBOX_LOCAL_IP=192.168.3.33
- SRC=192.168.2.10
- MQTT_HOST=192.168.2.10
- DEBUG=true
volumes:
- /etc/localtime:/etc/localtime:ro
DEBUG OUTPUT:
juicepassproxy | 11/09/23 12:00:37: SRC: 192.168.2.10
juicepassproxy | 11/09/23 12:00:37: DST: 138.91.137.23
juicepassproxy | 11/09/23 12:00:37: ENELX_SERVER: jbv1.emotorwerks.com
juicepassproxy | 11/09/23 12:00:37: ENELX_PORT: 8042
juicepassproxy | 11/09/23 12:00:37: MQTT_HOST: 192.168.2.10
juicepassproxy | 11/09/23 12:00:37: MQTT_PORT: 1883
juicepassproxy | 11/09/23 12:00:37: MQTT_DISCOVERY_PREFIX: homeassistant
juicepassproxy | 11/09/23 12:00:37: DEVICE_NAME: JuiceBox
juicepassproxy | 11/09/23 12:00:37: DEBUG: true
juicepassproxy | 11/09/23 12:00:37: COMMAND: python /juicepassproxy/juicepassproxy.py --src 192.168.2.10:8042 --dst 138.91.137.23:8042 --host 192.168.2.10 --port 1883 --discovery-prefix homeassistant --name JuiceBox --debug
juicepassproxy | 2023-11-09 12:00:38,172 INFO config_topic: homeassistant/sensor/JuiceBox/JuiceBox-Status/config
juicepassproxy | 2023-11-09 12:00:38,172 INFO state_topic: hmd/sensor/JuiceBox/JuiceBox-Status/state
juicepassproxy | 2023-11-09 12:00:38,172 DEBUG Creating mqtt client(None) for {mqtt_settings.host}:{mqtt_settings.port}
juicepassproxy | 2023-11-09 12:00:38,172 DEBUG Connecting to 192.168.2.10:1883 without SSL
juicepassproxy | 2023-11-09 12:00:38,176 INFO config_topic: homeassistant/sensor/JuiceBox/JuiceBox-Current/config
juicepassproxy | 2023-11-09 12:00:38,176 INFO state_topic: hmd/sensor/JuiceBox/JuiceBox-Current/state
juicepassproxy | 2023-11-09 12:00:38,176 DEBUG Creating mqtt client(None) for {mqtt_settings.host}:{mqtt_settings.port}
juicepassproxy | 2023-11-09 12:00:38,176 DEBUG Connecting to 192.168.2.10:1883 without SSL
juicepassproxy | 2023-11-09 12:00:38,177 INFO config_topic: homeassistant/sensor/JuiceBox/JuiceBox-Frequency/config
juicepassproxy | 2023-11-09 12:00:38,177 INFO state_topic: hmd/sensor/JuiceBox/JuiceBox-Frequency/state
juicepassproxy | 2023-11-09 12:00:38,177 DEBUG Creating mqtt client(None) for {mqtt_settings.host}:{mqtt_settings.port}
juicepassproxy | 2023-11-09 12:00:38,177 DEBUG Connecting to 192.168.2.10:1883 without SSL
juicepassproxy | 2023-11-09 12:00:38,178 INFO config_topic: homeassistant/sensor/JuiceBox/JuiceBox-Power--Lifetime-/config
juicepassproxy | 2023-11-09 12:00:38,179 INFO state_topic: hmd/sensor/JuiceBox/JuiceBox-Power--Lifetime-/state
juicepassproxy | 2023-11-09 12:00:38,179 DEBUG Creating mqtt client(None) for {mqtt_settings.host}:{mqtt_settings.port}
juicepassproxy | 2023-11-09 12:00:38,179 DEBUG Connecting to 192.168.2.10:1883 without SSL
juicepassproxy | 2023-11-09 12:00:38,180 INFO config_topic: homeassistant/sensor/JuiceBox/JuiceBox-Power--Session-/config
juicepassproxy | 2023-11-09 12:00:38,180 INFO state_topic: hmd/sensor/JuiceBox/JuiceBox-Power--Session-/state
juicepassproxy | 2023-11-09 12:00:38,180 DEBUG Creating mqtt client(None) for {mqtt_settings.host}:{mqtt_settings.port}
juicepassproxy | 2023-11-09 12:00:38,180 DEBUG Connecting to 192.168.2.10:1883 without SSL
juicepassproxy | 2023-11-09 12:00:38,182 INFO config_topic: homeassistant/sensor/JuiceBox/JuiceBox-Temperature/config
juicepassproxy | 2023-11-09 12:00:38,182 INFO state_topic: hmd/sensor/JuiceBox/JuiceBox-Temperature/state
juicepassproxy | 2023-11-09 12:00:38,182 DEBUG Creating mqtt client(None) for {mqtt_settings.host}:{mqtt_settings.port}
juicepassproxy | 2023-11-09 12:00:38,182 DEBUG Connecting to 192.168.2.10:1883 without SSL
juicepassproxy | 2023-11-09 12:00:38,184 INFO config_topic: homeassistant/sensor/JuiceBox/JuiceBox-Voltage/config
juicepassproxy | 2023-11-09 12:00:38,184 INFO state_topic: hmd/sensor/JuiceBox/JuiceBox-Voltage/state
juicepassproxy | 2023-11-09 12:00:38,184 DEBUG Creating mqtt client(None) for {mqtt_settings.host}:{mqtt_settings.port}
juicepassproxy | 2023-11-09 12:00:38,184 DEBUG Connecting to 192.168.2.10:1883 without SSL
juicepassproxy | 2023-11-09 12:00:38,185 DEBUG Starting UDP proxy...
juicepassproxy | 2023-11-09 12:00:38,185 DEBUG Src: 192.168.2.10:8042
juicepassproxy | 2023-11-09 12:00:38,186 DEBUG Dst: 138.91.137.23:8042
juicepassproxy | Traceback (most recent call last):
juicepassproxy | File "/juicepassproxy/juicepassproxy.py", line 221, in <module>
juicepassproxy | main()
juicepassproxy | File "/juicepassproxy/juicepassproxy.py", line 218, in main
juicepassproxy | pyproxy.udp_proxy(args.src, args.dst)
juicepassproxy | File "/juicepassproxy/pyproxy/pyproxy.py", line 43, in udp_proxy
juicepassproxy | proxy_socket.bind(ip_to_tuple(src))
juicepassproxy | OSError: [Errno 99] Cannot assign requested address
juicepassproxy | 2023-11-09 12:00:38,203 DEBUG Shutting down MQTT client
juicepassproxy | 2023-11-09 12:00:38,203 DEBUG Shutting down MQTT client
juicepassproxy | 2023-11-09 12:00:38,203 DEBUG Shutting down MQTT client
juicepassproxy | 2023-11-09 12:00:38,203 DEBUG Shutting down MQTT client
juicepassproxy | 2023-11-09 12:00:38,203 DEBUG Shutting down MQTT client
juicepassproxy | 2023-11-09 12:00:38,203 DEBUG Shutting down MQTT client
juicepassproxy | 2023-11-09 12:00:38,203 DEBUG Shutting down MQTT client
juicenet-udp-prod1-usa.enelx.com do not exist ......
and dont put SRC , let the container determine it , specially if you use bridge ..... the container will not have access to the IP you are entering as SRC.... ==> the error you get
But to the fact , the port can change , i would now recommend to not use bridge
Apologies if this is obvious, but I'm trying to understand what the SRC is. Is it the IP address of my docker host (192.168.2.10), or the IP assigned to the container? If it is the later, this address is not routable. If it is the former, I seem to be getting an error (see below). Appreciate any guidance.
Docker host IP: 192.168.2.10 MQTT server (also container): 192.168.2.10:1883
From debug: