sshchef-infraknife

How to fix 'knife bootstrap ssh connection to client issue' in chef?


i'm trying to add a chef client node from chef workstation using knife bootstrap command.But getting error message as '''ERROR: Train::Transports::SSHFailed: SSH session could not be established'''

I have disabled iptables on chef client

[root@chefclient ~]# service iptables status
Redirecting to /bin/systemctl status  iptables.service
iptables.service - IPv4 firewall with iptables
   Loaded: loaded (/usr/lib/systemd/system/iptables.service; disabled)
   Active: inactive (dead)

Jul 29 16:21:18 chefclient.jp.com systemd[1]: [/usr/lib/systemd/system/iptables.service:5] Unknown lvalue 'AssertPathExists' in... 'Unit'
Hint: Some lines were ellipsized, use -l to show in full

'''knife bootstrap 192.168.56.6 -N chefclient.jp.com -U root --sudo -i /root/Downloads/chefsetup.pem'''

Getting result as:
Connecting to 192.168.56.6
WARN: [SSH] PTY requested: stderr will be merged into stdout
The authenticity of host '192.168.56.6 ()' can't be established.
fingerprint is SHA256:8x0e7QPub3Zj/2GFz5XSFZCABEbez6uVV/eR1MvYoIE.

Are you sure you want to continue connecting
? (Y/N) Y
WARN: [SSH] PTY requested: stderr will be merged into stdout
WARN: [SSH] connection failed, terminating (#<Net::SSH::AuthenticationFailed: Authentication failed for user root@192.168.56.6>)
ERROR: Train::Transports::SSHFailed: SSH session could not be established

Solution

  • The Issue is fixed after downloaded the knife.rb file,oraganization-validator.pem from chef server webui and kept in .chef directory on chefstation and ran the knife bootstrap command as below

    '''knife bootstrap 192.168.56.6 -N chefclient.jp.com -U root'''

    Output:

    Connecting to 192.168.56.6
    WARN: [SSH] PTY requested: stderr will be merged into stdout
    The authenticity of host '192.168.56.6 ()' can't be established.
    fingerprint is SHA256:8x0e7QPub3Zj/2GFz5XSFZCABEbez6uVV/eR1MvYoIE.
    
    Are you sure you want to continue connecting
    ? (Y/N) Y
    WARN: [SSH] PTY requested: stderr will be merged into stdout
    Performing legacy client registration with the validation key at /root/chef-repo/.chef/short_name-validator.pem...
                                                                                                               Delete your validation key in order to use your user credentials for client registration instead.
    Bootstrapping 192.168.56.6
     [192.168.56.6] -----> Installing Chef Omnibus (stable/15)
    downloading https://omnitruck.chef.io/chef/install.sh
    ......................................................
    ......................................................
    
    [192.168.56.6] Thank you for installing Chef Infra Client! For help getting started visit https://learn.chef.io
     [192.168.56.6] Starting the first Chef Infra Client Client run...
     [192.168.56.6] Starting Chef Infra Client, version 15.1.36
     [192.168.56.6] Creating a new client identity for chefclient.jp.com using the validator key.
     [192.168.56.6] resolving cookbooks for run list: []
     [192.168.56.6] Synchronizing Cookbooks:
     [192.168.56.6] Installing Cookbook Gems:
    Compiling Cookbooks...
    [2019-07-30T13:12:01+05:30] WARN: Node chefclient.jp.com has an empty run list.
     [192.168.56.6] Converging 0 resources