-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from GSA-TTS/test-egress-proxy
Test egress proxy generator
- Loading branch information
Showing
20 changed files
with
223 additions
and
32 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
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,54 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require "tmpdir" | ||
require "optparse" | ||
|
||
options = {} | ||
parser = OptionParser.new do |opt| | ||
opt.on("-s", "--space SPACE", "The space apps are running in") { |o| options[:space] = o unless o == "" } | ||
opt.on("-a", "--apps APPLICATION", "Comma-separated list of cloud.gov apps to be proxied") { |o| options[:apps] = o unless o == "" } | ||
opt.on("-r", "--repo PROXY_REPOSITORY", "Address of egress proxy git repo. Default: https://github.com/GSA-TTS/cg-egress-proxy.git") { |o| options[:repo] = o unless o == "" } | ||
opt.on("-v", "--version PROXY_VERSION", "Git ref (sha, tag, branch) to deploy from repo. Default: main") { |o| options[:version] = o unless o == "" } | ||
end | ||
parser.parse! | ||
|
||
if options[:space].nil? | ||
warn "--space is a required argument" | ||
puts parser | ||
exit 1 | ||
end | ||
if options[:apps].nil? | ||
warn "--apps is a required argument" | ||
puts parser | ||
exit 1 | ||
end | ||
proxy_repo = options[:repo].nil? ? "https://github.com/GSA-TTS/cg-egress-proxy.git" : options[:repo] | ||
proxy_version = options[:version].nil? ? "main" : options[:version] | ||
|
||
def run(command) | ||
system(command) or exit $?.exitstatus | ||
end | ||
|
||
directory = File.dirname(__FILE__) | ||
|
||
run "#{File.join(directory, "set_space_egress.sh")} -s #{options[:space]} -t" | ||
run "#{File.join(directory, "set_space_egress.sh")} -s #{options[:space]}-egress -p" | ||
|
||
Dir.mktmpdir do |dir| | ||
run "git clone #{proxy_repo} #{dir}" | ||
run "cd #{dir}; git checkout #{proxy_version}" | ||
config_dir = File.join(directory, "../../config/deployment/egress_proxy") | ||
options[:apps].split(",").each do |app| | ||
begin | ||
FileUtils.cp File.join(config_dir, "#{app}.allow.acl"), dir | ||
rescue | ||
warn "config/deployment/egress_proxy/#{app}.allow.acl did not exist. Please create it if you need to customize the app's allow rules" | ||
end | ||
begin | ||
FileUtils.cp File.join(config_dir, "#{app}.deny.acl"), dir | ||
rescue | ||
warn "config/deployment/egress_proxy/#{app}.deny.acl did not exist. Please create it if you need to customize the app's deny rules" | ||
end | ||
end | ||
run "cd #{dir}; bin/cf-deployproxy -a #{options[:apps]} -p ep -e egress_proxy" | ||
end |
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
Empty file.
Empty file.
1 change: 0 additions & 1 deletion
1
config/deployment/egress_proxy/continuous_monitoring-staging.allow.acl
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,2 +1 @@ | ||
raw.githubusercontent.com | ||
*.apps.internal |
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
68 changes: 68 additions & 0 deletions
68
doc/compliance/oscal/component-definitions/cg-egress-proxy/component-definition.json
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,68 @@ | ||
{ | ||
"component-definition": { | ||
"uuid": "d2f3e1b7-363a-4c8a-afb9-7cee1e825bdc", | ||
"metadata": { | ||
"title": "cg-egress-proxy Egress Proxy Component Definition.", | ||
"last-modified": "2024-10-03T13:28:05.931086+00:00", | ||
"version": "0.0.1", | ||
"oscal-version": "1.1.2" | ||
}, | ||
"components": [ | ||
{ | ||
"uuid": "1acb8ab7-4191-46c6-b79f-659a2f195b5a", | ||
"type": "software", | ||
"title": "cg-egress-proxy", | ||
"description": "The cg-egress-proxy caddy server with forward_proxy configured", | ||
"props": [ | ||
{ | ||
"name": "Rule_Id", | ||
"value": "prod-space-restricted", | ||
"remarks": "rule_prod_space_restricted" | ||
}, | ||
{ | ||
"name": "Rule_Description", | ||
"value": "The production space where the system app is running must not have the public-networks-egress ASG applied to it", | ||
"remarks": "rule_prod_space_restricted" | ||
} | ||
], | ||
"control-implementations": [ | ||
{ | ||
"uuid": "eba1125b-5fd7-46c3-8edc-bf22d67d98cf", | ||
"source": "https://raw.githubusercontent.com/usnistgov/oscal-content/refs/tags/v1.3.0/nist.gov/SP800-53/rev5/json/NIST_SP-800-53_rev5_catalog.json", | ||
"description": "Controls implemented via use of the cg-egress-proxy outbound connection proxy", | ||
"implemented-requirements": [ | ||
{ | ||
"uuid": "09de7f16-6339-4daa-b09a-333c5e33185c", | ||
"control-id": "sc-7", | ||
"description": "", | ||
"props": [ | ||
{ | ||
"name": "implementation-status", | ||
"value": "partial" | ||
} | ||
], | ||
"statements": [ | ||
{ | ||
"statement-id": "sc-7_smt.c", | ||
"uuid": "b56aa629-2452-4052-a5c0-7d245a8122a2", | ||
"description": "eg-egress-proxy provides a control point for allowing network traffic to specific hostnames or IP addresses. Outbound connections are compared to the following list in order:\n\n1. A `deny_file` list of hostnames and/or IP addresses to deny connections to.\n1. An `allow_file` list of hostnames and/or IP addresses to allow connections to.\n1. A `deny all` rule to deny all connections that did not match one of the first two rules.\n\nThe connection is allowed or denied based on the first matching rule.", | ||
"props": [ | ||
{ | ||
"name": "Rule_Id", | ||
"value": "prod-space-restricted" | ||
}, | ||
{ | ||
"name": "implementation-status", | ||
"value": "implemented" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
...ance/oscal/system-security-plans/continuous_monitoring/system-security-plan/metadata.json
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 |
---|---|---|
|
@@ -6,3 +6,4 @@ components: | |
- cloud_gov | ||
- devtools_cloud_gov | ||
- github_actions | ||
- cg-egress-proxy |
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 |
---|---|---|
|
@@ -28,5 +28,9 @@ module "egress_space" { | |
|
||
cf_org_name = local.cf_org_name | ||
cf_space_name = "${local.cf_space_name}-egress" | ||
deployers = ["[email protected]", var.cf_user] | ||
# deployers should include any user or service account ID that will deploy the egress proxy | ||
deployers = [ | ||
"[email protected]", | ||
var.cf_user | ||
] | ||
} |