meshtastic/docs/configuration/remote-admin.mdx

204 lines
8.2 KiB
Plaintext
Raw Normal View History

2021-05-01 10:51:51 -07:00
---
2022-11-03 17:10:08 -07:00
id: remote-admin
2022-11-02 13:21:48 -07:00
title: Remote Node Administration
sidebar_label: Remote Nodes
2023-09-19 21:40:54 -07:00
sidebar_position: 3
description: An advanced feature which allows remote administration of a device through a secure channel on the Mesh instead of via Bluetooth, Serial, or IPv4.
2021-05-01 10:51:51 -07:00
---
2022-11-07 20:53:52 -08:00
:::caution Disclaimer
This is an advanced feature that few users should need. Keep in mind that it is possible (if you are not careful) to assign settings to a remote node that cause it to completely drop off of your mesh. We advise network admins have a test node to test settings with before applying changes to a remote node to prevent this.
:::
This feature allows you to remotely administer Meshtastic nodes through the mesh.
## Prerequisites
For any node that you want to administer, you must:
1. Configure a channel with the channel name of `admin`.
2. Set the PSK for the `admin` channel with the same key you wish to administer other all other nodes of the mesh with.
2021-05-01 10:51:51 -07:00
## Creating the admin channel
By default, nodes will **only** respond to administrative commands via the local USB/Bluetooth/TCP interface. This provides basic security to prevent unauthorized access and is how normal administration and settings changes work. The only difference for the remote case is that we are sending those commands over the mesh.
2021-05-01 10:51:51 -07:00
Before a node will allow remote admin access, it must have a primary channel:
2023-06-14 23:12:47 -07:00
```shell title="Command"
meshtastic --info
```
```markdown title="Expected output"
2021-05-01 10:51:51 -07:00
Connected to radio
...
Channels:
2022-12-11 13:37:56 -08:00
PRIMARY psk=default { "psk": "AQ==" }
Primary channel URL: https://meshtastic.org/e/#CgMSAQESCggBOANAA0gBUBs
2021-05-01 10:51:51 -07:00
```
2023-06-14 23:12:47 -07:00
From this output you see can that this node knows about only one channel and that its PSK is set to the default value.
2021-05-01 10:51:51 -07:00
Now we add an admin channel:
2021-05-01 10:51:51 -07:00
:::note
The name of the channel is important and must be `admin`.
2021-05-01 10:51:51 -07:00
:::
2023-06-14 23:12:47 -07:00
```shell title="Command"
meshtastic --ch-add admin
```
```shell title="Expected output"
2021-05-01 10:51:51 -07:00
Connected to radio
Writing modified channels to device
2023-06-14 23:12:47 -07:00
```
Run `meshtastic --info` and your channels will now look like this:
```shell title="Expected output"
2021-05-01 10:51:51 -07:00
Connected to radio
...
Channels:
2022-12-11 13:37:56 -08:00
PRIMARY psk=default { "psk": "AQ==" }
SECONDARY psk=secret { "psk": "YyDCitupTAOOXTcaMDxyNhDpPa3eThiQFziPFCqT0mo=", "name": "admin" }
Primary channel URL: https://meshtastic.org/e/#CgMSAQESCggBOANAA0gBUBs
Complete URL (includes all channels): https://meshtastic.org/e/#CgMSAQEKKRIgYyDCitupTAOOXTcaMDxyNhDpPa3eThiQFziPFCqT0moaBWFkbWluEgoIATgDQANIAVAb
2021-05-01 10:51:51 -07:00
```
2023-06-14 23:12:47 -07:00
Notice that now we have a new secondary channel and the `--info` option prints out TWO URLs. The `Complete URL` includes all of the channels this node understands. The URL contains the preshared keys and should be treated with caution and kept a secret. When deploying remote administration, you only need the node you want to administer and the node you are locally connected to, to know this new "admin" channel. All of the other nodes will forward the packets as long as they are a member of the primary channel.
2021-05-01 10:51:51 -07:00
## Sharing the admin channel with other nodes
2023-06-14 23:12:47 -07:00
Creating an "admin" channel automatically generates a preshared key. In order to administer other nodes remotely, we need to copy the preshared key to the new nodes.
2021-05-01 10:51:51 -07:00
For this step you need physical access to both the nodes.
1. Create the "admin" channel on the "local node" using the instructions above.
2. Copy the "Complete URL" someplace for permanent reference/access.
3. Connect to the "remote node" over the USB port.
4. For the "remote node" type
```shell
meshtastic --seturl the-url-from-step-2
```
2023-11-15 16:36:05 -08:00
2021-05-01 10:51:51 -07:00
5. Run `meshtastic --info` and confirm that the "Complete URL" is the same for both of the nodes.
2023-06-14 23:12:47 -07:00
At this point you can take your remote node and install it far away. You will still be able to change any of its settings.
2021-05-01 10:51:51 -07:00
## Remotely administering your node
2023-06-14 23:12:47 -07:00
Now that both your local node and the remote node contain your secret admin channel key, you can now change settings remotely:
2021-05-01 10:51:51 -07:00
Get the node list from the local node:
2023-06-14 23:12:47 -07:00
```shell title="Command"
meshtastic --nodes
```
```markdown title="Expected output"
2021-05-01 10:51:51 -07:00
Connected to radio
/-------------------------------------------------------------------------------------------------------------\
|N| User |AKA| ID |Latitude|Longitude|Altitude|Battery| SNR | LastHeard | Since |
|-+------------+---+---------+--------+---------+--------+-------+---------+-------------------+--------------|
|1|Unknown 9058|?58|!28979058|25.0382°|121.5731°| N/A | N/A |-13.50 dB|2021-03-22 09:25:42|19 seconds ago|
\-------------------------------------------------------------------------------------------------------------/
```
Using the node ID from that list, send a message through the mesh telling that node to change its owner name.
:::info
The --dest argument value must be in single quotes for linux/mac: '!28979058', no quotes for Windows: !28979058.
:::
2023-06-14 23:12:47 -07:00
```shell title="Command"
meshtastic --dest '!28979058' --set-owner "Im Remote"
```
```markdown title="Expected output"
2021-05-01 10:51:51 -07:00
Connected to radio
Setting device owner to Im Remote
2023-06-14 23:12:47 -07:00
Waiting for an acknowledgment from remote node (this could take a while)
2021-05-01 10:51:51 -07:00
```
And you can now confirm via the local node that the remote node has changed:
2023-06-14 23:12:47 -07:00
```shell title="Command"
meshtastic --nodes
```
```markdown title="Expected output"
2021-05-01 10:51:51 -07:00
Connected to radio
/----------------------------------------------------------------------------------------------------\
|N| User |AKA| ID | Position |Battery| SNR | LastHeard | Since |
|-+---------+---+---------+------------------------+-------+-------+-------------------+-------------|
|1|Im Remote|IR |!28979058|25.0382°, 121.5731°, N/A| N/A |8.75 dB|2021-03-22 09:35:42|3 minutes ago|
\----------------------------------------------------------------------------------------------------/
```
2023-06-14 23:12:47 -07:00
Note: you can change **any** parameter, add channels or get settings from the remote node. Here's an example of setting ls_secs using the `--set` command and printing the position settings from the remote node using the `--get` command:
2021-05-01 10:51:51 -07:00
2023-06-14 23:12:47 -07:00
```shell title="Command"
meshtastic --dest '!28979058' --set power.ls_secs 301 --get position
```
```markdown title="Expected output"
2021-05-01 10:51:51 -07:00
Connected to radio
2023-06-14 23:12:47 -07:00
Requesting current config from remote node (this can take a while).
power:
wait_bluetooth_secs: 60
mesh_sds_timeout_secs: 7200
sds_secs: 4294967295
ls_secs: 300
min_wake_secs: 10
Set power.ls_secs to 301
2021-05-01 10:51:51 -07:00
Writing modified preferences to device
2023-06-14 23:12:47 -07:00
Requesting current config from remote node (this can take a while).
Received an ACK.
Completed getting preferences
Waiting for an acknowledgment from remote node (this could take a while)
position:
position_broadcast_secs: 900
position_broadcast_smart_enabled: true
gps_enabled: true
gps_update_interval: 120
gps_attempt_time: 900
position_flags: 3
rx_gpio: 15
tx_gpio: 13
broadcast_smart_minimum_distance: 100
broadcast_smart_minimum_interval_secs: 30
2021-05-01 10:51:51 -07:00
2023-06-14 23:12:47 -07:00
Completed getting preferences
```
2023-06-14 23:12:47 -07:00
To set the `hop_limit` to 4 and then get the lora settings to confirm your new settings:
2023-06-14 23:12:47 -07:00
```shell title="Command"
meshtastic --dest '!28979058' --set lora.hop_limit 4 --get lora
```
```markdown title="Expected output"
lora:
use_preset: true
region: US
hop_limit: 3
tx_enabled: true
tx_power: 30
Set lora.hop_limit to 4
Writing modified preferences to device
Requesting current config from remote node (this can take a while).
Received an ACK.
Completed getting preferences
2023-06-14 23:12:47 -07:00
Waiting for an acknowledgment from remote node (this could take a while)
lora:
use_preset: true
region: US
hop_limit: 4
tx_enabled: true
tx_power: 30
```
2023-06-14 23:12:47 -07:00
## Admin Channel Setup is Complete
You've finished setting up and adding two devices to the admin channel. Remember, because this is a mesh network, it doesn't matter which node you are at; you could administer your first device we set up from the second one we added to the channel. And the settings and examples on this page are just a taste of the other settings you can set.
2023-06-14 23:12:47 -07:00
For further reading, I recommend starting out with the [Meshtastic Python CLI Guide](/docs/software/python/cli/) if you haven't already gone through this (hopefully you have since you are reading this). But for a full reference to the settings you can change, please see:
2023-09-28 19:10:42 -07:00
[Settings Overview](/docs/configuration) and
[Complete list of user settings in Protobufs](https://buf.build/meshtastic/protobufs/docs/main:meshtastic#meshtastic.User)