Как настроить прокси для подключения моста MQTT? - PullRequest
1 голос
/ 04 апреля 2019

У меня есть москитный брокер, работающий на Linux за прокси-сервером моей компании.Я настроил мост к AWS так же: (mosquitto.conf)

connection bridge
address ec2-xxx-xxx-xxx-xxx.ap-northeast-1.compute.amazonaws.com:8089
remote_username admin
remote_password password
topic abc/raspi01 both 0
bridge_cafile /etc/pki/tls/certs/nginx-selfsigned.crt
bridge_insecure false

Но когда я запускаю службу mosquitto командой:

service mosquitto restart

В файле журнала есть некоторыеошибки:

1554356888: mosquitto version 1.5.5 starting
1554356888: Config loaded from /etc/mosquitto/mosquitto.conf.
1554356888: Opening ipv4 listen socket on port 1883.
1554356888: Opening ipv6 listen socket on port 1883.
1554356888: Warning: Address family not supported by protocol
1554356888: Connecting bridge bridge (ec2-xxx-xxx-xxx-xxx.ap-northeast-1.compute.amazonaws.com:8089)
1554356888: Error creating bridge: Name or service not known.
1554356888: Warning: Unable to connect to bridge bridge.
1554356901: New connection from 127.0.0.1 on port 1883.
1554356901: New connection from 127.0.0.1 on port 1883.
1554356901: New client connected from 127.0.0.1 as mqtt_fd05fada.b70918 (c1, k60).
1554356901: New client connected from 127.0.0.1 as mqtt_2a3a025d.6c941e (c1, k60).
1554356919: Connecting bridge bridge (ec2-xxx-xxx-xxx-xxx.ap-northeast-1.compute.amazonaws.com:8089)
1554356919: Error creating bridge: Name or service not known.
1554356950: Connecting bridge bridge (ec2-xxx-xxx-xxx-xxx.ap-northeast-1.compute.amazonaws.com:8089)
1554356950: Error creating bridge: Name or service not known.

Я считаю, что причиной является прокси моей компании.Я пытался с настройками в mosquitto.service, но это не решает.

[Unit]
Description=Mosquitto MQTT v3.1/v3.1.1 Broker
Documentation=man:mosquitto.conf(5) man:mosquitto(8)
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
NotifyAccess=main
ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
Environment="HTTPS_PROXY=http://user:pass@proxyhost:8800"
Environment="HTTP_PROXY=http://user:pass@proxyhost:8800"
Environment="NO_PROXY=127.0.0.1,localhost"
Restart=on-failure

[Install]
WantedBy=multi-user.target

Может ли какой-нибудь орган мне помочь?Большое спасибо.

1 Ответ

0 голосов
/ 04 апреля 2019

Нельзя использовать HTTP-прокси для подключения через мост MQTT (или любое собственное подключение MQTT).MQTT - это совершенно другой протокол.

Только MQTT через Websockets будет работать через HTTP-прокси, но вы не можете настроить mosquitto для запуска моста с MQTT через Websockets.

...