I am trying to work on providing temporary access with SSH using certificate authority on aws EC2 instance, but not able to do it properly. Can you please help give guidance on how can this be acheived? Process followed mentioned below:
Step 1: Generate CA certificate on user's machine (currently doing for testing) : ssh-keygen -f ssh_ca
Step 2: Generate user's ssh keys using (on users machine): ssh-keygen
-f user_ssh_key
Step 3: Generate CA approved public key using user's public key: ssh-keygen -s ssh_ca -I host_name -h -n host_name -V +1d user_ssh_key.pub , this gives user_ssh_key-cert.pub (Public key which is signed)
Step 4: Copied ssh_ca.pub (CA pub key) and user_ssh_key ,user_ssh_key-cert.pub (user's pub and private key) on server where i have to do ssh.
Step 5: Do sudo su, go to file: vim /etc/ssh/sshd_config, Add CA pub key using : TrustedUserCAKeys /etc/ssh/ssh_ca.pub, add host key using HostCertificate /etc/ssh/user_ssh_key-cert.pub and added private key using : HostKey /etc/ssh/user_ssh_key
Step 6: Do /etc/init.d/sshd restart
Step 7: Open file /etc/ssh/ssh_known_hosts, add @cert-authority * (Content of ssh_ca.pub, without any change)
When i try to do ssh using : ssh host_name@IP_ADDRESS
Getting this error during ssh which seems to be a issue :
debug1: Found CA key in /etc/ssh/ssh_known_hosts:1
key_cert_check_authority: invalid certificate
Certificate invalid: not a host certificate
debug1: No matching CA found. Retry with plain key
Can anyone please help guide in this process, something small seems to went wrong which i am not able to figure out?
Currently i don't have dns name but IP address which i want to connect to.
Thanks in advance