Adding a JWT Token To a Configuration File

When running lbcli commands, the jwt token must be provided via the -J variable, like this: lbcli -J $LIGHTOS_JWT get cluster.

There is another way also, which is to configure the system jwt into a configuration file on the Lightbits server. In this way lbcli commands can be run from that server without the -J variable.

Having the system JWT preconfigured introduces security concerns, because any lbcli command can now be run. Therefore it's important to ensure that the server is secured.

  1. After deploying the cluster, grab the system jwt. From the Ansible installation host, the file will be in located in ~/lightos-system-jwt. Show the content of the file with cat:
Bash
Copy

The output should show the token, as below. Note that the token has been cut for brevity.

Bash
Copy

Copy the jwt token portion (everything after "LIGHTOS_JWT="). Note that its long output will span multiple lines of terminal output; however, it should only take up one line in a file.

  1. On a Lightbits server, edit /etc/lbcli/lbcli.yaml and append the jwt to the bottom.

jwt: <jwt>

The full content of /etc/lbcli/lbcli.yaml will be similar to this:

YAML
Copy

##

Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard