1.0.1 • Published 9 months ago
@containernerds/incus-client v1.0.1
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-clientGenerate 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.crtYou should now have three files:
client.key- Private Keyclient.crt- Public Keyclient.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.crtThis command registers the client certificate with Incus, allowing authentication without a password.
To verify the import was successful you can run:
incus config trust listYou should see the certificate fingerprint in the list.
+--------------+--------+-------------+--------------+----------------------+
| NAME | TYPE | DESCRIPTION | FINGERPRINT | EXPIRY DATE |
+--------------+--------+-------------+--------------+----------------------+
| client.crt | client | | 1abc2345def6 | 2035/01/01 12:34 EST |
+--------------+--------+-------------+--------------+----------------------+