Skip to content

Commit 8fdf1c2

Browse files
retr0hJohn Dewey
andauthored
support fleet configuration (#10)
Ability to pair the sensor to Fleet. Co-authored-by: John Dewey <john.dewey@corelight.com>
1 parent 2d7446c commit 8fdf1c2

File tree

5 files changed

+77
-7
lines changed

5 files changed

+77
-7
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ module "sensor_config" {
1616
subnetwork_monitoring_cidr = "<the instance's monitoring subnetwork CIDR>"
1717
subnetwork_monitoring_gateway = "<the instance's monitoring subnetwork gateway IP>"
1818
19+
# Optional - Fleet Manager
20+
fleet_token = "b1cd099ff22ed8a41abc63929d1db126"
21+
fleet_url = "https://fleet.example.com:1443/fleet/v1/internal/softsensor/websocket"
22+
1923
# Optional - Enrichment Service
2024
enrichment_enabled = "<if cloud enrichment should enabled at time of sensor deployment>"
2125
enrichment_cloud_provider_name = "<the cloud provider name>"

cloud-config/init.tpl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,21 @@ write_files:
3232
port: ${health_port}
3333
net: ${probe}
3434
%{ endfor ~}
35+
%{ if fleet_token != "" && fleet_url != "" ~}
36+
pairing:
37+
token: ${fleet_token}
38+
url: ${fleet_url}
39+
server_sslname: ${fleet_server_sslname}
40+
%{ if fleet_http_proxy != "" ~}
41+
http_proxy: ${fleet_http_proxy}
42+
%{ endif ~}
43+
%{ if fleet_https_proxy != "" ~}
44+
https_proxy: ${fleet_https_proxy}
45+
%{ endif ~}
46+
%{ if fleet_no_proxy != "" ~}
47+
no_proxy: ${fleet_no_proxy}
48+
%{ endif ~}
49+
%{ endif ~}
3550

3651
runcmd:
3752
- corelightctl sensor deploy -v

data.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ data "cloudinit_config" "config" {
1414
mon_subnet = var.subnetwork_monitoring_cidr
1515
mon_gateway = var.subnetwork_monitoring_gateway
1616

17+
fleet_token = var.fleet_token
18+
fleet_url = var.fleet_url
19+
fleet_server_sslname = var.fleet_server_sslname
20+
fleet_http_proxy = var.fleet_http_proxy
21+
fleet_https_proxy = var.fleet_https_proxy
22+
fleet_no_proxy = var.fleet_no_proxy
23+
1724
# Optional - Cloud Enrichment Configuration
1825
enrichment_enabled = var.enrichment_enabled
1926
cloud_provider = var.enrichment_cloud_provider_name

examples/deployment/main.tf

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ locals {
77
mon_cidr = "10.3.0.0/24"
88
mon_gateway = "10.3.0.1"
99

10+
# Optional - Fleet Manager
11+
fleet_token = "b1cd099ff22ed8a41abc63929d1db126"
12+
fleet_url = "https://fleet.example.com:1443/fleet/v1/internal/softsensor/websocket"
1013

11-
# Enrichment
12-
enrichment_enabled = "<true | false>"
13-
enrichment_cloud_provider = "<aws | azure | gcp>"
14+
# Optional - Enrichment Service
15+
enrichment_enabled = false # "<true | false>"
16+
enrichment_cloud_provider = "aws" # "<aws | azure | gcp>"
1417
enrichment_storage_account_name = "account-foo"
1518
enrichment_bucket_name = "bucket-bar"
1619
enrichment_s3_bucket_region = "us-east-1"
@@ -19,7 +22,10 @@ locals {
1922
module "sensor_config" {
2023
source = "../../"
2124

22-
fleet_community_string = local.community_string
25+
fleet_community_string = local.community_string
26+
fleet_token = local.fleet_token
27+
fleet_url = local.fleet_url
28+
2329
sensor_license = local.license
2430
sensor_management_interface_name = local.mgmt_interface
2531
sensor_monitoring_interface_name = local.mon_interface

variables.tf

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,51 @@ variable "sensor_health_check_probe_source_ranges_cidr" {
4747
variable "subnetwork_monitoring_cidr" {
4848
type = string
4949
default = ""
50-
description = "(optional) the monitoring subnet for the sensor(s), leaving this empty will result in no sensor.monitoring_interface.health_check section being rendered into user data."
50+
description = "(optional) the monitoring subnet for the sensor(s), leaving this empty will result in no sensor.monitoring_interface.health_check section being rendered into user data"
5151
}
5252

5353
variable "subnetwork_monitoring_gateway" {
5454
type = string
5555
default = ""
56-
description = "(optional) the monitoring subnet's gateway address, leaving this empty will result in no sensor.monitoring_interface.health_check section being rendered into user data."
56+
description = "(optional) the monitoring subnet's gateway address, leaving this empty will result in no sensor.monitoring_interface.health_check section being rendered into user data"
57+
}
58+
59+
variable "fleet_token" {
60+
type = string
61+
default = ""
62+
sensitive = true
63+
description = "(optional) the pairing token from the Fleet UI. Must be set if 'fleet_url' is provided"
64+
}
65+
66+
variable "fleet_url" {
67+
type = string
68+
default = ""
69+
description = "(optional) the URL of the fleet instance from the Fleet UI. Must be set if 'fleet_token' is provided"
70+
}
71+
72+
variable "fleet_server_sslname" {
73+
type = string
74+
default = "1.broala.fleet.product.corelight.io"
75+
description = "(optional) the SSL hostname for the fleet server"
76+
77+
}
78+
79+
variable "fleet_http_proxy" {
80+
type = string
81+
default = ""
82+
description = "(optional) the proxy URL for HTTP traffic from the fleet"
83+
}
84+
85+
variable "fleet_https_proxy" {
86+
type = string
87+
default = ""
88+
description = "(optional) the proxy URL for HTTPS traffic from the fleet"
89+
}
90+
91+
variable "fleet_no_proxy" {
92+
type = string
93+
default = ""
94+
description = "(optional) hosts or domains to bypass the proxy for fleet traffic"
5795
}
5896

5997
# Enrichment Service
@@ -70,7 +108,7 @@ variable "enrichment_cloud_provider_name" {
70108

71109
validation {
72110
condition = contains(["", "aws", "azure", "gcp"], var.enrichment_cloud_provider_name)
73-
error_message = "allowed options: \"aws\", \"azure\", \"gcp\"."
111+
error_message = "allowed options: \"aws\", \"azure\", \"gcp\""
74112
}
75113
}
76114

0 commit comments

Comments
 (0)