Documentation
13.1. TLS Client Configuration¶
SFTPPlus acts as a TLS client in the following scenarios:
authentication over HTTPS with custom API or Azure AD or other OpenID Connect or OAuth2 API servers,
authenticating via LDAPS,
connecting to HTTPS servers for WebDAV, AS2, Azure, or other cloud transfers,
connecting to HTTPS server for sending event notifications,
connecting to SMTP servers.
13.1.1. Validating the identity of the remote server¶
In order to keep the confidentiality of transmitted data, it is critical to ensure that it is only exchanged with trusted remote servers.
Confidential information should never be exchanged with untrusted or unknown servers.
This is a challenge when using public Internet connections to servers hosted by cloud providers, or connecting to an organization that has various servers distributed across the world or in various disaster recovery configurations.
For example, for disaster recovery or high availability servers, the IP address of the server can change at any time.
PKI, or Public Key Infrastructure, is a framework used to manage digital keys and certificates, enabling secure communication and transactions over the Internet. It provides a way to verify the authenticity of the remote server, and ensures the confidentiality and integrity of the data communication.
PKI is used by SFTPPlus to validate the identity of the remote TLS servers. PKI is the backbone of secure communication on the Internet, ensuring confidentiality, integrity, and authentication.
In SFTPPlus, two configuration options are used in order to validate the identity of a server:
* Remote server URL or Domain Name
* Remote server Certification Authority chain
When connecting to a TLS server, SFTPPlus receives from it a copy of its certificate during the TLS handshake. Alongside this certificate, the server typically also sends copies for the certificates of the CA (Certification Authority) that has issued its certificate.
The server's certificate contains a list of server names for which it is valid.
SFTPPlus uses the server name (extracted from the URL or the address configuration) to verify that the provided certificate matches the expected server.
Configuring a server URL or address using IP address or private/local names causes this validation to fail, as the certificates are only valid for public domain names.
Note
If you are using a private Certification Authority, you can generate certificates for private domain names. SFTPPlus will validate and accept these private certificates when using a DNS server that resolves the corresponding private domain names.
Today, it's much harder for an attacker to fraudulently obtain a public certificate, as Certification Authorities have implemented better security checks, and all issued certificates are publicly disclosed.
Read more about Certificate Transparency <https://en.wikipedia.org/wiki/Certificate_Transparency> here.
13.1.4. Certificate and Public Key Pinning¶
Public Key Pinning (PKP) is an advanced security mechanism used to defend against man-in-the-middle attacks involving fraudulent digital certificates.
In most cases, you should use either the list of public Certification Authorities from Mozilla or our lists of predefined certificates for Let's Encrypt and/or Microsoft. This is described above on this page.
Before implementing key pinning, consider implementing Certification Authority pinning instead. This provides a greater flexibility, allowing the remote server to renew or generate a new private key, without any extra-configuration from your side.
Key pinning for a TLS client, such as SFTPPlus, specifies which public key and certificates it expects to receive during a TLS handshake to a certain remote server. This helps prevent a man-in-the-middle attack for a known remote server, even if somehow the attacker has obtained a valid public certificate for the server's domain name.
For example, an attacker can obtain a valid public certificate due to a defect or security issue with a public Certification Authority, or by infiltrating a public Certification Authority.
Key pining can be used in the following scenarios:
high security environments in which the remote server configuration is static,
private servers or software appliances using self-signed certificates,
legacy servers for which the certificate has expired and can't be renewed.
Key pinning is especially useful for legacy or in-house applications, being much preferable to entirely disabling server identity validation.
SFTPPlus implements public key pinning. This means that the remote server can renew its certificate and no configuration change is required for SFTPPlus. A certificate renewal is a new certificate that was issued for the same private key. The remote server can also obtain a certificate from a different Certification Authority, and no configuration changes are required on the SFTPPlus side as long as the certificate is requested for the same private key.
Warning
When public key pinning is used, SFTPPlus does not require the remote server's certificate to match the URL or address name. It also does not check for certificate expiration.
SFTPPlus can be configured to automatically set the pinned public key during the first connection to the remote server. To do so, define the configuration as:
ssl_certificate_authority = pin-public-key
After the initial connection, the pin-public-key value gets replaced inside the configuration with the public key advertised by the remote server during the TLS handshake.
You can configure SFTPPlus to pin a specific public key using the following configuration. You specify the public key in PEM format:
ssl_certificate_authority = -----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqVNXiyZJUoMZMuAy1VP6
MORE CONTENT OF THE PUBLIC KEY
p+ElxaJNjzW7GLZ3Etog6APB5jgXH2lHzP8bYv55bnepiHzmgZVA9u0B2SBLil1m
TwIDAQAB
-----END PUBLIC KEY-----
For services operated by multiple servers, for example distributed across multiple regions, you can configure multiple public keys. Multiple public keys can also be used in preparation for a remote server rotating its public key. The configuration will look like:
ssl_certificate_authority = -----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqVNXiyZJUoMZMuAy1VP6
MORE CONTENT OF THE PUBLIC KEY
p+ElxaJNjzW7GLZ3Etog6APB5jgXH2lHzP8bYv55bnepiHzmgZVA9u0B2SBLil1m
TwIDAQAB
-----END PUBLIC KEY-----
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqVNXiyZJUoMZMuAy1VP6
ANOTHER KEY CONFIGURED
-----END PUBLIC KEY-----
If the remote server later advertises a different public key, the connection to the remote server will start to fail, as the remote server's identity can no longer be validated by SFTPPlus in such a configuration.