This repository was archived by the owner on Nov 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 199
Bug fixes and documentation #2694
Merged
chkeita
merged 29 commits into
microsoft:main
from
chkeita:unmanaged_nodes/registration_script
Dec 16, 2022
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
959458c
rename client_id in pool to object_id
chkeita 361ebd1
fix tests
chkeita 37de8d0
print out the content body when receiving an error response in the agent
chkeita 8ee7e6c
Merge branch 'main' into rewrite/bug_fix
chkeita 99df6ac
fix test
chkeita 808a845
Merge branch 'main' into rewrite/bug_fix
chkeita 35a54f5
Apply suggestions from code review
chkeita 8b79755
Update src/ApiService/ApiService/Functions/AgentRegistration.cs
chkeita 407ad5e
format
chkeita 937f887
cleanup
chkeita 07f0d20
Merge branch 'main' into rewrite/bug_fix
chkeita 4e2531b
format
chkeita 8d8b7d5
Merge branch 'main' into rewrite/bug_fix
chkeita f6d694e
Bug fixes and documentation
chkeita db091da
Merge branch 'main' into unmanaged_nodes/registration_script
chkeita 5f06cb3
update doc
chkeita ff1ad07
format
chkeita 5d967f1
format
chkeita ef21440
build fix
chkeita f024164
format
chkeita 2bd90c3
Merge branch 'main' into unmanaged_nodes/registration_script
chkeita e0b2aa4
Merge branch 'main' into unmanaged_nodes/registration_script
chkeita fad65cc
Apply suggestions from code review
chkeita bc6d667
skip reimage of unmanaged nodes
chkeita 3cfc6e2
update set-env
chkeita 5a9a504
update doc
chkeita 60a35b8
Merge branch 'main' into unmanaged_nodes/registration_script
chkeita e03abfd
address comment
chkeita e31a405
Merge branch 'main' into unmanaged_nodes/registration_script
chkeita File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| # Unmanaged Nodes | ||
| 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. | ||
| This is the unmanaged scenario. In this mode, the user can use their own resource to participate in the fuzzing. | ||
|
|
||
| ## Set-up | ||
| These are the steps to run an unmanaged node | ||
|
|
||
|
|
||
| ### Create an Application Registration in Azure Active Directory | ||
| We will create the authentication method for the unmanaged node. | ||
| From the [azure cli](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) create a new **application registration**: | ||
| ```cmd | ||
| az ad app create --display-name <registration_name> | ||
| ``` | ||
| Then use the application `app_id` in the result to create the associated **service principal**: | ||
|
|
||
| ```cmd | ||
| az ad sp create --id <app_id> | ||
| ``` | ||
| Take note of the `id` returned by this request. We will call it the `principal_id`. | ||
|
|
||
| Next, create a `client_secret`: | ||
|
|
||
| ``` | ||
| az ad app credential reset --id <pp_id> --append | ||
| ``` | ||
| Take note of the `password` returned. | ||
|
|
||
| ### Authorize the application in OneFuzz | ||
| From the OneFuzz `deployment` folder run the following script using the `app_id` from above: | ||
| ``` cmd | ||
| python .\deploylib\registration.py register_app <onefuzz_instance_id> <subscription_id> --app_id <app_id> --role UnmanagedNode | ||
| ``` | ||
|
|
||
| ### Create an unmanaged pool | ||
| Using the OneFuzz CLI: | ||
| ``` cmd | ||
| onefuzz pools create <pool_name> <os> --unmanaged --object_id <principal_id> | ||
| ``` | ||
|
|
||
| ### Download the agent binaries and the agent configuration | ||
| Download a zip file containing the agent binaries: | ||
| ``` | ||
| onefuzz tools get <destination_folder> | ||
| ``` | ||
| Extract the zip file in a folder of your choice. | ||
|
|
||
| Download the configuration file for the agent: | ||
|
|
||
| ``` | ||
| onefuzz pools get_config <pool_name> | ||
| ``` | ||
|
|
||
| Under the `client_credential` section of the agent config file, update `client_id` and `client_secret`: | ||
| ```json | ||
| { | ||
| "client_id": "<app_id>", | ||
| "client_secret": "<password>", | ||
| } | ||
| ``` | ||
| Save the config to the file. | ||
|
|
||
| ### Start the agent. | ||
| Navigate to the folder corresponding to your OS. | ||
| Set the necessary environment variable by running the script `set-env.ps1` (for Windows) or `set-env.sh` (for Linux). | ||
| Run the agent with the following command. If you need more nodes use a different `machine_guid` for each one: | ||
| ```cmd | ||
| onefuzz-agent run --machine_id <machine_guid> -c <path_to_config_file> --reset_lock | ||
| ``` | ||
|
|
||
| ### Verify that the agent is registered to OneFuzz | ||
|
|
||
| Using the OneFuzz CLI run the following command: | ||
|
|
||
| ``` | ||
| onefuzz nodes get <machine_guid> | ||
| ``` | ||
|
|
||
| This should return one entry. Verify that the `pool_name` matched the pool name created earlier. | ||
| From here you will be able to schedule jobs on that pool and they will be running. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT License. | ||
| export DOTNET_ROOT=/onefuzz/tools/dotnet | ||
| export DOTNET_CLI_HOME="$DOTNET_ROOT" | ||
| export LLVM_SYMBOLIZER_PATH=/onefuzz/bin/llvm-symbolizer | ||
| export RUST_LOG = "info" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT License. | ||
|
|
||
| $env:Path += ";C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\;C:\onefuzz\win64;C:\onefuzz\tools\win64;C:\onefuzz\tools\win64\radamsa;$env:ProgramFiles\LLVM\bin" | ||
| $env:LLVM_SYMBOLIZER_PATH = "C:\Program Files\LLVM\bin\llvm-symbolizer.exe" | ||
| $env:RUST_LOG = "info" | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.