-
Notifications
You must be signed in to change notification settings - Fork 0
Replace bjw-s app-template with SINTEF Mosquitto chart v0.1.1 #182
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot delete this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| # MQTT Broker (Mosquitto) - OnePassword Setup | ||
|
|
||
| ## Overview | ||
|
|
||
| This directory contains the Kubernetes resources for deploying Mosquitto MQTT broker in the `infra-mqtt` namespace. The broker uses the SINTEF Mosquitto Helm chart and authenticates users via credentials stored in 1Password. | ||
|
|
||
| ## 1Password Item Configuration | ||
|
|
||
| ### Item Location | ||
| - **Vault**: `HomeLab` | ||
| - **Item Name**: `mosquitto-auth` | ||
|
|
||
| ### Required Fields | ||
|
|
||
| The 1Password item must contain a field named **`passwords.conf`** (exact name, case-sensitive) with the following content format: | ||
|
|
||
| ``` | ||
| admin:<password-hash> | ||
| ``` | ||
|
|
||
| ### Generating Password Hashes | ||
|
|
||
| Use the `mosquitto_passwd` utility to generate password hashes: | ||
|
|
||
| ```bash | ||
| # Install mosquitto clients (if not already installed) | ||
| # On macOS: | ||
| brew install mosquitto | ||
|
|
||
| # On Debian/Ubuntu: | ||
| sudo apt-get install mosquitto | ||
|
|
||
| # Generate a password file with a user | ||
| mosquitto_passwd -c /tmp/mosquitto_passwd admin | ||
| # Enter password when prompted | ||
|
|
||
| # View the generated hash | ||
| cat /tmp/mosquitto_passwd | ||
| ``` | ||
|
|
||
| The output will look like: | ||
| ``` | ||
| admin:$7$101$...hash...$...hash... | ||
| ``` | ||
|
|
||
| Copy the entire line (including username and hash) into the `passwords.conf` field in 1Password. | ||
|
|
||
| ### Adding Multiple Users | ||
|
|
||
| To add multiple users, run `mosquitto_passwd` without the `-c` flag to append: | ||
|
|
||
| ```bash | ||
| # Add another user to existing file | ||
| mosquitto_passwd /tmp/mosquitto_passwd user2 | ||
|
|
||
| # View all users | ||
| cat /tmp/mosquitto_passwd | ||
| ``` | ||
|
|
||
| Then copy all lines into the `passwords.conf` field in 1Password: | ||
| ``` | ||
| admin:$7$101$...hash1... | ||
| user2:$7$101$...hash2... | ||
| ``` | ||
|
|
||
| ## Deployment | ||
|
|
||
| The deployment is managed by ArgoCD: | ||
|
|
||
| 1. **Sync Wave 10**: `mqtt-broker-secrets` app deploys the OnePasswordItem CRD | ||
| - Creates Kubernetes Secret `mosquitto-auth` in namespace `infra-mqtt` | ||
| - Secret key `passwords.conf` contains the password file content | ||
|
|
||
| 2. **Sync Wave 20**: `mqtt-broker` app deploys the Mosquitto Helm chart | ||
| - Uses the SINTEF Mosquitto chart from `https://sintef.github.io/mosquitto-helm-chart` | ||
| - References the `mosquitto-auth` secret for user authentication | ||
|
|
||
| ## ACL Configuration | ||
|
|
||
| Access control is configured in the ArgoCD Application values: | ||
|
|
||
| ```yaml | ||
| auth: | ||
| users: | ||
| - username: admin | ||
| acl: | ||
| - topic: "#" | ||
| access: readwrite | ||
| ``` | ||
|
|
||
| - The `username` must match a username in the `passwords.conf` secret | ||
| - The `password` field in values is ignored when using `usersExistingSecret` | ||
| - ACL rules grant the admin user full access to all topics (`#`) | ||
|
|
||
| ## Service | ||
|
|
||
| The MQTT broker is exposed as a ClusterIP service on port 1883: | ||
| - **Service Name**: `mosquitto` (managed by Helm) | ||
| - **Port**: 1883 (MQTT) | ||
| - **Websockets**: Disabled | ||
|
|
||
| ## Security Notes | ||
|
|
||
| - Anonymous access is disabled | ||
| - Authentication is required for all connections | ||
| - Passwords are stored in 1Password, not in Git | ||
| - Password hashes use SHA512-PBKDF2 format (Mosquitto default) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot remove the comment, and just remove the password field from this file since it's ignored anyway.