-
Notifications
You must be signed in to change notification settings - Fork 433
Allow configuring credentials with ENV #3089
Description
Allow configuring credentials for save command via env variables (with fallback to default)
Description
We are using Containerlab to simulate our full production configuration with vr based devices, including user management. As part of this process, we modify or remove the default user that Containerlab relies on for device access.
After removing or changing the default user, the containerlab save command no longer works, and startup configurations are not saved anymore.
Problem
The save command appears to rely on the default credentials configured by Containerlab. When those credentials are modified or removed (to better reflect production setups), the command fails and configurations are no longer persisted.
Proposed Enhancement
Allow defining credentials via the node env system so that Containerlab can use custom authentication when interacting with nodes.
Reference documentation:
https://containerlab.dev/manual/nodes/#env
Example (conceptual):
nodes:
r1:
kind: <kind>
env:
CLAB_USERNAME: myuser
CLAB_PASSWORD: mypassword
Expected Behavior
- If custom credentials are defined via environment variables, Containerlab should use them for operations such as save.
- If no custom credentials are defined, Containerlab should fall back to the default username/password behavior.
- This would allow users to remove or modify the default user without breaking lifecycle operations.
Benefits
- Enables production-like authentication models in lab environments.
- Removes dependency on default credentials.
- Improves flexibility and security alignment with real-world deployments.
Is this something that could be supported?
Alternatively, is there a recommended approach to handle this use case?