Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Mosquitto » Local/external ip's(Connecting locally without user/pass, connecting from external with user/pass)
Local/external ip's [message #1821161] Thu, 06 February 2020 12:39 Go to next message
Nicholas Woodforth is currently offline Nicholas WoodforthFriend
Messages: 1
Registered: February 2020
Location: GoldCoast
Junior Member
Hey all,
Im quite new to MQTT. So far I have only used mosquitto in local network without username and password.
What I want to aim to try and do is if mqtt is connecting to broker on local network it does not require username/password. But if connecting to broker from outside network it requires username and password.
Is there away to do this?
Broker is on rpi. Mosquitto version 1.5.7

Thanks All
Re: Local/external ip's [message #1821656 is a reply to message #1821161] Tue, 18 February 2020 09:36 Go to previous message
Roger Light is currently offline Roger LightFriend
Messages: 45
Registered: September 2013
Member
Yes that is possible, but you might have to apply some firewall rules to help out.

# This setting means that all listeners have their own authentication/access control settings
per_listener_settings true

# Define our listener for external connections, with password
# authentication
listener 1883
password_file /path/to/password_file
allow_anonymous false
# If you need TLS encryption:
# cafile /path/to/certificate/authority/certificates
# certfile /path/to/server/certificate
# keyfile /path/to/server/key

# Define a listener that binds to 127.0.0.1, which means only clients
#  on the local machine can use it to connect. No authentication required. 
# This isn't usable for the wider local network though.
listener 1884 127.0.0.1

# Define a listener with no authentication. Because this has a separate port
# to the external listener, you could use some firewall rules to disallow access
# to clients that did not originate on your local network. 
listener 1885


Does that help?
Previous Topic:How get client IP?
Next Topic:Socket error on client <unknown>, disconnecting
Goto Forum:
  


Current Time: Tue Oct 20 10:00:21 GMT 2020

Powered by FUDForum. Page generated in 0.02109 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top