CrushMFT Documentation

Client certificates#

Usually only the server shows a certificate. With client certificates, the user's side shows one too, and the server refuses the connection, before any login page, to everybody who has none that it trusts. A scanner or an attacker without a certificate cannot even reach the login.

It works on the ports that speak TLS: HTTPS and FTP with encryption.

Two ways to use it#

Way A certificate is The user then
a gate needed to connect at all logs in as usual, with name and password
the login itself needed to connect, and it names the user is logged in as the name in the certificate, without a password

The parts#

  1. A certificate authority of your own that signs the users' certificates. Not a public one: you decide who gets a certificate.
  2. The trust store of the server: a keystore that holds the certificate of that authority. It must lie beside the listener's keystore, with the same name plus _trust, and the same password. For a listener with the keystore crush.jks, the trust store is crush.jks_trust.
  3. A certificate for each user, signed by the authority, with its private key, installed in the user's browser or program.

The server never trusts its own built-in certificate as an authority for clients, and a listener that requires client certificates and has an empty or missing trust store lets nobody in.

Making the certificates#

With OpenSSL. First the authority, once:

openssl req -x509 -newkey rsa:4096 -days 3650 -nodes -subj "/CN=Example Client CA" -keyout ca.key -out ca.pem

Put its certificate into the trust store:

keytool -import -alias clientca -file ca.pem -keystore crush.jks_trust -storepass PASSWORD

Then, for each user, a key, a request, the signed certificate, and a file for the user's device:

openssl req -newkey rsa:3072 -nodes -subj "/CN=alex" -keyout alex.key -out alex.csr
openssl x509 -req -in alex.csr -CA ca.pem -CAkey ca.key -CAcreateserial -days 365 -out alex.pem
openssl pkcs12 -export -inkey alex.key -in alex.pem -certfile ca.pem -out alex.p12

The user imports alex.p12 into their browser or system. Keep ca.key offline: whoever has it can make certificates for anybody.

The keystore utility can do the import into the trust store without the command line.

Turning it on#

On the listener, tab Advanced, under SSL Options: Require valid client certificate. See SSL on a port, SNI.

Warning

The page warns: "Enabling client certificates blocks every connection, including yours, unless client certificates are already issued and installed in your browser. You will not be able to turn it back off from the admin panels." Turn it on for a listener of its own first, test it, and keep a listener without it for administration from inside.

There is also a switch for the whole server, the setting needClientAuth. Prefer the listener's.

The certificate as the login#

With the server setting client_cert_auth = true, the server reads the name in the certificate, the part CN=, and logs that user in without asking for a password.

  • The name in the certificate must be exactly the user name in CrushMFT.
  • A certificate whose name begins with NOLOGIN_ is never used as a login: it only opens the gate, and the user then logs in with a password. Use such names for certificates that are shared by a group.
  • With client_cert_auth_nologin = true, no certificate is used as a login, whatever its name.

Be sure of your authority before you turn this on: a certificate it signed for the name of an administrator is that administrator.

Taking a certificate away#

A certificate works until it expires. To stop one earlier:

  • as a gate with passwords: disable the user's account, and the certificate opens only the door to a login that fails;
  • as the login itself: disable or delete the account of that name.

Short lifetimes, a year or less, keep the list of certificates you have to think about short.

Things to know#

  • Browsers offer a client certificate only when the server asks for one that an authority of the server's list has signed. If the browser does not ask the user to choose, the trust store is not what you think it is.
  • HTTP/3 is not started on a listener that requires client certificates.
  • Behind a load balancer that ends TLS, the server never sees the client's certificate. Pass TLS through untouched.
  • For programs, client certificates work with FTPS clients and with curl (--cert), and with the server's own FTPS and HTTPS items: the keystore fields of FTP, FTPS and FTPES servers.