Proposal: split into a service and client #2641
Replies: 2 comments
-
there are a lot of good ideas here, thanks @evilhamsterman On the security concernsBefore diving into this, I wanted to highlight that primarily containerlab is intended for controlled lab environments where a bad actor should not have easy access to; At the same time the popularity of the tool made the installation targets to range from personal machines to shared labs with public access. For the separation of security concerns there was a clab-api created that would allow the clab run on the host where the lab are scheduled, while the clients are using REST API to control the lab creation https://github.com/srl-labs/clab-api-server
The REST API should be then used to create clients, UI/CLI or otherwise. Some notes:
DatastoreThe ephemerality was a low-hanging fruit for us. Having a simple persistent datastore is a good change and can unlock more interesting capabilities. But it needs to be invisible for a user, something that does not bring any installation requirements. SSH configsWe do not modify the original ssh configs, we add to the list of ssh hosts via a new file in the |
Beta Was this translation helpful? Give feedback.
-
Good to know you're already working on an api server project I'll take a look at that. SecurityThe security concerns about not being in a controlled environment is my point. It does end up running on a lot of user devices that are a lot more exposed. Laptops of employees and students are a good example, they get taken around and connected to lots of uncontrolled networks. I'd place containerlab in the same field as projects like GNS3 or EVE-NG, it is a very effective tool for sharing and teaching lab designs. That's why I've been contributing a bunch recently I'm using it in my company to simulate our network and test/share ideas for changes. It's not the worst thing but anything that could be improved is always a win I think. I believe you can drop the root requirement for accessing the netlink by instead of setting SUID or running as root, you can just DatastoreAgreed on not requiring extra installs, but the needs aren't high an embedded datastore BadgerDB, SQLite, or even just a folder of json files would probably be enough. SSHFor SSH there's many options For a start user ssh configs support example
I've been hitting bugs and issues that I've personally run into while adopting containerlab at work and in my homelab. I hope they are appreciated and I will continue to do so. I may offer up some patches for options like I mentioned above for you to evaluate if that's alright. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
As I've been digging into the code I see a lot of what looks like workarounds and band aids to deal with the ephemerality of a clab. That plus the suid requirement for the binary gives me the heeby jeebies. Anyone can execute it and if they manage to find a vulnerability they have full root access. The fact it also messes around with critical files like
/etc/hosts
is also a little scaryI propose splitting the project into two parts, a service with elevated privileges that listens on a socket, and a client that communicates with the service over the socket. Similar to how Docker itself runs. This would provide several advantages
--cleanup
can always work/etc/hosts
by providing a simple DNS service either embedded in the server or through something like CoreDNS with gRPC or an autoreloadedhosts
file. Then use split DNS on different OS to forward to the server. See Tailscale for an examplessh_configs
by making use of SSH Match and KnownHostsFile/KnownHostsCommandDownside is it would be a major redesign
Beta Was this translation helpful? Give feedback.
All reactions