srl-labs / containerlab

container-based networking labs
https://containerlab.dev
BSD 3-Clause "New" or "Revised" License
1.46k stars 249 forks source link

When creating a user with an encrypted password with a startup-config, Truncation occurs #2160

Open lostdave opened 1 month ago

lostdave commented 1 month ago

Steps to reproduce: Created a topology that included some Junos vSwitch images -> Added a block config in the topology file -> the resultant encrypted password (if if contained . or / characters) would truncate.

startup-config: |
  system {
    login {
      user someuser {
        class super-user;
        authentication {
          encrypted-password "$6$8gNjhXy6$Vj69F.QdM.Nvz1fDDYhnwb27cMSXJmXxS23ti50z/liD3obqPRYs5UKHVbKFRtqZO.AoXJIVR6Um17RFfSwWm1"
        }
      }
    }
  }

What winds up happening is the encrypted password appears as ".QdM.Nvz1fDDYhnwb27cMSXJmXxS23ti50z/liD3obqPRYs5UKHVbKFRtqZO.AoXJIVR6Um17RFfSwWm1"

ContainerLab Version 0.56.0

hellt commented 2 weeks ago

Hi @lostdave containerlab/vrnetlab do not modify the contents of the provided startup config.

The way it works with junos is an disk with the startup-config is mounted to the VM, and junos should read the config from it

https://github.com/hellt/vrnetlab/blob/master/vjunosswitch/docker/make-config.sh

I suppose you should check the contents of that disk to verify that the encrypted string is there as it was in the yaml file

hellt commented 2 weeks ago

buuuut, I think what could have happened is that containerlab tried to expand variables :D $6, etc

Would you mind to try using the startup-config with a file, and not as embedded multiline string to confirm this theory?

lostdave commented 2 days ago

Sorry ....slow to get back to this one..travel and training stuff.... i will have a look in the next couple of weeks and see what is going on