All MQTT connections have usernames and passwords #1056
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, only connections coming from Relays had usernames and
passwords associated with them; any connection from Cog itself had
neither. We would distinguish between them by examining which host the
connection was coming from; if it was 127.0.0.1, we treated it like it
was a Cog connection, and like a Relay connection (which needed to be
authenticated) otherwise.
This would cause Cog to crash if a Relay process was running on the same
host as Cog, and if it tried to connect prior to being registered with
Cog.
Now, all connections have a username and password associated with
them. All Cog-initiated connections have a username of
COG_INTERNAL
,and use a randomly-generated password that is generated at Cog startup,
allowing us to properly distinguish between Cog connections and Relay
connections.
Fixes #1034