We share some security tips for working with LXD's password and token.
Purus suspendisse a ornare non erat pellentesque arcu mi arcu eget tortor eu praesent curabitur porttitor ultrices sit sit amet purus urna enim eget. Habitant massa lectus tristique dictum lacus in bibendum. Velit ut viverra feugiat dui eu nisl sit massa viverra sed vitae nec sed. Nunc ornare consequat massa sagittis pellentesque tincidunt vel lacus integer risu.
Mauris posuere arcu lectus congue. Sed eget semper mollis felis ante. Congue risus vulputate nunc porttitor dignissim cursus viverra quis. Condimentum nisl ut sed diam lacus sed. Cursus hac massa amet cursus diam. Consequat sodales non nulla ac id bibendum eu justo condimentum. Arcu elementum non suscipit amet vitae. Consectetur penatibus diam enim eget arcu et ut a congue arcu.
Vitae vitae sollicitudin diam sed. Aliquam tellus libero a velit quam ut suscipit. Vitae adipiscing amet faucibus nec in ut. Tortor nulla aliquam commodo sit ultricies a nunc ultrices consectetur. Nibh magna arcu blandit quisque. In lorem sit turpis interdum facilisi.
Vitae vitae sollicitudin diam sed. Aliquam tellus libero a velit quam ut suscipit. Vitae adipiscing amet faucibus nec in ut. Tortor nulla aliquam commodo sit ultricies a nunc ultrices consectetur. Nibh magna arcu blandit quisque. In lorem sit turpis interdum facilisi.
“Nisi consectetur velit bibendum a convallis arcu morbi lectus aecenas ultrices massa vel ut ultricies lectus elit arcu non id mattis libero amet mattis congue ipsum nibh odio in lacinia non”
Nunc ut facilisi volutpat neque est diam id sem erat aliquam elementum dolor tortor commodo et massa dictumst egestas tempor duis eget odio eu egestas nec amet suscipit posuere fames ded tortor ac ut fermentum odio ut amet urna posuere ligula volutpat cursus enim libero libero pretium faucibus nunc arcu mauris sed scelerisque cursus felis arcu sed aenean pharetra vitae suspendisse ac.
LXD has many ways of handling authentication. You can use passwords or you can use tokens, you can even use something called Candid for handling authentication with advanced RBAC capabilities. In this post we will cover some best practices for setting up LXD and how to make sure your cluster is secure.
When you initialize your LXD cluster there is one option where it asks you if you want to setup a password for your cluster. For the most part I would recommend choosing ‘no’ for this. What this option does is it sets up password authentication for the cluster.
When you need to add trusted clients to the cluster you are able to use this password. For simple setups this should be ok. What the official LXD documentation recommends is once you’ve added all the clients you unset the trust password.
You can unset the password by running the following command:
If you want to set the password to something else you can also do:
However LXD offers a much better authentication option which is simple and secure.
My recommendation is if you’re using LXD version > 4.23 you have the option of dropping password authentication altogether. You can switch to completely using token based authentication.
If you wish to add a trusted client to LXD using tokens you can do so by using the following command:
If you want to add a token and specify the name without waiting for the prompt you can do so in this way:
This will spit out the token right away without a prompt asking for a name.
Once you type the name in LXD will generate a token. You can then give this token to the client who is trying to access your cluster. When they’re asked for the password they can use the token in place of the password.
At this point you may ask, how is this different from passwords. The main difference is the following:
If you wish to see a list of issued tokens you can use the following command:
This will spit out all the tokens you’ve issued. If you name your tokens correctly you can easily see who they’re issued to. You can also revoke the token by using the following:
As you can see tokens offer much better control over how your LXD cluster is accessed.
Once a client is authenticated to access your cluster you can view a list of clients using the following:
This should spit out a list of clients that your LXD cluster trusts. You can also remove clients by using the following:
This post is designed to give you a quick understanding of how authentication works in LXD and how you can have control over who accesses your cluster. We hope you enjoyed it!
OpsMaru is a no code end-to-end deployment platform builder. It's made for freedom, flexibility, speed and simplicity.