#TLS-based Authentication
TLS authentication is disabled in the default version of UniConfig.
To enable TLS for RESTCONF, perform the following two steps:
- Set up key-store and trust-store to hold all keys and certificates. If authentication of individual clients is not required, trust-store is also not required. Key-store must always be initialized.
- Enable TLS in UniConfig via the application.properties configuration file.
#Set key-store and trust-store
To prepare key-store and trust-store:
- In the UniConfig root directory, create a new directory that will contain key-store and, optionally, trust-store files. For example:
Create a new key-store. There are two options depending on whether you already own the certificate that you want to use for identification of UniConfig on the RESTCONF layer:
- Create a new key-store with the generated RSA key-pair (the example below uses a length of 2048 and validity of 365 days). After executing the following command, the prompt will ask you for information about the currently generated certificate that is pushed into the newly generated key-store secured by a password (this secret will be used later in the configuration file - make sure that you remember it).
- Create a new key-store with the already-generated RSA key-pair (your certificate that you want to use for authentication in ODL).
(Optional step) Create a new trust-store using an existing certificate (an empty trust-store cannot be created). If you have multiple client certificates, they can be pushed to trust-store by executing the same command multiple times (the alias must be unique for each of the imported certificates). For example:
You can easily convert OPENSSL PEM certificates to the DER format supported by keytool:
If your application must own the distribution's certificate, you can export the certificate from the generated key-pair that we have pushed into the keystore (PKCS12 or OPENSSL format):
#Enable TLS in UniConfig
After preparing key-store and trust-store, you need to point UniConfig to these storages and explicitly enable TLS via a flag.
Modify the following configuration file at a path relative to the UniConfig root directory:
Next, edit the TLS configuration section, un-commenting and editing the relevant properties.
The example snippet below enables TLS authentication, disables user-based authentication (hence trust-store is not required) and points UniConfig to the key-store file created in the previous section:
If your deployment requires authentication for individual RESTCONF users, trust-store is required and you need to set server.ssl.client-auth=need
JVM provides secure defaults, which you can override by specifying included cipher suites and TLS versions.
The following example configuration includes support for TLS 1.2 and TLS 1.3 with some of the most common and strongest ciphers available:
SNI (Server Name Indication) is disabled by default. To enable it, uncomment the line below: