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:35] moshmosh:devices:bridge:moshctl [2026/04/21 03:56] (current) mosh
Line 1: Line 1:
-====== moshctl User Guide ======+=====moshctl User Guide=====
  
-<code>moshctl</code> 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 <code>moshbridge</code>.+''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''.
  
 This guide reflects the current CLI behavior in the codebase and the auth flow currently running on the server. This guide reflects the current CLI behavior in the codebase and the auth flow currently running on the server.
  
-== What <code>moshctl</code> Talks To ==+===What ''moshctl'' Talks To===
  
-<code>moshctl</code> sends HTTP requests to the MOSH Admin API exposed by <code>moshbridge</code>.+''moshctl'' sends HTTP requests to the MOSH Admin API exposed by ''moshbridge''.
  
 The current default API URL is: The current default API URL is:
  
-<pre> +''http://127.0.0.1:8088''
-http://127.0.0.1:8088 +
-</pre>+
  
 Most commands require a bearer token. The only command intended to work without a token is: Most commands require a bearer token. The only command intended to work without a token is:
  
-<pre> +''moshctl health''
-moshctl health +
-</pre>+
  
-== 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:
  
-<pre> +''mtk_ab12cd_7b2XcYpL9uV3qWmR8nKs4dTfZ1eH6jQa''
-mtk_ab12cd_7b2XcYpL9uV3qWmR8nKs4dTfZ1eH6jQa +
-</pre>+
  
 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 70: 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 90: 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 100: 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 110: 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 122: 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.1776742507.txt.gz · Last modified: by mosh

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki