Deploying livepatch on-prem

Prerequisites

We will deploy and configure the livepatch on-prem server using Juju and Charmed Operators. Juju is an Open Source Charmed Operator Framework that controls the whole lifecycle of an application - including machine applications. Please follow the installation instructions for your system.

You don’t need to have previous or advanced knowledge of Juju or Charmed Operators to follow this guide and deploy livepatch.

Livepatch authorization token

Since on-prem livepatch servers act as caching proxies for the livepatch service hosted by canonical, the subscription token is required to authorize the on-prem instance to pull patch information.

To get your ubuntu advantage subscription token, please go to https://ubuntu.com/advantage.

Deployment Steps

1. Initialize juju

Once you have Juju CLI installed, you will need to bootstrap a Juju controller to your cloud. The Juju documentation has detailed instructions on how to do that for several clouds and machine types.

See resources topic for requirements for the virtual machines running livepatch on-premises services.

2. Deploying the bundle

The bundle and charmed operators necessary to deploy livepatch server are available in the charmstore at

To start the deployment on a created juju model, run:

$ juju deploy cs:~livepatch-charmers/canonical-livepatch-on-prem-bundle

3. Configuring livepatch

After the deployment completes, verify the status of the model by running:

$ juju status

The output should look like:
screenshot_20210601_164245

At this point the livepatch unit is expected to be in a blocked state with the message:
“✘ sync_token not set”

Provide the token (acquired by following instructions in the Livepatch authorization token section) by running:

$ juju config ubuntu-advantage token="<token>"

$ juju run-action livepatch/leader get-resource-token --wait

The output should indicate the token has successfully been acquired:

After that, provide the url_template setting. The url_template specifies the url where patch files can be downloaded by livepatch client agents. The url template should be of the form ‘http(s)://{HOSTNAME}/v1/patches/{filename}’. The hostname can be just the ip address of the haproxy unit. If a DNS hostname is configured for the haproxy IP address, that can be used too.

Deploying with a config overlay

These settings can be configured at deploy-time by using a juju bundle overlay:

$ juju deploy cs:~livepatch-charmers/canonical-livepatch-on-prem-bundle --overlay config.yaml

A template of the overlay is packaged with the bundle and is available for download.

4. Setting up authentication

To enable admin tool access to the livepatch server, authentication needs to be configured. The easiest way is to enable username/password authentication.

Generate the password hash using:

$ sudo apt-get install apache2-utils

$ htpasswd -bnBC 10 <username> <password>
username:$2y$10$74ZpDgHaxnUQo.AJZk1cMuSRfef5oK5xq5o/GLbUH/Bbw6W2bmctm

Use the output of the previous command to configure livepatch:

$ juju config livepatch auth_basic_users='username:$2y$10$74ZgHaxn...UH/Bbw6W2bmctm'

See Administration Tool topic for instructions on installing the administration tool and setting up authentication.

Once this has been done, the livepatch admin tool can be used to authenticate:

$ export LIVEPATCH_URL=http(s)://{haproxy url}

$ livepatch-admin login -a [username:password]

5. Downloading patches

The final step before attaching client machines to the server is to download patches from Canonical servers. This can be done using the admin tool. See the Administration tool topic on how to install it.

To download patches, run:

$ livepatch-admin sync trigger --wait

Enabling machine status reporting

Each livepatch on-prem instance can optionally send information about the status of the machines it’s serving back to Canonical. This functionality is opt-in.

The information sent back about each machine includes:

  • Kernel version
  • CPU model
  • Architecture
  • Boot time and uptime
  • Livepatch client version
  • Obfuscated machine id
  • Status of the patch currently applied to the machine’s kernel

To enable this reporting, run the following juju command:

$ juju config livepatch sync_send_machine_reports=true

This can be disabled at any time by setting the flag to false.