Skip to content

sotechdev/LXD.NET

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SharpLXD by ImpulseMachines

Modified fork for utilisation in cloud provisioning services.

Goals:

  • Update to .NET 5.0
  • Add support / demo for VMs
  • Add support for container and vm provisioning via cloud-init iso for vms.

SharpLXD is based on LXD.NET and includes the work of https://github.com/autozimu/LXD.NET https://github.com/GnicoJP/LXD.NET with thanks.

The project has been renamed to avoid confusion. This project is not intended to be compatible with LXD.NET going forward.

Generating a pfx certificate for use with SharpLXD

LXD Server side:  
mkdir -p /root/.config/lxc  
openssl req -x509 -newkey rsa:2048 -keyout /root/.config/lxc/client.key.secure -out /root/.config/lxc/client.crt -days 3650  
openssl rsa -in /root/.config/lxc/client.key.secure -out /root/.config/lxc/client.key  
lxc config trust add /root/.config/lxc/client.crt  
source: https://gitlab.com/catalyst-it/devtools/vagrant-lxd/-/issues/6  

Client Side:  
openssl pkcs12 -export -out client.pfx -inkey client.key -in client.crt  

Original LXD.NET Documentation

LXD client implemented in C#.

Example

using LXD;

Client client = new Client(
    apiEndpoint: "https://your-lxd-service:8443",
    clientCertificateFilename: "your-client-certificate.p12",
    password: "your-client-certificate-password");

Console.WriteLine(client.Trusted); // true

foreach (Domain.Container container in client.Containers) {
    Console.WriteLine(container.Name);
}
// alpline
// ubuntu

Domain.Container alpine = client.Containers.First();
foreach (string str in alpine.Exec(new[] {"cat", "/etc/issue"})) {
    Console.WriteLine(st);
}
// Welcome to Alpine Linux 3.4
// Kernel \r on an \m (\l)

About

LXD client implemented in C# for .NET 7

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 96.4%
  • Smalltalk 3.6%