1.0.1 • Published 9 months ago

@containernerds/incus-client v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Incus Client for Node.js

Overview

incus-client is a Node.js client library for automating Incus (formerly LXD) servers using the Incus REST API.

Installation

npm install @containernerds/incus-client

Generate Client Cert and Key

Run the following commands to generate the required files:

# Generate a private key
openssl genpkey -algorithm RSA -out client.key

# Generate a certificate signing request (CSR)
openssl req -new -key client.key -out client.csr -subj "/CN=incus-client"

# Generate a self-signed certificate (valid for 10 years)
openssl x509 -req -days 3650 -in client.csr -signkey client.key -out client.crt

You should now have three files:

  • client.key - Private Key
  • client.crt - Public Key
  • client.csr - Signing Certificate

Import Certificate to Incus

To allow your client to communicate with the Incus API, you need to trust the certificate:

incus config trust add-certificate client.crt

This command registers the client certificate with Incus, allowing authentication without a password.

To verify the import was successful you can run:

incus config trust list

You should see the certificate fingerprint in the list.

+--------------+--------+-------------+--------------+----------------------+
|     NAME     |  TYPE  | DESCRIPTION | FINGERPRINT  |     EXPIRY DATE      |
+--------------+--------+-------------+--------------+----------------------+
| client.crt   | client |             | 1abc2345def6 | 2035/01/01 12:34 EST |
+--------------+--------+-------------+--------------+----------------------+
1.0.1

9 months ago

1.0.0

9 months ago