Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.

Commit 49543cf

Browse files
authored
Ipc between agent and task (#2912)
* . * It doesn't work yet but we're making progress * Added graceful shutdown and tests * Small fix * Fix crate issues * test fix * Fix build * make clippy happy * The order changed * Use timeout in kill * Almost done shutting down ipc * It should all work now * Update deny.toml * Fix warning
1 parent a374939 commit 49543cf

File tree

18 files changed

+553
-61
lines changed

18 files changed

+553
-61
lines changed

docs/unmanaged-nodes.md

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,61 @@
11
# Unmanaged Nodes
2+
23
The default mode of OneFuzz is to run the agents inside scalesets managed by the the Onefuzz instance. But it is possible to run outside of the Instance infrastructure.
34
This is the unmanaged scenario. In this mode, the user can use their own resource to participate in the fuzzing.
45

56
## Set-up
6-
These are the steps to run an unmanaged node.
77

8+
These are the steps to run an unmanaged node.
89

910
### Create an Application Registration in Azure Active Directory
11+
1012
Create the authentication method for the unmanaged node.
1113
From the [azure cli](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) create a new **application registration**:
14+
1215
```cmd
1316
az ad app create --display-name <registration_name>
1417
```
18+
1519
Then use the application's `app_id` in the newly created application registration to create the associated **service principal**:
1620

1721
```cmd
1822
az ad sp create --id <app_id>
1923
```
24+
2025
Take note of the `id` returned by this request. We will call it the `principal_id`.
2126

2227
Next, create a `client_secret`:
2328

2429
```
25-
az ad app credential reset --id <pp_id> --append
30+
az ad app credential reset --id <app_id> --append
2631
```
32+
2733
Take note of the `password` returned.
2834

2935
### Authorize the application in OneFuzz
36+
3037
From the OneFuzz `deployment` folder run the following script using the `app_id` from above:
31-
``` cmd
38+
39+
```cmd
3240
python .\deploylib\registration.py register_app <onefuzz_instance_id> <subscription_id> --app_id <app_id> --role UnmanagedNode
3341
```
3442

3543
### Create an unmanaged pool
44+
3645
Using the OneFuzz CLI:
37-
``` cmd
46+
47+
```cmd
3848
onefuzz pools create <pool_name> <os> --unmanaged --object_id <principal_id>
3949
```
4050

4151
### Download the agent binaries and the agent configuration
52+
4253
Download a zip file containing the agent binaries:
54+
4355
```
4456
onefuzz tools get <destination_folder>
4557
```
58+
4659
Extract the zip file in a folder of your choice.
4760

4861
Download the configuration file for the agent:
@@ -52,28 +65,35 @@ onefuzz pools get_config <pool_name>
5265
```
5366

5467
Under the `client_credential` section of the agent config file, update `client_id` and `client_secret`:
68+
5569
```json
5670
{
57-
"client_id": "<app_id>",
58-
"client_secret": "<password>",
71+
"client_id": "<app_id>",
72+
"client_secret": "<password>"
5973
}
6074
```
75+
6176
Save the config to the file.
6277

6378
### Start the agent.
79+
6480
Navigate to the folder corresponding to your OS.
6581
Set the necessary environment variable by running the script `set-env.ps1` (for Windows) or `set-env.sh` (for Linux).
6682
Run the agent with the following command. If you need more nodes, use a different `machine_guid` for each one:
83+
6784
```cmd
6885
onefuzz-agent run --machine_id <machine_guid> -c <path_to_config_file> --reset_lock
6986
```
7087

7188
Alternatively, the agent folder contains a Dockerfile which provide the configuration of a docker container.
7289
you can use it by first building the container
90+
7391
```cmd
7492
docker build --t <container_name> .
7593
```
94+
7695
Then start the agent inside the container
96+
7797
```cmd
7898
docker run <container_name> --machine_id <machine_id> --reset_lock
7999
```
@@ -89,32 +109,36 @@ onefuzz nodes get <machine_guid>
89109
This should return one entry. Verify that the `pool_name` matched the pool name created earlier.
90110
From here you will be able to schedule jobs on that pool and they will run.
91111

92-
93112
## Troubleshooting
94113

95114
### increase the verbosity of the logs
115+
96116
It can help when investigating issues to increase the log verbosity. you will need to set the [RUST_LOG](https://docs.rs/env_logger/latest/env_logger/#enabling-logging) environment variable when starting docker
97117

98118
```
99119
docker run --rm --env RUST_LOG=<log_level> <image_name> --machine_id <machine_id>
100120
```
121+
101122
log_level can be any of
123+
102124
- error
103125
- warn
104126
- info
105127
- debug
106128
- trace
107129

108-
109130
### use the container interactively
131+
110132
you can use the container interactively by with the following command
111133

112134
windows
135+
113136
```
114137
docker run --it --rm --entrypoint powershell <image_name>
115138
```
116139

117140
linux
141+
118142
```
119143
docker run --it --rm --entrypoint bash <image_name>
120144
```

0 commit comments

Comments
 (0)