-
Notifications
You must be signed in to change notification settings - Fork 11
Optional Kali Linux attack box for Azure deployments #354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
aa9df3b
feat(azure): add optional Kali Linux attack box
mkultraWasHere 3f6ce1c
chore: regenerate terraform-azure-kali docs after instance_size change
mkultraWasHere e1b62a7
fix: clarify ephemeral_key_output_path is conditionally required
mkultraWasHere f8afcf8
Merge branch 'main' into feat/azure-kali-attack-box
mkultraWasHere 19f42a4
fix: reduce runBastionSSH complexity and add terraform-docs markers
mkultraWasHere 18af48d
chore: commit terraform-azure-kali lock file
mkultraWasHere df98874
fix: add config.Init() to runcmd and ssm PersistentPreRunE
mkultraWasHere 11a5eb8
fix: use terraform registry in lock file and guard authType on key
mkultraWasHere 96eed1e
fix: gate all role defaults on key existence and case-insensitive ter…
mkultraWasHere 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
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
78 changes: 78 additions & 0 deletions
78
infra/azure/goad-deployment/test/centralus/kali/terragrunt.hcl
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,78 @@ | ||
| # ============================================================================= | ||
| # Optional Kali Linux Attack Box | ||
| # | ||
| # Deploys a headless Kali VM on its own subnet for attacking the lab from | ||
| # inside the VNet. Access is via Azure Bastion SSH — no public IP. | ||
| # | ||
| # Enable by setting DREADGOAD_ENABLE_AZURE_KALI=true before Terragrunt runs, | ||
| # or use `dreadgoad infra apply --with-kali`. Requires marketplace terms to be | ||
| # accepted: az vm image terms accept --publisher kali-linux --offer kali --plan kali-2026-2 | ||
| # ============================================================================= | ||
|
|
||
| exclude { | ||
| if = lower(get_env("DREADGOAD_ENABLE_AZURE_KALI", "false")) != "true" | ||
| actions = ["all"] | ||
| } | ||
|
|
||
| locals { | ||
| env_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) | ||
| region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl")) | ||
|
|
||
| env = local.env_vars.locals.env | ||
| deployment_name = local.env_vars.locals.deployment_name | ||
| location = local.region_vars.locals.location | ||
|
|
||
| kali_subnet_cidr = local.env_vars.locals.kali_subnet_cidr | ||
| kali_ssh_source_address_prefix = local.env_vars.locals.kali_ssh_source_address_prefix | ||
| kali_instance_size = local.env_vars.locals.kali_instance_size | ||
|
|
||
| # SSH key resolution — same 3-tier pattern as the controller module. | ||
| ssh_key_inline = get_env("DREADGOAD_AZURE_KALI_SSH_KEY", "") | ||
| ssh_key_path_var = get_env("DREADGOAD_AZURE_KALI_SSH_KEY_PATH", "") | ||
| ssh_key_from_path = local.ssh_key_path_var != "" && fileexists(local.ssh_key_path_var) ? trimspace(file(local.ssh_key_path_var)) : "" | ||
| admin_ssh_public_key = ( | ||
| local.ssh_key_inline != "" ? local.ssh_key_inline : | ||
| local.ssh_key_from_path != "" ? local.ssh_key_from_path : | ||
| null | ||
| ) | ||
|
|
||
| ephemeral_key_path = pathexpand("~/.dreadgoad/keys/azure-${local.env}-${local.deployment_name}-kali") | ||
| } | ||
|
|
||
| terraform { | ||
| source = "${get_repo_root()}/modules//terraform-azure-kali" | ||
| } | ||
|
|
||
| dependency "network" { | ||
| config_path = "../network" | ||
| mock_outputs = { | ||
| resource_group_name = "mock-rg" | ||
| location = "centralus" | ||
| vnet_name = "mock-vnet" | ||
| } | ||
| mock_outputs_allowed_terraform_commands = ["init", "validate", "plan"] | ||
| } | ||
|
|
||
| include "root" { | ||
| path = find_in_parent_folders("root.hcl") | ||
| } | ||
|
|
||
| inputs = { | ||
| env = local.env | ||
| deployment_name = local.deployment_name | ||
| location = dependency.network.outputs.location | ||
| resource_group_name = dependency.network.outputs.resource_group_name | ||
| virtual_network_name = dependency.network.outputs.vnet_name | ||
|
|
||
| kali_subnet_cidr = local.kali_subnet_cidr | ||
| ssh_source_address_prefix = local.kali_ssh_source_address_prefix | ||
| instance_size = local.kali_instance_size | ||
|
|
||
| admin_ssh_public_key = local.admin_ssh_public_key | ||
| ephemeral_key_output_path = local.ephemeral_key_path | ||
|
|
||
| additional_tags = { | ||
| Project = "DreadGOAD" | ||
| Lab = "${local.deployment_name}-goad" | ||
| } | ||
| } |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refuted.
resolveAzureHost(line 195) already calledFindInstanceByHostnameto resolve the VM ID moments earlier — the data is cached or at worst one extra API call (~200ms) before an interactive SSH session. The pre-existing controller code made the same unconditional lookup. Adding flag-changed guards would add complexity for negligible gain.