I am trying to understand the parameters used to configure TLS (specifically for rabbitmq but my question might be more general).
There are 4 main entities to consider:
Key - private key used by a peer to decrypt messages send to it that have been encrypted using its public key.
Cert - A certificate containing the peers public key It also contains some identifying details like hostname, organisation etc. many of which are optional. A certificate could be unsigned (rarely if ever?), self-signed or signed by a certificate authority.
CACert - the certificate of a CA trusted by the peer which can be used to decrypt and verify the signature of a signed cert.
CA-key - the private key of the CA which it used to sign a cert.
These map to configuration settings including:
enablePeerVerification - If true then a peer tries to verify the server is who it says it is by checking the certificate really was signed by the CA (and likewise up the chain of trust until it reaches a CA it trusts because it has a cert in its local CA trust store). It is a bad idea to set this to false as someone could impersonate the peer. (in go this option is called InsecureSkipVerify as a warning) If the cert is self-signed, peer verification is impossible. This option allows you to use a peer's self-signed cert instead at your own risk (e.g. during development).
Key - the private key used for decryption
Cert - used for encryption (and handshaking)
CACert - the certificate of the CA who signed the "Cert" certificate
Why are there configuration settings for the CACert?
If the cert is signed by a CA then it already contains enough information to locate the CA (e.g. domain name). What is the CACert for and if or when is it sent during TLS negotiation? Is this just a convenience to save going off to the CA directly? You will still have to do this if the CACert does not match or point to one in your trust store.
The settings I'm referring to are "cacert" in the rabbitmq.config for the server and amqp_ssl_socket_set_cacert() in the C API (rabbitmq-c).
I would like to check that my understanding is correct (https://xkcd.com/386/)