Server and client setup

The following sections explain how to set up SSL/TLS-encrypted communication between P4 Servers (commit, replica, and edge servers), brokers, proxies, and clients.

Configure SSL/TLS connections

For a given P4 Server, proxy, or broker, SSL/TLS encryption is an all-or-nothing configuration option. If a P4 Server is configured to use SSL/TLS, all applications that connect directly to that server must also use SSL/TLS. Similarly, if a P4 Server is configured to accept plaintext connections, all applications that connect directly to that server must use plaintext connections.

If you use an intermediary such as a proxy or broker between the client and the P4 Server, one connection can use SSL/TLS while another uses plaintext.

Configure client connections

By default, a P4PORT setting that does not specify a protocol uses plaintext. You should consider explicitly specifying the protocol when configuring a client connection.

Connection type

Format

Example

Plaintext

tcp:host:port

tcp:123.45.67.8:1666

SSL/TLS

ssl:host:port

ssl:123.45.67.8:1666

Establish trust with the server

The first time users connect to an SSL/TLS-enabled P4 Server, the client application displays the certificate fingerprint of the server's identity key.

If users can independently verify that the fingerprint is correct, they must add the server to their P4TRUST file by using one of the following methods:

  • Run the p4 trust command.

  • Follow the prompts in the client application.

  • Manually add the fingerprint to the file.

You can also use the SSL connections that do not require P4TRUST. To learn more, see the p4 trust topic of P4 CLI Reference.

Use SSL/TLS in a mixed environment

In a mixed environment, each connection between P4 Server, brokers, and proxies can use either plaintext or SSL/TLS independently of other connections.

Examples include:

  • During a migration from plaintext to SSL/TLS, a P4 Broker can accept plaintext connections from older applications and forward requests to a P4 Server over an SSL/TLS-encrypted connection.

  • A P4 Broker can listen on tcp:old-server:1666 and redirect requests to a target of ssl:new-server:1667. Users with newer applications can connect directly to the SSL/TLS-enabled server by setting P4PORT=ssl:new-server:1667, while users with older P4 Server applications can continue using old-server:1666 until they are upgraded.

After migration is complete, you can disable the broker or reconfigure it to require SSL/TLS connections. Upgrade any remaining legacy processes or scripts that still connect by using plaintext.

When migrating from a non-SSL/TLS environment to an SSL/TLS environment that uses self-signed certificates, securely communicate the new server fingerprint to your users. If you use certificates issued by a certificate authority (CA), clients from release 2021.1 and later can validate the certificate chain without requiring a fingerprint.

To learn more, see Certificates and trust.

Firewalls

If available, remote users can use a Virtual Private Network (VPN) or Secure Shell (SSH) tunnel to access services on the trusted network.

To learn more, see the Perforce Knowledge Base article, Connecting an ssh client to Perforce through a firewall.