Easyrsa charm
This charm delivers the EasyRSA application to act as a Certificate Authority (CA) and create certificates for related charms.
Deployment
To deploy EasyRSA:
juju deploy easyrsa
juju deploy tls-client
juju add-relation easyrsa tls-client
Using the EasyRSA charm
The EasyRSA charm will become a Certificate Authority (CA) and generate a CA
certificate. Other charms need only to relate to EasyRSA with a requires
using the tls-certificates
interface.
To get a server certificate from EasyRSA, a charm must include the
interface:tls-certificates
interface in its layer.yaml
file. The charm must
also require the tls
interface, in its metadata.yaml
. The relation name may
be named what ever you wish. Assume the relation is named “certificates” for
these examples.
CA
The interface will generate a CA certificate immediately. If another charm
requires a CA certificate the code must react to the flag
certificates.ca.available
. The relationship object has a method named
get_ca
which returns the CA certificate.
Client certificate and key
The EasyRSA charm generates a client certificate after the CA certificate is
created. If another charm needs the CA the code must react to the flag
certificates.client.cert.available
. The relationship object has a method
that returns the client cert and client key called get_client_cert
.
Request a server certificate
The interface will set certificates.available
flag on a relation. The
reactive code should send three values on the relation to request a
certificate. Call the request_server_cert
method on the relationship object.
The three values are: Common Name (CN), a list of Subject Alt Names (SANs), and
the file name of the certificate (the unit name with the ‘/’ replaced with an
underscore). For example a client charm would send:
Server certificate and key
The EasyRSA charm generates the server certificate and key after the request
have been made. If another charm needs the server certificate the code must
react to the flag {relation_name}.server.cert.available
. The relationship
object has a method that returns the server cert and server key called
get_server_cert
.