Skip to main content

Overview

A Socket resource routes package manager traffic through a Socket Registry Firewall. Formal applies access policies and sends matching registry requests to the firewall, which retrieves packages from the upstream registry.

Configure the Socket Registry Firewall

Configure the firewall to use path routing. Formal maps each supported package registry to the corresponding path: Add a route for each ecosystem you want to proxy:
Formal supports only Socket’s recommended path for each registry.

Create a Socket Resource

Create a socket using the firewall’s hostname and port:

Configure Resource TLS

Formal must trust the certificate presented by the Socket Registry Firewall. Export the CA certificate that issued the firewall’s server certificate. If the server certificate is self-signed, export that certificate instead. In the Formal Console, add a TLS configuration to the Socket resource, select Verify Full, and add the PEM-encoded certificate to the CA trust store. With Terraform, use a formal_resource_tls_configuration resource:
The firewall certificate must include the resource hostname in its subject alternative names. This TLS configuration is used for direct Endpoint connections and Connector connections. Connectors also use it when running resource health checks. See Resource TLS Configuration for the available verification modes. If the firewall requires authentication, configure a Bearer Token Native User.
Native User authentication is supported only when Socket traffic is routed through a Formal Connector.

Route Package Manager Traffic

Create a network rule from the Socket Registry Firewall template. Select the Socket resource, replace sfw.your_company.com with the firewall hostname, and keep only the ecosystems configured in the firewall:
The ecosystem condition intercepts requests to public package registries. The hostname condition intercepts package download URLs returned by the firewall. The browser exclusion prevents ordinary browser traffic to public registry websites from matching the rule.

Route Every Supported Ecosystem

Use the Socket Registry Firewall (All) template when socket.yml configures every ecosystem listed above. The is_socket_ecosystem input matches any hostname recognized as a supported Socket registry. Replace sfw.your_company.com with your firewall hostname:
This template matches all supported Socket ecosystems. Do not use this template if your Socket firewall does not opt in to all supported ecosystems. Use the selective Socket Registry Firewall template instead.

Without a Connector

Use this mode when each workstation running the Formal Endpoint can reach the Socket Registry Firewall directly:
  1. Install and enable the Formal Endpoint transparent proxy.
  2. Make the firewall hostname resolvable and reachable from the workstation.
  3. Select the Socket resource in the network rule.
  4. Leave Forward To Connector disabled ("forward_to_connector": false).
Traffic follows this path:
The Formal Endpoint does not apply Native User credentials in this mode. The firewall must accept the Endpoint’s requests without Native User authentication.

With a Connector

Use this mode when the firewall is reachable only from the network where a Formal Connector runs, or when the firewall requires authentication from package manager clients.
  1. Create a listener on the Connector.
  2. Add a listener rule that points to the Socket resource.
  3. Enable Forward To Connector in the network rule ("forward_to_connector": true).
For example:
The listener port is the port used to reach the Connector and does not need to match the firewall resource port. Traffic follows this path:

Policy Evaluation

Socket’s response headers are available to response policies through input.socket. For example, the following policy blocks a request when the firewall reports a fail-open decision:

Socket Policy Input

input.socket can contain the following fields: ecosystem is available when Formal classifies a supported public registry.

Limitations

  • Socket resources use the fixed path prefixes listed above. Custom path prefixes, domain-based routing, and Artifactory auto-discovery mode are not supported.
  • Socket response bodies stream through Formal to the package manager and are not available to response-body policies. Response header rewrites and blocks remain supported.