nsc egress policy create creates a workspace-wide egress policy from a JSON
configuration file. A policy controls outbound traffic from your instances and
can filter traffic, inject Vault secrets, or proxy requests through another
domain. You can inspect the resulting policy decisions with
nsc egress logs.
Point --spec_file at a file containing the policy definition to create it.
Usage
Example
Policy configuration
The following policy allows the traffic required by GitHub Actions and macOS, plus requests toexample.com. It also injects a Vault secret into the Authorization header for requests to
example.com. In BLOCK mode, it denies requests to other domains.
tagidentifies the policy when you apply it to a workload.descriptionexplains the policy’s purpose.modecontrols enforcement.BLOCKdenies requests that are not allowed,ADVISORYrecords the same decisions without enforcing them,ALLOW_ALLpermits all traffic, andDISABLEDdoes not apply the policy.deep_packet_inspectionterminates TLS so the policy can modify or proxy encrypted requests. Clients must trust a Namespace CA certificate made available in the instance. GitHub Actions jobs trust it automatically whenever the policy requires it. This option is required forINJECTandPROXYrules.additional_rulesetsadds allow rules maintained by Namespace. The available rulesets aregithub-actions,devbox, andmacos. Namespace updates them when GitHub Actions runners, Devboxes, or macOS requirements change.rulescontains the policy’s ordered rules. Rules fromadditional_rulesetsare appended after the rules defined here.opselects the rule operation.ALLOWpermits matched requests,INJECTsets an HTTP header from a Namespace Vault secret, andPROXYroutes matched requests through another domain.matcher.match_domainslists the domains matched by a rule. Prefix a domain with*.to include its subdomains.inject.header_namenames the header whose value is set, andinject.from_secret_ididentifies the Vault secret that provides that value.proxy.via_domainidentifies the domain that should proxy matching requests.
egress-policy.json before running the create command. See
Egress policies for rule behavior, rollout guidance, and examples
of each rule type.
Options
—spec_file <path>
Path to a JSON file containing the egress policy configuration.Related Topics
- Egress policies - Configure and monitor egress traffic
- nsc egress policy describe - Inspect a policy
- nsc egress policy list - List available policies