remoteRF-server-testing 0.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- remoteRF_server/__init__.py +0 -0
- remoteRF_server/common/__init__.py +0 -0
- remoteRF_server/common/grpc/__init__.py +1 -0
- remoteRF_server/common/grpc/grpc_host_pb2.py +63 -0
- remoteRF_server/common/grpc/grpc_host_pb2_grpc.py +97 -0
- remoteRF_server/common/grpc/grpc_pb2.py +59 -0
- remoteRF_server/common/grpc/grpc_pb2_grpc.py +97 -0
- remoteRF_server/common/idl/__init__.py +1 -0
- remoteRF_server/common/idl/device_schema.py +39 -0
- remoteRF_server/common/idl/pluto_schema.py +174 -0
- remoteRF_server/common/idl/schema.py +358 -0
- remoteRF_server/common/utils/__init__.py +6 -0
- remoteRF_server/common/utils/ansi_codes.py +120 -0
- remoteRF_server/common/utils/api_token.py +21 -0
- remoteRF_server/common/utils/db_connection.py +35 -0
- remoteRF_server/common/utils/db_location.py +24 -0
- remoteRF_server/common/utils/list_string.py +5 -0
- remoteRF_server/common/utils/process_arg.py +80 -0
- remoteRF_server/drivers/__init__.py +0 -0
- remoteRF_server/drivers/adalm_pluto/__init__.py +0 -0
- remoteRF_server/drivers/adalm_pluto/pluto_remote_server.py +105 -0
- remoteRF_server/host/__init__.py +0 -0
- remoteRF_server/host/host_auth_token.py +292 -0
- remoteRF_server/host/host_directory_store.py +142 -0
- remoteRF_server/host/host_tunnel_server.py +1388 -0
- remoteRF_server/server/__init__.py +0 -0
- remoteRF_server/server/acc_perms.py +317 -0
- remoteRF_server/server/cert_provider.py +184 -0
- remoteRF_server/server/device_manager.py +688 -0
- remoteRF_server/server/grpc_server.py +1023 -0
- remoteRF_server/server/reservation.py +811 -0
- remoteRF_server/server/rpc_manager.py +104 -0
- remoteRF_server/server/user_group_cli.py +723 -0
- remoteRF_server/server/user_group_handler.py +1120 -0
- remoteRF_server/serverrf_cli.py +1377 -0
- remoteRF_server/tools/__init__.py +191 -0
- remoteRF_server/tools/gen_certs.py +274 -0
- remoteRF_server/tools/gist_status.py +139 -0
- remoteRF_server/tools/gist_status_testing.py +67 -0
- remoterf_server_testing-0.0.0.dist-info/METADATA +612 -0
- remoterf_server_testing-0.0.0.dist-info/RECORD +44 -0
- remoterf_server_testing-0.0.0.dist-info/WHEEL +5 -0
- remoterf_server_testing-0.0.0.dist-info/entry_points.txt +2 -0
- remoterf_server_testing-0.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,612 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: remoteRF-server-testing
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: RemoteRF server-side control package
|
|
5
|
+
Requires-Python: >=3.8
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: grpcio
|
|
8
|
+
Requires-Dist: protobuf
|
|
9
|
+
Requires-Dist: numpy
|
|
10
|
+
Requires-Dist: prompt_toolkit
|
|
11
|
+
Requires-Dist: python-dotenv
|
|
12
|
+
Requires-Dist: grpcio-tools
|
|
13
|
+
Requires-Dist: requests
|
|
14
|
+
Requires-Dist: pyyaml
|
|
15
|
+
|
|
16
|
+
# Remote RF Server Guide (Linux)
|
|
17
|
+
|
|
18
|
+
## Environment and setup
|
|
19
|
+
|
|
20
|
+
This guide installs Miniconda, installs **mamba**, creates a conda env named `remoterf`, installs dependencies, and verifies the install on Ubuntu Server 24.04 LTS.
|
|
21
|
+
|
|
22
|
+
* This guide is done **APT-based** distro (Ubuntu/Debian/Raspberry Pi OS 64-bit).
|
|
23
|
+
|
|
24
|
+
### 1) System Prerequisites
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
sudo apt update
|
|
28
|
+
sudo apt install -y curl ca-certificates bzip2 git build-essential
|
|
29
|
+
sudo apt install -y libusb-1.0-0 udev
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Optional: confirm architecture:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
uname -m
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
* `x86_64` → Intel/AMD
|
|
39
|
+
* `aarch64` → ARM64 (Raspberry Pi 64-bit, some servers)
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
### 2) Install Miniconda
|
|
44
|
+
|
|
45
|
+
### 2.1 Download the installer
|
|
46
|
+
|
|
47
|
+
#### x86_64
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
cd /tmp
|
|
51
|
+
curl -fsSLO https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### ARM64 (aarch64)
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
cd /tmp
|
|
58
|
+
curl -fsSLO https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 2.2 Install (non-interactive, recommended)
|
|
62
|
+
|
|
63
|
+
#### x86_64
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
bash Miniconda3-latest-Linux-x86_64.sh -b -p "$HOME/miniconda3"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
#### ARM64 (aarch64)
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
bash Miniconda3-latest-Linux-aarch64.sh -b -p "$HOME/miniconda3"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 2.3 Enable conda in your current shell
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
source "$HOME/miniconda3/etc/profile.d/conda.sh"
|
|
79
|
+
conda --version
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
> If you want conda available automatically in new terminals:
|
|
83
|
+
>
|
|
84
|
+
> ```bash
|
|
85
|
+
> "$HOME/miniconda3/bin/conda" init bash
|
|
86
|
+
> source ~/.bashrc
|
|
87
|
+
> ```
|
|
88
|
+
|
|
89
|
+
### 2.4 Install **mamba** (default solver)
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
conda install -n base -c conda-forge -y mamba
|
|
93
|
+
mamba --version
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Might have to accept anaconda TOS.
|
|
97
|
+
```bash
|
|
98
|
+
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main
|
|
99
|
+
|
|
100
|
+
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 3) Create the Environment
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
mamba create -n remoterf -y -c conda-forge -c defaults python=3.10 pip setuptools wheel grpcio protobuf python-dotenv numpy scipy libiio pylibiio libusb
|
|
107
|
+
|
|
108
|
+
conda activate remoterf
|
|
109
|
+
python -m pip install -U pip
|
|
110
|
+
python -m pip install pyadi-iio remoterf-server
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Server Config
|
|
114
|
+
|
|
115
|
+
Depending on your IT/ISP setup, this will vary, but regardless, you will need a static dial name, whether that be a IP address or a DNS.
|
|
116
|
+
|
|
117
|
+
### Generate CA Certificates
|
|
118
|
+
|
|
119
|
+
If direct IP connection: (force overrides existing)
|
|
120
|
+
```bash
|
|
121
|
+
serverrf --gen-certs 192.168.1.50 --days 3650 --force
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
If using DNS: (todo: DNS on client side)
|
|
125
|
+
```bash
|
|
126
|
+
serverrf --gen-certs 192.168.1.50 --dns remoterf.local --days 3650 --force
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Confirm/View:
|
|
130
|
+
```bash
|
|
131
|
+
serverrf --show-certs
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Specify Outward facing Ports
|
|
135
|
+
|
|
136
|
+
By default, the users expect to adjacent ports. Thus, it is recommended to do the following:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# examples
|
|
140
|
+
serverrf --config --main-port 61000 --cert-port 61001
|
|
141
|
+
serverrf --config --main-port 20000 --cert-port 20001
|
|
142
|
+
serverrf --config --main-port 32000 --cert-port 32001
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Confirm/View:
|
|
146
|
+
```bash
|
|
147
|
+
serverrf --config --show
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Testing Connection
|
|
151
|
+
|
|
152
|
+
The server now should be functional in its most basic form. In the same conda env:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
serverrf --serve
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
If you see something along the lines of: self.socket.bind(self.server_address) PermissionError: [Errno 13] Permission Denied, make sure the ports you are using are not OS reserved (<1024)
|
|
159
|
+
|
|
160
|
+
### Confirm it works locally
|
|
161
|
+
|
|
162
|
+
<!-- In a new terminal:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
mamba create -n local_testing -y python=3.10 pip
|
|
166
|
+
conda activate local_testing
|
|
167
|
+
pip install remoterf
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Testing: In the remoterf env run: -->
|
|
171
|
+
|
|
172
|
+
Start the server:
|
|
173
|
+
```bash
|
|
174
|
+
serverrf -s
|
|
175
|
+
```
|
|
176
|
+
Take note of the Local IP and Local Port, for example, if you see:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
Local IP: 164.67.195.210
|
|
180
|
+
Local Port: 61000
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
then run the below on a seperate terminal (make sure to keep serverrf -s RUNNING!)
|
|
184
|
+
|
|
185
|
+
Confirm that its reachable:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
nc -vz 164.67.195.210 61000
|
|
189
|
+
nc -vz 164.67.195.210 61001
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
<!-- ```bash
|
|
193
|
+
remoterf -c -a 164.67.195.210:61000
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
If sucessful, it should look something like this:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
gRPC target : 164.67.195.210:61000
|
|
200
|
+
cert port : 164.67.195.210:61001
|
|
201
|
+
CA cert : /home/remoterf-dev/.config/remoterf/certs/default.crt
|
|
202
|
+
env file : /home/remoterf-dev/.config/remoterf/.env
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
If it fails, please troubleshoot, and make sure that the serverrf -s is actually running, and that you have no firewalls, etc.
|
|
206
|
+
|
|
207
|
+
Cleanup:
|
|
208
|
+
```bash
|
|
209
|
+
conda env remove -n local_testing
|
|
210
|
+
``` -->
|
|
211
|
+
|
|
212
|
+
### Network Testing
|
|
213
|
+
|
|
214
|
+
Same test, but on a different computer. Works for UNIX based machines:
|
|
215
|
+
|
|
216
|
+
Confirm that the Server is reachable:
|
|
217
|
+
```bash
|
|
218
|
+
nc -vz 164.67.195.210 61000
|
|
219
|
+
nc -vz 164.67.195.210 61001
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
You most likely will need to port forward, etc.
|
|
223
|
+
|
|
224
|
+
Troubleshooting:
|
|
225
|
+
Some distros come with default firewall settings that block traffic on specific ports. Make sure that your firewall settings permit traffic to and from the server. Depending on the setup, you may also have ISP firewalls.
|
|
226
|
+
|
|
227
|
+
## Server Device Configuration
|
|
228
|
+
|
|
229
|
+
Currently, only Adalm Plutos are supported.
|
|
230
|
+
|
|
231
|
+
To connect plutos to the server:
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
iio_info -s
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
If the pluto doesn't show up, yet the below works:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
sudo iio_info -s
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Run the below and reboot after:
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
sudo groupadd -f plugdev
|
|
247
|
+
sudo usermod -aG plugdev "$USER"
|
|
248
|
+
|
|
249
|
+
sudo tee /etc/udev/rules.d/53-adi-usb.rules >/dev/null <<'EOF'
|
|
250
|
+
# Type the below in
|
|
251
|
+
SUBSYSTEM=="usb", ATTR{idVendor}=="0456", MODE="0660", GROUP="plugdev"
|
|
252
|
+
EOF
|
|
253
|
+
|
|
254
|
+
sudo udevadm control --reload-rules
|
|
255
|
+
sudo udevadm trigger
|
|
256
|
+
sudo reboot now
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
The below should work as intended now:
|
|
260
|
+
```bash
|
|
261
|
+
iio_info -s
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
Look for 'serial='. Take note of this serial.
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
serverrf --device --add --pluto <device_id:name:serial>
|
|
268
|
+
|
|
269
|
+
# example
|
|
270
|
+
serverrf --device --add --pluto 0:pluto_0:104473f6
|
|
271
|
+
serverrf --device --add --pluto "1:Pluto SDR (OTA):58472j"
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Run the below to check if this new device exists:
|
|
275
|
+
```bash
|
|
276
|
+
serverrf --device --show
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Run the below to edit names of existing devices:
|
|
280
|
+
```bash
|
|
281
|
+
serverrf -d --edit-name 0 "New Name"
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
Note that all device and server config parameters need a 'restart' to take affect (ctrl + c -> serverrf -s).
|
|
285
|
+
|
|
286
|
+
## Server Runtime Configuration
|
|
287
|
+
|
|
288
|
+
After running `serverrf --serve`, you’ll enter the **RemoteRF Server Shell**. This interactive shell is used for runtime administration: users, devices, reservations, user groups, enrollment codes, and live host-tunnel state.
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
### Server
|
|
293
|
+
|
|
294
|
+
* `help` / `h` / `?` — Show help
|
|
295
|
+
* `clear` / `cls` — Clear the screen
|
|
296
|
+
* `status` / `server status` — Show server status (start time / uptime / bind + cert ports)
|
|
297
|
+
* `quit` / `exit` / `q` — Exit the server shell
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
### Users
|
|
302
|
+
|
|
303
|
+
* `users list` — List all accounts
|
|
304
|
+
* `users manage` — Manage a specific user (perms / delete / reservations)
|
|
305
|
+
* `users purge` — Delete **all** users
|
|
306
|
+
* `users perms` — Show permissions table
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
### Devices
|
|
311
|
+
|
|
312
|
+
* `devices list` — List all devices
|
|
313
|
+
* `devices status` — Show live device routing/online/last_seen from the Host Tunnel
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
### Reservations
|
|
318
|
+
|
|
319
|
+
* `reservations list` — List all reservations
|
|
320
|
+
* `reservations purge` — Delete **all** reservations
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
### Groups
|
|
325
|
+
|
|
326
|
+
* `groups list` — List user groups
|
|
327
|
+
* `groups create` — Create a user group *(interactive)*
|
|
328
|
+
* `groups edit` — Edit a user group *(interactive)*
|
|
329
|
+
* `groups delete` — Delete a user group *(interactive)*
|
|
330
|
+
* `groups csv` — Export all groups as a CSV
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
### Enrollment Codes
|
|
335
|
+
|
|
336
|
+
* `codes list` — List enrollment codes
|
|
337
|
+
* `codes create` — Create enrollment codes *(interactive)*
|
|
338
|
+
* `codes delete` — Delete an enrollment code *(interactive)*
|
|
339
|
+
* `codes csv` — Export all codes as a CSV
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
### Host Tunnel
|
|
344
|
+
|
|
345
|
+
* `hosts status` — Show live host online/last_seen and associated devices
|
|
346
|
+
* `hosts wipe` — Wipe persisted host directory state and clear in-memory registry *(prompts for confirmation)*
|
|
347
|
+
* `hosts wipe -y` / `hosts wipe --yes` — Same as above, no prompt
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
### Database
|
|
352
|
+
|
|
353
|
+
* `db purge` — Remove all database entries
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
## Adding Hosts
|
|
357
|
+
|
|
358
|
+
You will need, for each host, to run this first on the server CLI:
|
|
359
|
+
|
|
360
|
+
```bash
|
|
361
|
+
serverrf --host --token-create host-name --length 8
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
Which will return the corresponding command to run on the respective host to give that host access to the server. Below are some other related commands (ie: 'whitelists' hosts)
|
|
365
|
+
|
|
366
|
+
```bash
|
|
367
|
+
serverrf --host --show
|
|
368
|
+
serverrf --host --delete host-name
|
|
369
|
+
serverrf --host --wipe
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
## Status (Optional)
|
|
373
|
+
|
|
374
|
+
If you desire to pull the server information (ie: live updates of reservation, server usage parameters, etc.)
|
|
375
|
+
|
|
376
|
+
It uses GitHub Gists to push the status updates.
|
|
377
|
+
|
|
378
|
+
Create public gist on your github. Keep note of the file name: (example)
|
|
379
|
+
https://gist.github.com/ethange1/2a35e08a90bf88a70dfe7f42a55685ed
|
|
380
|
+
|
|
381
|
+
The last one is the "GIST_ID" part of the URL, e.g. "2a35e08a90bf88a70dfe7f42a55685ed"
|
|
382
|
+
|
|
383
|
+
Creating the GitHub PAT Token
|
|
384
|
+
|
|
385
|
+
* GitHub → Settings
|
|
386
|
+
* Developer settings
|
|
387
|
+
* Personal access tokens → Fine-grained tokens
|
|
388
|
+
* Generate new token
|
|
389
|
+
* Set repository access to "Public Respositories"
|
|
390
|
+
* Permissions: enable Gists: Read and write
|
|
391
|
+
* Generate + copy the token (you only see it once)
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
serverrf --gist --set --id <gist_id> --file <filename>
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
Run the server normally, and you should see your gist change every minute!
|
|
398
|
+
|
|
399
|
+
```bash
|
|
400
|
+
serverrf -s
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
<!-- todo: -->
|
|
404
|
+
<!-- Adding plutos via the CLI -->
|
|
405
|
+
<!-- Testing functionality (disregarding Host pipeline) -->
|
|
406
|
+
<!-- Clean up serverrf CLI + basic documentation for all commands, usergroups, export codes by CSV. -->
|
|
407
|
+
|
|
408
|
+
<!-- HostRF meta data -> push upon connection + retry connection on host side. -->
|
|
409
|
+
|
|
410
|
+
<!-- Host ID (NEEDS TO BE UNIQUE AND TELL THE HOST THAT) (or if device also does it as well.) -->
|
|
411
|
+
|
|
412
|
+
<!-- ServerRF display meta data as part of devices list / reservation -->
|
|
413
|
+
|
|
414
|
+
<!-- + online/activity status (appended into device name) + (plus host side warning if the device id is NOT globally unique!)
|
|
415
|
+
|
|
416
|
+
Test local pluto on server (to make sure nothing broke!)
|
|
417
|
+
|
|
418
|
+
set_device token (virtual devices) + routing/relay to proper host (multiplexed) + host side pipeline
|
|
419
|
+
|
|
420
|
+
Test local pluto on server (to make sure nothing broke!)
|
|
421
|
+
|
|
422
|
+
User side testing + integration
|
|
423
|
+
|
|
424
|
+
hostrf side CLI/server (basically just device list)
|
|
425
|
+
|
|
426
|
+
edge case testing (disconnected hosts, disconnected server, many users using multiple devices, multi-host) -->
|
|
427
|
+
|
|
428
|
+
<!-- HostRF integration -> Host directory, device routing, dynamic reservation pulling, with activity/status (online, offline, etc.) -->
|
|
429
|
+
|
|
430
|
+
<!-- Cleanup code comments. -->
|
|
431
|
+
|
|
432
|
+
<!-- Update Ian with installation demo (try myself first on the NUC once!) for both server and host.
|
|
433
|
+
|
|
434
|
+
Nice to have (later):
|
|
435
|
+
Activity/stats?
|
|
436
|
+
Ability to remotely manage groups and codes as admin.
|
|
437
|
+
Choice to choose usergroup/code by either int id or string name. (too lazy)
|
|
438
|
+
|
|
439
|
+
todo: Specify/Pull user side --config CLI pointing to this server + debug for connection sake (later) -->
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
<!-- # Remote RF Linux Server
|
|
443
|
+
|
|
444
|
+
A python codebase to host the remoteRF Platform.
|
|
445
|
+
|
|
446
|
+
Courtesy of Wireless Lab @ UCLA. - Ethan Ge
|
|
447
|
+
|
|
448
|
+
## Prerequisites
|
|
449
|
+
|
|
450
|
+
- **Local Linux Computer**: You will need a linux based machine to run the server, along with the networking that goes along with it.
|
|
451
|
+
|
|
452
|
+
- **Python 3.12**: Honestly I am not sure what minimum version is required. But 3.12 for sure works. If you don’t have Python installed, you can download it from the [official Python website](https://www.python.org/downloads/).
|
|
453
|
+
To check your current Python version, open a terminal and run:
|
|
454
|
+
|
|
455
|
+
```bash
|
|
456
|
+
python --version
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
- **Adalm Pluto Python Drivers**: You will need to install this if you wish to use the adalm pluto SDR. [Adalm Pluto Python Drivers](https://pysdr.org/content/pluto.html).
|
|
460
|
+
|
|
461
|
+
- **Other Devices**: At the moment, although a couple other devices are loosely supported, the Pluto is the only 'full support' device. More can be easily added though.
|
|
462
|
+
|
|
463
|
+
## Installation
|
|
464
|
+
|
|
465
|
+
### **Note**:
|
|
466
|
+
These instructions are confirmed to be working on Fedora LTS Server build. Although nothing should need changing on different distros, I cannot confirm nor deny that.
|
|
467
|
+
|
|
468
|
+
### **Clone Repo**:
|
|
469
|
+
First clone the server repo [here](https://github.com/WirelessLabAtUCLA/RemoteRF-Server).
|
|
470
|
+
|
|
471
|
+
### **Python Dependencies**:
|
|
472
|
+
Navigate to the cloned repo. Run the below commands. Mind that a python virtual environment `VENV` is recommended, although given device drivers, it may not be the easiest.
|
|
473
|
+
|
|
474
|
+
```bash
|
|
475
|
+
python3 -m venv venv # Create venv folder
|
|
476
|
+
source venv/bin/activate # Activate venv
|
|
477
|
+
|
|
478
|
+
pip install setuptools -e . # Auto installs dependencies
|
|
479
|
+
|
|
480
|
+
RRRFserver # Run Remote RF Server
|
|
481
|
+
```
|
|
482
|
+
If you have errors, such as `ModuleNotFoundError: No module named 'adi'`, yet you are able to use the adi package elsewhere, such as in the global interpreter, you will need to update your python path to include the adi package, which you should've installed earlier from [here](https://pysdr.org/content/pluto.html).
|
|
483
|
+
|
|
484
|
+
If you are too lazy to do so, you can just repeat the same steps but on the global python interpreter, which should solve the issue, albeit a less clean solution.
|
|
485
|
+
|
|
486
|
+
## Configuration
|
|
487
|
+
|
|
488
|
+
Now onto the configuration of the server for use. Server script needs to be restarted for config to take place.
|
|
489
|
+
|
|
490
|
+
### Network parameters:
|
|
491
|
+
The server requires a specified port as well as a manual IP to be set. You can do an online search for "how to input manual IP address for OS TYPE".
|
|
492
|
+
|
|
493
|
+
Navigate to `src/remoteRF_server/certs` directory.
|
|
494
|
+
```bash
|
|
495
|
+
cd src/remoteRF_server/certs # From repo root
|
|
496
|
+
|
|
497
|
+
openssl req -newkey rsa:2048 -nodes -keyout server.key -x509 -days 365 -out server.crt -subj "/CN=XXX.XX.XXX.XXX" -addext "subjectAltName=IP:XXX.XX.XXX.XXX" # Generate the certs. Replace XXX.XX.XXX.XXX with the server IP.
|
|
498
|
+
```
|
|
499
|
+
Navigate to `src/remoteRF_server/server/.env.server`.
|
|
500
|
+
```bash
|
|
501
|
+
GRPC_PORT='XXXXX' # Replace XXXXX with the server port.
|
|
502
|
+
```
|
|
503
|
+
Copy the internals of `/certs`, and replace the remoteRF-Client cert folder with these new certificates. This is done as **BOTH** the client and server need to have access to the same generated certificates for secure HTTPs transfer.
|
|
504
|
+
|
|
505
|
+
### Device parameters:
|
|
506
|
+
|
|
507
|
+
Navigate to `src/remoteRF_server/server/device_manager.py`. Scroll down until you see:
|
|
508
|
+
```python
|
|
509
|
+
devices = { # device, salt, hash
|
|
510
|
+
0: (connect_pluto(usb='1.6.5'), '', ''),
|
|
511
|
+
1: (connect_pluto(usb='1.7.5'), '', ''),
|
|
512
|
+
# ...
|
|
513
|
+
}
|
|
514
|
+
```
|
|
515
|
+
To add more devices, simply duplicate the item and increment the device id. You also need to configure the usb port. To find this value, run this in the terminal once you have connected your desired devices.
|
|
516
|
+
```bash
|
|
517
|
+
iio_info -s # displays usb port info
|
|
518
|
+
```
|
|
519
|
+
```bash
|
|
520
|
+
Available contexts:
|
|
521
|
+
0: (jc42,coretemp,pch_skylake,nouveau,acpitz,jc42,dell_smm,hidpp_battery_0,nvme on Dell Inc.) [local:]
|
|
522
|
+
1: 0456:b673 (Analog Devices Inc. PlutoSDR (ADALM-PLUTO)), serial=10447392da110010f9ff1500612ff8ecb0 [usb:1.6.5]
|
|
523
|
+
# Use this `usb:1.6.5` as the input for the device init
|
|
524
|
+
```
|
|
525
|
+
Under `devices` there is also `device_info`. Update this accordingly. This is what is displayed when users request to see what devices there are.
|
|
526
|
+
|
|
527
|
+
Remember to update default permissions and the like! Otherwise users won't be able to add the new devices.
|
|
528
|
+
|
|
529
|
+
### Permission parameters:
|
|
530
|
+
|
|
531
|
+
In the repo, navigate to `src/remoteRF_server/server/acc_perms.py`. You should see:
|
|
532
|
+
```python
|
|
533
|
+
class userperms:
|
|
534
|
+
def __init__(self): # default user perms settings
|
|
535
|
+
self.id = 'user'
|
|
536
|
+
self.max_reservations = 1
|
|
537
|
+
self.max_reservation_time_sec = 3600
|
|
538
|
+
self.devices_allowed = [0, 1] # device ID
|
|
539
|
+
```
|
|
540
|
+
Here, you can set the default user perms. This default is given to all 'normal users', and is also the permission level when users first make their accounts. For the other two tiers of users, they are configured on run time when the server is running. The server saves all run time changes so no data hypothetically can be lost.
|
|
541
|
+
|
|
542
|
+
### .Proto regen:
|
|
543
|
+
Only needed if, well, you need to update the base networking.
|
|
544
|
+
```bash
|
|
545
|
+
pip install --upgrade grpcio grpcio-tools protobuf
|
|
546
|
+
|
|
547
|
+
cd src/remoteRF_server/common/grpc
|
|
548
|
+
python -m grpc_tools.protoc \
|
|
549
|
+
-I=. \
|
|
550
|
+
--python_out=. \
|
|
551
|
+
--grpc_python_out=. \
|
|
552
|
+
grpc.proto
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
## Time to Serve!
|
|
556
|
+
|
|
557
|
+
Once your basic config is setup, you can begin testing the basics of the server!
|
|
558
|
+
|
|
559
|
+
```bash
|
|
560
|
+
RRRFserver # Start the server
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
Given my weird setup, this is what I did to make it work:
|
|
564
|
+
New Terminal
|
|
565
|
+
cd Documents/GitHub/RemoteRF-Server
|
|
566
|
+
sudo pip install -e . (don't use pip3)
|
|
567
|
+
sudo RRRFserver
|
|
568
|
+
|
|
569
|
+
IF the changes you make don't seem to apply ...
|
|
570
|
+
which RRRFserver
|
|
571
|
+
What worked for me (if u accidently use pip3)
|
|
572
|
+
sudo python3 -m pip uninstall RemoteRF-Server (destroy pip3)
|
|
573
|
+
|
|
574
|
+
Bruh ....
|
|
575
|
+
|
|
576
|
+
python3 -m pip uninstall -y remoteRF_server RRRFserver || true
|
|
577
|
+
rm -f ~/.local/bin/RRRFserver
|
|
578
|
+
hash -r
|
|
579
|
+
|
|
580
|
+
python3 -m pip install -e . --user --force-reinstall
|
|
581
|
+
hash -r
|
|
582
|
+
|
|
583
|
+
Type `help` to see the list of commands. They are pretty self explanatory. Run them and try it out! You can use arrow keys to cycle commands.
|
|
584
|
+
|
|
585
|
+
```bash
|
|
586
|
+
'exit' - Stop server.
|
|
587
|
+
'help' - Help.
|
|
588
|
+
'clear' - Clear terminal screen.
|
|
589
|
+
'printa' - Print all accounts
|
|
590
|
+
'printd' - Print all devices
|
|
591
|
+
'printp' - Print all perms
|
|
592
|
+
'printr' - Print all reservations
|
|
593
|
+
'rm aa' - Remove all accounts
|
|
594
|
+
'rm a' - Remove one account
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
Follow the [README](https://github.com/WirelessLabAtUCLA/RemoteRF-Client/blob/main/README.md) on this repo to configure the client side.
|
|
598
|
+
|
|
599
|
+
I would suggest first trying to connect locally (on the same machine), and then remotely. You do not need the VPN if you are testing locally or on LAN. If all goes well, the server should be now ready for use!
|
|
600
|
+
|
|
601
|
+
**WARNING**: The current system distributes the private certificates. It is safe as UCLA wraps the network in a VPN, however if you open the server to all of the internet, this approach can be very dangerous.
|
|
602
|
+
|
|
603
|
+
## Troubleshooting
|
|
604
|
+
I had a variety of issues setting up the server. Here is a list of steps to take if the server refuses to connect:
|
|
605
|
+
|
|
606
|
+
### Server Certificates:
|
|
607
|
+
Confirm that the server certs were generated with the right IPs, and that the existing server certs weren't expired. If you are not sure how to check them, just regenerate them. Remember that if you do regenerate you will need to give the client a exact copy of those certs as well.
|
|
608
|
+
|
|
609
|
+
### Local Firewall:
|
|
610
|
+
Some distros come with default firewall settings that block traffic on specific ports. Make sure that your firewall settings permit traffic to and from the server.
|
|
611
|
+
|
|
612
|
+
- **ISP Firewall**: If doing this on UCLA Campus, they block and manage much of the traffic. You will need to submit a [Firewall Access Form](https://www.seasnet.ucla.edu/firewall-access-request/). -->
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
remoteRF_server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
remoteRF_server/serverrf_cli.py,sha256=ndw0hKPnaYmrhm5f5BvmjHBrFmLHJMhC5S0EIUR6kss,41810
|
|
3
|
+
remoteRF_server/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
remoteRF_server/common/grpc/__init__.py,sha256=GYLHC7riDbjdx2cNOhWymt0GLZ4mtGhuzZAXVRfNynw,37
|
|
5
|
+
remoteRF_server/common/grpc/grpc_host_pb2.py,sha256=RD1ifcnVO6NXtacta73fMj-E98K4dwVt9VoijfQgxqg,5160
|
|
6
|
+
remoteRF_server/common/grpc/grpc_host_pb2_grpc.py,sha256=DDcBZpXVUWkb3LQB0Vo9NiQuyj_JraEebpIofrsNyDs,3418
|
|
7
|
+
remoteRF_server/common/grpc/grpc_pb2.py,sha256=iMdLw3xly_2WjirEmVaxf7I8iiUmk-3YRqqIiRdNkPs,4082
|
|
8
|
+
remoteRF_server/common/grpc/grpc_pb2_grpc.py,sha256=NofKaB3t0nAm_uxDgA5WXhWcsRWqsyfuMEEdBrosVKk,3368
|
|
9
|
+
remoteRF_server/common/idl/__init__.py,sha256=cgW6Igj1ocX6heFpiZNGY68ryX5pbsHpkKBB-BlQiZ4,58
|
|
10
|
+
remoteRF_server/common/idl/device_schema.py,sha256=roM04tWiKOW7MCdt38HtUM_tHLWTh_cc-A01fGH_n6k,1684
|
|
11
|
+
remoteRF_server/common/idl/pluto_schema.py,sha256=YBnc9enk0tmhF1zwkEV83VfLbk2n2PP5ks5Vtr6aYYk,4568
|
|
12
|
+
remoteRF_server/common/idl/schema.py,sha256=RaI-X7txj_uk7eC-JHza0xUBM46Piz0Dw2QlLv46n5U,13696
|
|
13
|
+
remoteRF_server/common/utils/__init__.py,sha256=qGlvhmk9WHBBH6uBTU0vVRoI0h5ZGkYp9dA1UejuIdQ,332
|
|
14
|
+
remoteRF_server/common/utils/ansi_codes.py,sha256=knGLOJK-lyDjfQHL0Upq5UPTg6J_6WYldga-ZOaerSs,3052
|
|
15
|
+
remoteRF_server/common/utils/api_token.py,sha256=BgjIioVYyMDCdwl68gF55EGERCu-52h2v6NU_NvZid8,844
|
|
16
|
+
remoteRF_server/common/utils/db_connection.py,sha256=XEQCclI8_micJkaVxG-PaAkvjbilngaqj1G-wn4TrsQ,1117
|
|
17
|
+
remoteRF_server/common/utils/db_location.py,sha256=14eLMzssG-kjPx6-MuCkm7O_3AzyPUd6VP4XtqdDIe0,642
|
|
18
|
+
remoteRF_server/common/utils/list_string.py,sha256=qsch666vX2e3CZ2W5EdYi62dOk37k1v2yPpHHm47a7A,156
|
|
19
|
+
remoteRF_server/common/utils/process_arg.py,sha256=J1REqgjm-1daqTBdVASgDd-16y-KneOJpCZXPEOklVk,2971
|
|
20
|
+
remoteRF_server/drivers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
|
+
remoteRF_server/drivers/adalm_pluto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
+
remoteRF_server/drivers/adalm_pluto/pluto_remote_server.py,sha256=iAnE-qb_Ivt4lJyfj1_v3f96z6wAPk-jTv5GnX1SHjY,4617
|
|
23
|
+
remoteRF_server/host/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
|
+
remoteRF_server/host/host_auth_token.py,sha256=gN9atAbL6raPmWi05R4QgaZ7ruw3dCw0vjyJEB0dOwY,8574
|
|
25
|
+
remoteRF_server/host/host_directory_store.py,sha256=0G6KjIry8M62tD9IfD0wcL4KTC5wmZxFqV7pY-_JYKY,4207
|
|
26
|
+
remoteRF_server/host/host_tunnel_server.py,sha256=YbnIancQ4C9omWrpnY4TiMzrqVkxx-bHo0ChejEFF-Y,55301
|
|
27
|
+
remoteRF_server/server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
|
+
remoteRF_server/server/acc_perms.py,sha256=6u2F5Ytdyr_vGNHinIahYxsZACKBRqkjRLAJxSqEj0w,12274
|
|
29
|
+
remoteRF_server/server/cert_provider.py,sha256=gOhVFkuZ5YSF4lOYunlo3QZ9wwSojSRZTQk8-zuoFOg,5608
|
|
30
|
+
remoteRF_server/server/device_manager.py,sha256=gqG3X6Vf5wDURICW6e8nSGKObS23_C2d4vGD3dH5vuw,20338
|
|
31
|
+
remoteRF_server/server/grpc_server.py,sha256=8jYEk2vfpGsbErwRYrXUcSUmdPvdn1gdBptCpsIaAcE,39701
|
|
32
|
+
remoteRF_server/server/reservation.py,sha256=wIoOwKOHDYFO-jdwyP9d8YGfTqCoQnwtgfdzizk9fXs,31684
|
|
33
|
+
remoteRF_server/server/rpc_manager.py,sha256=GfUPJczq6qwvJQk1TJDMOnLt-UlQNRPi2hBvYdtE1bM,3941
|
|
34
|
+
remoteRF_server/server/user_group_cli.py,sha256=EUwOiWXV6W0q2J2XNNvgItUdrmqZ47fCzkoPgUy8Odg,23362
|
|
35
|
+
remoteRF_server/server/user_group_handler.py,sha256=IMnDl_1D0ctcLNtx6RECXbTqkUeBslUReHdSc5sG-BA,37511
|
|
36
|
+
remoteRF_server/tools/__init__.py,sha256=ogYCIP1cE9WfYouomoayngzdxtWPrLbCCPYj1URosz8,6041
|
|
37
|
+
remoteRF_server/tools/gen_certs.py,sha256=Uwx3VOsMgXSEO63aAfSTzHW4zkyV0RCcs848ricn_2M,8287
|
|
38
|
+
remoteRF_server/tools/gist_status.py,sha256=d6dkgisi00OidZ1l5PyEitOk8bhxFVlVfKA660j8YzU,4025
|
|
39
|
+
remoteRF_server/tools/gist_status_testing.py,sha256=TVIdIuVY-DXWxQG-LuUkOaoUd-W41TDTEOOjhltdtJI,2022
|
|
40
|
+
remoterf_server_testing-0.0.0.dist-info/METADATA,sha256=37ixTbRvHTszZ-G46m4yg-qC5YSciOmG4LhmQvs0Zzc,18763
|
|
41
|
+
remoterf_server_testing-0.0.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
42
|
+
remoterf_server_testing-0.0.0.dist-info/entry_points.txt,sha256=qS1XjccYJd62tSqKnqR2JM-RP64x2HPsREv7IZ9ltnU,63
|
|
43
|
+
remoterf_server_testing-0.0.0.dist-info/top_level.txt,sha256=TKqKJWaby5sQnSM8qJbd_Sylh9TNfme8sL4RTbstFR4,16
|
|
44
|
+
remoterf_server_testing-0.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
remoteRF_server
|