Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add auth and cert options for connection to MQTT broker #5

Closed
wants to merge 1 commit into from

Conversation

flopon
Copy link
Contributor

@flopon flopon commented Apr 2, 2018

No description provided.

@@ -1,3 +1,6 @@
mqtthost=192.168.0.1
#mqttusername=username
#mqttpassword=password
#mqttcafile=/etc/persistent/mqtt/client/mqttca.crt
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this but ca file is not supported by the mosquitto binary. Can you remove it please?

MF.v2.1.11# export LD_LIBRARY_PATH=/var/etc/persistent/mqtt
MF.v2.1.11# ./mosquitto_pub --help
mosquitto_pub is a simple mqtt client that will publish a message on a single topic and exit.
mosquitto_pub version 1.4.14 running on libmosquitto 1.4.14.

Usage: mosquitto_pub [-h host] [-k keepalive] [-p port] [-q qos] [-r] {-f file | -l | -n | -m message} -t topic
                     [-A bind_address]
                     [-i id] [-I id_prefix]
                     [-d] [--quiet]
                     [-M max_inflight]
                     [-u username [-P password]]
                     [--will-topic [--will-payload payload] [--will-qos qos] [--will-retain]]
                     [--proxy socks-url]
       mosquitto_pub --help

 -A : bind the outgoing socket to this host/ip address. Use to control which interface
      the client communicates over.
 -d : enable debug messages.
 -f : send the contents of a file as the message.
 -h : mqtt host to connect to. Defaults to localhost.
 -i : id to use for this client. Defaults to mosquitto_pub_ appended with the process id.
 -I : define the client id as id_prefix appended with the process id. Useful for when the
      broker is using the clientid_prefixes option.
 -k : keep alive in seconds for this client. Defaults to 60.
 -l : read messages from stdin, sending a separate message for each line.
 -m : message payload to send.
 -M : the maximum inflight messages for QoS 1/2..
 -n : send a null (zero length) message.
 -p : network port to connect to. Defaults to 1883.
 -P : provide a password (requires MQTT 3.1 broker)
 -q : quality of service level to use for all messages. Defaults to 0.
 -r : message should be retained.
 -s : read message from stdin, sending the entire input as a message.
 -t : mqtt topic to publish to.
 -u : provide a username (requires MQTT 3.1 broker)
 -V : specify the version of the MQTT protocol to use when connecting.
      Can be mqttv31 or mqttv311. Defaults to mqttv31.
 --help : display this message.
 --quiet : don't print error messages.
 --will-payload : payload for the client Will, which is sent by the broker in case of
                  unexpected disconnection. If not given and will-topic is set, a zero
                  length message will be sent.
 --will-qos : QoS level for the client Will.
 --will-retain : if given, make the client Will retained.
 --will-topic : the topic on which to publish the client Will.
 --proxy : SOCKS5 proxy URL of the form:
           socks5h://[username[:password]@]hostname[:port]
           Only "none" and "username" authentication is supported.

See http://mosquitto.org/ for more information.

@magcode
Copy link
Owner

magcode commented Apr 3, 2018

Thank you @flopon for your contribution 🙇
Added a comment regarding --cafile.
Did this work on your machine? Do you use a different mosquitto binary?

@flopon
Copy link
Contributor Author

flopon commented Apr 3, 2018

OK. Quite suprising, I used the official documentation to add this option!
(https://mosquitto.org/man/mosquitto_pub-1.html)

Anyway, sorry, I had only tested the user/passwd part, I just send you a new version with only the auth modification.

@magcode magcode closed this Apr 3, 2018
@magcode
Copy link
Owner

magcode commented Apr 3, 2018

OK. Quite suprising, I used the official documentation to add this option!

no worries. I compiled the mosquitto binaries for busybox myself. Probably the available version was a bit old.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants