crc-org / crc

CRC is a tool to help you run containers. It manages a local OpenShift 4.x cluster, Microshift or a Podman VM optimized for testing and development purposes
https://crc.dev
Apache License 2.0
1.27k stars 243 forks source link

Be able to customize the developer account password #2539

Open guillaumerose opened 3 years ago

guillaumerose commented 3 years ago

Now that the CA and the kubeadmin password are rotated, we are close to have a fully secured cluster. Only the developer account has always the same default password developer.

We can rotate it by default and/or add a new configuration option/flag to customize it

rohanKanojia commented 3 weeks ago

Hello, Could you please help me in understanding what needs to be done in order to fix this issue? I'll try to explain what I understand at the moment. Feel free to add anything in case I've missed anything.

This issue seems to be created as a follow up task done in https://github.com/crc-org/crc/commit/5a6e9022da4bca30d4301daf4944eb718a15daf9

I think we want to achieve these things:

To do this, we would need to refactor this method to be generic enough to generate a password for any specified user: https://github.com/crc-org/crc/blob/d9f83bcc27dc8717469091553c90d9b97c2b5105/pkg/crc/cluster/kubeadmin_password.go#L21

We would also need to update start.go to generate a password for developer user just like kubeadmin: https://github.com/crc-org/crc/blob/d9f83bcc27dc8717469091553c90d9b97c2b5105/pkg/crc/machine/start.go#L685-L688

Also, we need to add another field in ClusterConfig struct to store developer password and adjust other structs to read it: https://github.com/crc-org/crc/blob/d9f83bcc27dc8717469091553c90d9b97c2b5105/pkg/crc/cluster/kubeadmin_password.go#L20-L21

praveenkumar commented 2 weeks ago

As soon as we make change to generate password for the developer user, we also need to provide a way for users to set it accordingly. Otherwise automation might not work if we random generate those and not provide option to set it as per user choice.