What Famir is
Famir (Fake Mirrors) is a Node.js platform for creating and managing multi-tenant reverse proxies with dynamic configuration.
The platform is intended for authorized security research: studying web application behavior, analyzing HTTP interactions, and testing protection mechanisms in a controlled environment.
Famir allows traffic to be received through mirror domains, directed to the corresponding donor sites, and request and response processing to be configured. A separate template project is available for demonstration and familiarization with the configuration: bitnoize/famir-demo.
Campaign and tenant model
The main unit of Famir configuration is a campaign. A single campaign combines the settings of an individual scenario and the entities associated with it: target, proxy, redirector, lure, session and message.
A single Famir backend can serve a large number of independent campaigns. Each may have its own mirror domains, targets, session parameters, and processing rules. Thus, several independent scenarios can operate simultaneously on one platform while remaining separately configured.
For campaigns with custom behavior, separate tenants are used. TypeScript hooks can be connected to a tenant and applied to one or more specific targets.
Customization
Famir supports two complementary ways of configuration.
YAML presets
YAML presets define the configuration of a campaign and targets declaratively. They are intended for parameters and rules that are convenient to describe as data and reuse between scenarios.
Presets allow the settings of a specific scenario to be separated from the platform code.
TypeScript hooks in a tenant
TypeScript hooks contain custom processing logic for a specific tenant and can be bound to specific targets.
Processing in Famir is organized as a middleware chain, where individual stages are performed by the corresponding controllers. A hook is called after its controller has executed - that is, after the corresponding stage of the chain. This allows target-specific logic to be added at the desired point of processing without replacing the platform's general logic.
YAML presets and hooks solve different tasks: presets define configuration, while hooks define programmable behavior.
Traffic flow
Famir operates behind an external edge server. Incoming traffic is first received by the edge server, then directed to one of the Famir backend instances.
The general request path looks like this:
- The client accesses the mirror domain.
- The edge server accepts the connection. It can terminate TLS, apply routing rules, and balance requests between Famir instances.
- The edge server passes the request to Famir. To preserve the original request parameters, it passes the original host and protocol via
X-Forwarded-HostandX-Forwarded-Proto. - Famir determines the campaign and target, corresponding to the mirror domain and starts processing in the middleware chain.
- Controllers perform the processing stages. After the corresponding controller, the TypeScript hook bound to that stage is launched, if it is configured for the tenant and target.
- Famir forwards the request to the donor site taking into account the target configuration and the available outbound proxy.
- The received response is processed by Famir and returned to the client through the edge server.
The edge server is an external component in front of Famir, not part of the backend reverse proxy. It is responsible for receiving traffic and balancing; Famir is responsible for campaign routing and application-level request and response processing.
The X-Forwarded-Host and X-Forwarded-Proto headers must be set or verified by a trusted edge server. Values of these headers coming directly from the client should not be relied upon without verification.
Connection types
Famir supports several types of HTTP interactions:
- Regular HTTP requests and responses - processing requests with full reading and transmission of the body.
- WebSocket - switching an HTTP connection to WebSocket; the capability is determined by the target configuration.
- Stream upload - streaming transmission of the request body, for example when uploading large data.
- Stream download - streaming transmission of the response body, suitable for large files and other voluminous data.
Streaming modes allow large bodies to be transmitted in parts without loading them entirely into memory. The actual connection behavior depends on the target configuration and the capabilities of the edge server used.
Scaling
Famir consists of separate applications and infrastructure components. This allows multiple backend instances to be run behind an edge server and incoming requests to be distributed among them.
Campaigns are independent configuration units: a large number of campaigns can be served by a single backend, and the backend instances themselves can be scaled horizontally as load grows. Background workers are also separated from HTTP traffic processing and can scale independently.
The actual scaling limits depend on server resources, network bandwidth, edge server settings, Redis, and object storage.
Infrastructure and technology stack
The following are used to deploy Famir:
- Node.js - the runtime environment for backend applications;
- Edge-server / web server with load balancing - located in front of Famir, accepts incoming connections, and distributes requests between backend instances;
- Redis - storage of operational data and infrastructure for background processing queues;
- MinIO or S3-compatible object storage - for file data;
- libcurl and build tools - system dependencies for the
node-libcurloutbound HTTP client; - DNS, domains, and TLS certificates - for the availability of mirror domains and secure connections.
Common solutions such as Nginx, Caddy, Traefik or Angie can be used as the edge server. The choice depends on the infrastructure and requirements for TLS, load balancing, and routing. The edge server must pass correct values of X-Forwarded-Host and X-Forwarded-Proto to Famir.
For background tasks, queues based on BullMQ running through Redis are used. Their workers can be launched separately from the Famir instances that process incoming HTTP traffic.
Detailed parameters and instructions for launching the components will be covered in the following sections of the documentation.