mmumshad / kubernetes-the-hard-way

Bootstrap Kubernetes the hard way on Vagrant on Local Machine. No scripts.
Apache License 2.0
4.6k stars 4.48k forks source link

[Bug]: Password authentication is not truely enabled. #334

Closed chinmaymjog closed 6 months ago

chinmaymjog commented 7 months ago

Your Workstation

MacBook Pro 2.6 GHz 6-Core Intel Core i7 16 GB 2400 MHz DDR4 14.2.1 (23C71)

What happened?

In section https://github.com/mmumshad/kubernetes-the-hard-way/blob/master/docs/03-client-tools.md#access-all-vms When I try to copy over the SSH keys it won't work & does not ask for a password. The script kubernetes-the-hard-way/vagrant/ubuntu/ssh.sh does not truly enable Password auth as # remains in the config file. Also even if I uncomment it manually we need to set 'KbdInteractiveAuthentication' to 'yes'.

To fix it I slightly altered kubernetes-the-hard-way/vagrant/ubuntu/ssh.sh

#!/bin/bash

# Enable password auth in sshd so we can use ssh-copy-id
# sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
sudo sed -i 's/#PasswordAuthentication/PasswordAuthentication/' /etc/ssh/sshd_config
sudo sed -i 's/KbdInteractiveAuthentication no/KbdInteractiveAuthentication yes/' /etc/ssh/sshd_config
systemctl restart sshd

Relevant output

No response

fireflycons commented 7 months ago

Thank you. I am actually working on this same issue for the kubeadm installations in the CKA repo. That will be moved over to here in due course, along with a version for newer macbooks that don't work with VirtualBox

fireflycons commented 6 months ago

Course has been updated for latest kubernetes and fully tested. SSH setup has been fixed.