-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds ability to change Lacework Server URL (#20)
* feat: Add Lacework Server Url * fix: Correct var SERVERURL -> SERVER_URL * fix: Correct var SERVERURL -> SERVER_URL * docs: Use EU url in example * style: Remove space * fix: Serverurl name * refactor: render Agent config.json When there are no settings, the config.json will look like this: ``` $ render_agent_config Updating the Lacework agent config.json file... { "tokens": { "AccessToken": "foo" }, "tags": {} } ``` Setting up TAGS: ``` $ TAGS='{"foo":"bar"}' $ render_agent_config Updating the Lacework agent config.json file... { "tokens": { "AccessToken": "foo" }, "tags": {"foo":"bar"} } ``` Setting up SERVER_URL: ``` $ SERVER_URL=bubulubu $ render_agent_config Updating the Lacework agent config.json file... { "tokens": { "AccessToken": "foo" }, "serverurl": "bubulubu", "tags": {"foo":"bar"} } ``` * refactor: setup_lacework_agent.sh script * docs: add custom server url example * docs: update all examples/ Signed-off-by: Darren Murray darren.murray@lacework.net Signed-off-by: Salim Afiune Maya <afiune@lacework.net>
- Loading branch information
1 parent
74ed7cf
commit 4c9f0a6
Showing
15 changed files
with
345 additions
and
72 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
terraform { | ||
required_version = ">= 0.12.0" | ||
required_version = ">= 0.12.31" | ||
|
||
required_providers { | ||
aws = "~> 3.0" | ||
lacework = { | ||
source = "lacework/lacework" | ||
version = "~> 0.2.13" | ||
version = "~> 0.4" | ||
} | ||
} | ||
} |
This file contains 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,19 @@ | ||
# AWS SSM Command using a Custom Agent Build Hash | ||
|
||
This example shows how to customize the version of the Lacework Agent | ||
that will be installed on the Linux EC2 intances. | ||
|
||
To get the Agent Build Hash (`lacework_agent_build_hash`) contact support@lacework.net. | ||
|
||
```hcl | ||
provider "aws" { | ||
region = "us-west-2" | ||
} | ||
module "lacework_ssm_agents_install_custom_agent_build_hash" { | ||
source = "lacework/ssm-agent/aws" | ||
version = "~> 0.4" | ||
lacework_agent_build_hash = "3.7.2_2021-03-26_branch_123HASH" | ||
} | ||
``` |
This file contains 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 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,17 @@ | ||
# AWS SSM Command using a Custom Server URL | ||
|
||
This example shows how to customize the Agent Server URL for | ||
EU deployments. | ||
|
||
```hcl | ||
provider "aws" { | ||
region = "us-west-2" | ||
} | ||
module "lacework_ssm_agents_install_custom_server_url" { | ||
source = "lacework/ssm-agent/aws" | ||
version = "~> 0.4" | ||
lacework_server_url = "https://api.fra.lacework.net" | ||
} | ||
``` |
This file contains 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,42 @@ | ||
provider "aws" { | ||
region = "us-west-2" | ||
} | ||
|
||
provider "lacework" {} | ||
|
||
resource "lacework_agent_access_token" "ssm_deployment" { | ||
name = "ssm-deployment" | ||
description = "Used to deploy agents using AWS System Manager" | ||
} | ||
|
||
module "lacework_ssm_agents_install_custom_server_url" { | ||
source = "../../" | ||
|
||
lacework_access_token = lacework_agent_access_token.ssm_deployment.token | ||
lacework_server_url = "https://api.fra.lacework.net" | ||
} | ||
|
||
resource "aws_resourcegroups_group" "testing" { | ||
name = "Testing" | ||
|
||
resource_query { | ||
query = jsonencode({ | ||
ResourceTypeFilters = [ | ||
"AWS::EC2::Instance" | ||
] | ||
}) | ||
} | ||
} | ||
|
||
resource "aws_ssm_association" "lacework_aws_ssm_agents_install_testing" { | ||
association_name = "install-lacework-agents-testing-group" | ||
|
||
name = module.lacework_ssm_agents_install_custom_server_url.ssm_document_name | ||
|
||
targets { | ||
key = "resource-groups:Name" | ||
values = [ | ||
aws_resourcegroups_group.testing.name, | ||
] | ||
} | ||
} |
This file contains 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,11 @@ | ||
terraform { | ||
required_version = ">= 0.12.31" | ||
|
||
required_providers { | ||
aws = "~> 3.0" | ||
lacework = { | ||
source = "lacework/lacework" | ||
version = "~> 0.4" | ||
} | ||
} | ||
} |
This file contains 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 |
---|---|---|
@@ -1,3 +1,69 @@ | ||
# Default AWS SSM command deployment | ||
|
||
This example deploys into AWS an AWS SSM Command that can be used to install the Lacework agent on a Linux EC2 instance. | ||
This example deploys into AWS an AWS SSM Command that can be used to install | ||
the Lacework agent on a Linux EC2 instance. | ||
|
||
```hcl | ||
provider "aws" { | ||
region = "us-east-1" | ||
} | ||
module "lacework_aws_ssm_agents_install" { | ||
source = "lacework/ssm-agent/aws" | ||
version = "~> 0.4" | ||
lacework_agent_tags = { | ||
env = "dev" | ||
} | ||
aws_resources_tags = { | ||
billing = "testing" | ||
owner = "myself" | ||
} | ||
} | ||
resource "aws_resourcegroups_group" "testing" { | ||
name = "Testing" | ||
resource_query { | ||
query = jsonencode({ | ||
ResourceTypeFilters = [ | ||
"AWS::EC2::Instance" | ||
] | ||
TagFilters = [ | ||
{ | ||
Key = "environment" | ||
Values = [ | ||
"Testing" | ||
] | ||
} | ||
] | ||
}) | ||
} | ||
tags = { | ||
billing = "testing" | ||
owner = "myself" | ||
} | ||
} | ||
resource "aws_ssm_association" "lacework_aws_ssm_agents_install_testing" { | ||
association_name = "install-lacework-agents-testing-group" | ||
name = module.lacework_aws_ssm_agents_install.ssm_document_name | ||
targets { | ||
key = "resource-groups:Name" | ||
values = [ | ||
aws_resourcegroups_group.testing.name, | ||
] | ||
} | ||
parameters = { | ||
Token = "my-lacework-token" | ||
} | ||
compliance_severity = "HIGH" | ||
} | ||
``` |
This file contains 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
terraform { | ||
required_version = ">= 0.12.0" | ||
required_version = ">= 0.12.31" | ||
|
||
required_providers { | ||
aws = "~> 3.0" | ||
|
This file contains 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 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.