Client Identity Headers
NativeLink can extract client identity from HTTP headers for tracking and authorization purposes.Configuration
Configure identity headers at the server level:Parameters
-
header_name(optional): Name of the HTTP header containing the client identity- Default:
"x-identity" - Example:
"x-nativelink-client-id"
- Default:
-
required(optional): Whether the identity header must be present- Default:
false - When
true, requests without the header are rejected
- Default:
The identity header is primarily used for telemetry and observability. It integrates with NativeLink’s OpenTelemetry layer to track requests by client.
mTLS Client Authentication
For production deployments, use mutual TLS (mTLS) to authenticate clients with certificates.Server-Side Configuration
Configure the server to require client certificates:mTLS Parameters
-
client_ca_file(optional): Path to the Certificate Authority (CA) file for validating client certificates- When set, the server requires clients to present valid certificates
- Supports PEM format
- Multiple CA certificates can be included in the same file
-
client_crl_file(optional): Path to the Certificate Revocation List (CRL)- Lists revoked client certificates that should be rejected
- Must be in PEM format
- Only used when
client_ca_fileis configured
Client-Side Configuration
Configure workers and GRPC stores to use client certificates:Client TLS Parameters
-
ca_file(optional): Path to the CA certificate for server verification- Required unless
use_native_rootsis enabled - Verifies the server’s certificate chain
- Required unless
-
cert_file(optional): Path to the client certificate for mTLS- Must be paired with
key_file - Used for client authentication
- Must be paired with
-
key_file(optional): Path to the client private key- Must be paired with
cert_file - Supports PKCS8, PKCS1, and SEC1 formats
- Must be paired with
-
use_native_roots(optional): Use system root certificates for server verification- Default:
false - When enabled,
ca_fileis ignored - Useful for connecting to servers with certificates from public CAs
- Default:
When using mTLS, ensure certificate files are readable by the NativeLink process and protected with appropriate file system permissions (e.g.,
chmod 600 for private keys).Worker API Security
Recommended Setup
Run the Worker API on a separate, non-public port:Separate ports
Configure Worker API on a different port (e.g., 50061) than client services (e.g., 50051)
Restrict access
Bind the Worker API to
127.0.0.1 or use firewall rules to limit access to trusted networksAuthentication Flow
Best Practices
- Always use TLS in production environments
- Implement mTLS for Worker API endpoints
- Rotate certificates regularly (e.g., every 90 days)
- Store private keys securely with restricted file permissions
- Use separate CAs for workers and clients when possible
- Monitor certificate expiration dates
- Implement Certificate Revocation Lists (CRL) for compromised certificates
- Use strong key sizes (minimum 2048-bit RSA or 256-bit ECDSA)
Troubleshooting
Connection Refused
- Verify the server is listening on the correct address and port
- Check firewall rules allow traffic on the configured port
- Ensure the client is connecting to the correct endpoint
Certificate Verification Failed
- Verify the CA certificate matches the certificate authority that signed the server/client certificate
- Check certificate expiration dates:
openssl x509 -in cert.pem -noout -dates - Ensure the certificate chain is complete
- Verify the certificate’s common name (CN) or subject alternative name (SAN) matches the endpoint hostname
mTLS Handshake Failed
- Confirm both
cert_fileandkey_fileare configured on the client - Verify the client certificate is signed by the CA specified in
client_ca_fileon the server - Check that the certificate is not in the CRL (
client_crl_file) - Ensure private key permissions are correct (readable by the NativeLink process)
Identity Header Missing
- Verify the client is sending the configured header name
- If
required: true, ensure all clients include the identity header - Check proxy or load balancer configurations aren’t stripping headers