Vagrant 1.8.5 ssh retrying bugfix

O Vagrant 1.8.5 tem um bug crítico em guests linux, o vagrant simplesmente não consegue terminar o vagrant up por causa de um bug na geração do arquivo authorized_keys que contém as chaves permitidas para acesso ssh por chaves no guest. O problema é que o vagrant está gerando o arquivo com a permissão errada e o subsistema ssh — neste casos — ignora o arquivo por questões de segurança.

Você provavelmente está tendo uma saíde similar após atualizar para o 1.8.5

centos: Waiting for machine to boot. This may take a few minutes...
    centos: SSH address: 127.0.0.1:2222
    centos: SSH username: vagrant
    centos: SSH auth method: private key
    centos: Warning: Remote connection disconnect. Retrying...
    centos:
    centos: Vagrant insecure key detected. Vagrant will automatically replace
    centos: this with a newly generated keypair for better security.
    centos:
    centos: Inserting generated public key within guest...
    centos: Removing insecure key from the guest if it's present...
    centos: Key inserted! Disconnecting and reconnecting using new SSH key...
    centos: Warning: Authentication failure. Retrying...
    centos: Warning: Authentication failure. Retrying...
    centos: Warning: Authentication failure. Retrying...
    centos: Warning: Authentication failure. Retrying...
    centos: Warning: Authentication failure. Retrying...
    centos: Warning: Authentication failure. Retrying...
    centos: Warning: Authentication failure. Retrying...
    centos: Warning: Authentication failure. Retrying...
    centos: Warning: Authentication failure. Retrying...
    centos: Warning: Authentication failure. Retrying...

A solução é simples edite o arquivo public_key.rb

/opt/vagrant/embedded/gems/gems/vagrant-1.8.5/plugins/guests/linux/cap/public_key.rb

Procure a linha

mv ~/.ssh/authorizedkeys.tmp ~/.ssh/authorizedkeys

Adicione abaixo dela

chmod 0600 ~/.ssh/authorized_keys

Salve, e suba a VM novamente, isso deve resolver o problema.

Refs

No vagrant 1.8.6 isto estará resolvido, mais info sobre o bug abaixo

[s]
Guto


Gostou do conteúdo?

Você também me encontra nessas redes!

Mastodon

@gutocarvalho@bolha.us

PixelFed

@gutocarvalho@bolha.photos

Lemmy

@gutocarvalho@bolha.forum

WriteFreely

@gutocarvalho@bolha.blog @notamental@bolha.blog @poesias@bolha.blog @contos@bolha.blog

Bookwyrm

@gutocarvalho@bolha.review

Peertube

@gutocarvalho@bolha.tube

Friendica

@gutocarvalho@bolha.network

Quer saber mais sobre mim?

Visite meus sites!

E meus blogs:

Conhece o Coletivo Bolha?

Então vem conhecer o bolha.io ou bolhaverso!

Nós temos muito mais para compartilhar contigo!

Quer apoiar nosso trabalho? Você pode!

Te vejo no mastodon da bolha.us!

[s]