What is the basic setup for sequel pro connecting to vagrant?
I had it working but now (with SSL certs added) I can’t seem to connect to a site I previously was able to connect to.
Setup in Sequel Pro
mysql host: 127.0.0.1 user: root pass: root ssh host: mysite.dev ssh user: vagrant ssh pass: vagrant
Error in Sequel Pro is Permission denied (publickey). but keys are added on vagrant up. Also have done several provisions and destroy/up.
I’ve had similar problems in the past. SSH worked on the first box I set up, but then would not work on any box after. I tracked some info down about this in the past but I don’t remember exactly what it was. I think it had something to do with known hosts, check the article below
I am able to connect using the private _key and DB credentials for the specific box.
When trying to SSH I get
The authenticity of host 'mysite.dev (192.168.50.5)' can't be established.
RSA key fingerprint is 6e:86:1a:f1:84:9e:92:b8:c3:fe:bd:cd:e9:e1:e2:df.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'mysite.dev' (RSA) to the list of known hosts.
Warning: the RSA host key for 'mysite.dev' differs from the key for the IP address '192.168.50.5'
Offending key for IP in /Users/username/.ssh/known_hosts:4
Are you sure you want to continue connecting (yes/no)? yes
Permission denied (publickey).
MacBook-Pro:~ username$
I recently started toying with OpenSSH certs, I’m thinking this is what is causing the issue.
Reading the Vagrant docs, this could be where my issue sits
To configure SSH access with the insecure keypair, place the
public key into the ~/.ssh/authorized_keys file for the "vagrant" user.
Note that OpenSSH is very picky about file permissions.
Therefore, make sure that ~/.ssh has 0700 permissions and
the authorized keys file has 0600 permissions.
When Vagrant boots a box and detects the insecure keypair, it will
automatically replace it with a randomly generated keypair for additional
security while the box is running.
I noticed that when I Vagrant Up I get Vagrant insecure key detected. which Vagrant then replaces. This looks like I’ve messed my SSL certs and I am at a loss on how to address it.
If I try and ssh vagrant@mysite_no_ssl.dev I can shell right in. However if I ssh vagrant@mysite_ssl_enabled.dev I get permissions denied.
I can still run from within the site folder vagrant ssh. Should I be looking to replace the SSL certs manually within each site that I have this problem?
I’ve removed all key’s for that host, I can also re-produce this issue on 2 separate machines.
When I try to ssh in Sequel Pro with the suggested 192.168.50.5 setup I get the follow error
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 53: Applying options for *
debug1: Connecting to 192.168.50.5 [192.168.50.5] port 22.
debug1: fd 3 clearing O_NONBLOCK
debug1: Connection established.
debug1: identity file /Users/username/.vagrant.d/insecure_private_key type -1
debug1: identity file /Users/username/.vagrant.d/insecure_private_key-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3 pat OpenSSH*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 01:a6:9a:a0:fb:b8:4f:95:93:77:f0:67:89:45:8e:ca
debug1: Host '192.168.50.5' is known and matches the RSA host key.
debug1: Found key in /Users/username/.ssh/known_hosts:9
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/username/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/username/.vagrant.d/insecure_private_key
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).
I was able to finally get this working, however I am hesitant to say it’s the correct way. Maybe others can chime in and provide better insight.
Vagrant changed the behaviour between 1.6 and 1.7 versions and now will insert auto generated insecure key instead of the default one. I’m still learning, but to continue working and ssh into the VM I applied config.ssh.insert_key = false into the vagrant file and then re-provisioned the VM. Below is a reference to where I added this, line 28.
What I need to further learn is the proper way to setup vagrant. Looking into the docs I believe I have not setup my authenticated_keys which seems to be the reason (at least in vagrant 1.7) why I ran into trouble all of a sudden. I had this setup https://github.com/varying-vagrant-vagrants/vvv/wiki/Connecting-to-MySQL but then things went to sideways for no clear reason or what changed…keeping in mind I’m flying solo and reading all the docs AND work gets a bit much and likely missed some clear statement about a certain change.