User Tools

Site Tools


mosh:devices:bridge:moshctl

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
mosh:devices:bridge:moshctl [2026/04/21 03:45] moshmosh:devices:bridge:moshctl [2026/04/21 03:56] (current) mosh
Line 1: Line 1:
-====== moshctl User Guide ======+=====moshctl User Guide=====
  
 ''moshctl'' is the command-line client for the MOSH Admin API. It is the main user-facing tool for checking bridge health, inspecting nodes and elements, and sending commands to devices through ''moshbridge''. ''moshctl'' is the command-line client for the MOSH Admin API. It is the main user-facing tool for checking bridge health, inspecting nodes and elements, and sending commands to devices through ''moshbridge''.
Line 17: Line 17:
 ''moshctl health'' ''moshctl health''
  
-==Quick Start==+====Quick Start====
  
-=== 1. Create an API Token on the Bridge Host ===+===1. Create an API Token on the Bridge Host===
  
-Run this where <code>moshbridge</code> is installed:+Run this where ''moshbridge'' is installed:
  
-<syntaxhighlight lang="bash">+<code bash>
 moshbridge admin token --store /var/lib/mosh/adminapi_tokens.json --name moshctl-laptop moshbridge admin token --store /var/lib/mosh/adminapi_tokens.json --name moshctl-laptop
-</syntaxhighlight>+</code>
  
 This prints a raw token once. It will look something like: This prints a raw token once. It will look something like:
  
-<prespan>mtk_ab12cd_7b2XcYpL9uV3qWmR8nKs4dTfZ1eH6jQa</prespan>+''mtk_ab12cd_7b2XcYpL9uV3qWmR8nKs4dTfZ1eH6jQa''
  
 Save it right away. Save it right away.
  
-=== 2. Save the Token for <code>moshctl</code> ===+===2. Save the Token for ''moshctl''===
  
 Recommended, so the token does not end up in your shell history: Recommended, so the token does not end up in your shell history:
  
-<syntaxhighlight lang="bash">+<code bash>
 echo '<raw-token>' | moshctl auth init --token-stdin echo '<raw-token>' | moshctl auth init --token-stdin
-</syntaxhighlight>+</code>
  
 Or explicitly: Or explicitly:
  
-<syntaxhighlight lang="bash">+<code bash>
 moshctl auth init --token '<raw-token>' moshctl auth init --token '<raw-token>'
-</syntaxhighlight>+</code>
  
 By default, <code>moshctl</code> stores the token here: By default, <code>moshctl</code> stores the token here:
Line 64: Line 64:
 Unauthenticated health check: Unauthenticated health check:
  
-<syntaxhighlight lang="bash">+<code bash">
 moshctl health moshctl health
-</syntaxhighlight>+</code>
  
 Authenticated status check: Authenticated status check:
  
-<syntaxhighlight lang="bash">+<code bash>
 moshctl status moshctl status
-</syntaxhighlight>+</code>
  
 == Global Flags == == Global Flags ==
Line 84: Line 84:
 Example: Example:
  
-<syntaxhighlight lang="bash">+<code bash>
 moshctl -url http://192.168.1.50:8088 status moshctl -url http://192.168.1.50:8088 status
-</syntaxhighlight>+</code>
  
 === <code>-token-file</code> === === <code>-token-file</code> ===
Line 94: Line 94:
 Example: Example:
  
-<syntaxhighlight lang="bash">+<code bash>
 moshctl -token-file ~/.config/mosh/token status moshctl -token-file ~/.config/mosh/token status
-</syntaxhighlight>+</code>
  
 === <code>-version</code> === === <code>-version</code> ===
Line 104: Line 104:
 Example: Example:
  
-<syntaxhighlight lang="bash">+<code bash>
 moshctl -version moshctl -version
-</syntaxhighlight>+</code>
  
 == Authentication Commands == == Authentication Commands ==
  
-=== <code>moshctl auth init</code> ===+===<code>moshctl auth init</code> ===
  
 Saves a raw bearer token locally and immediately verifies that it works against the bridge. Saves a raw bearer token locally and immediately verifies that it works against the bridge.
Line 116: Line 116:
 Examples: Examples:
  
-<syntaxhighlight lang="bash">+<code bash>
 moshctl auth init --token '<raw-token>' moshctl auth init --token '<raw-token>'
-</syntaxhighlight>+</code>
  
-<syntaxhighlight lang="bash">+<code bash>
 echo '<raw-token>' | moshctl auth init --token-stdin echo '<raw-token>' | moshctl auth init --token-stdin
-</syntaxhighlight>+</code>
  
 With a custom token file: With a custom token file:
  
-<syntaxhighlight lang="bash">+<code bash>
 echo '<raw-token>' | moshctl -token-file ~/.config/mosh/lab-token auth init --token-stdin echo '<raw-token>' | moshctl -token-file ~/.config/mosh/lab-token auth init --token-stdin
-</syntaxhighlight>+</code>
  
 Notes: Notes:
  
 * The token file stores the raw bearer token, not the bcrypt hash. * The token file stores the raw bearer token, not the bcrypt hash.
-<code>moshctl</code> writes the token file with restrictive permissions.+''moshctl'' writes the token file with restrictive permissions.
 * The token is verified by making a real API call after saving it. * The token is verified by making a real API call after saving it.
  
/var/www/wiki.moshnetworks.com/data/attic/mosh/devices/bridge/moshctl.1776743108.txt.gz · Last modified: by mosh

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki