[CentOS] google cloud compute with PEM file
Hi all, I am using the google cloud compute engine and we have a client that does not want to share their ssh keys. So I have been attempting to set up a PEM file for ssh access. Both the local server I used for testing and the cloud vm are centos 6. I created a user on the cloud box, ran "ssh-keygen -t rsa" and took the defaults. I then copied the id_rsa.pub file to the local centos box, renamed it then made my test user the owner of the file. I then attempted to connect to the user I created on the google cloud box with the PEM file as shown below, but got the following error. [test1@pgpool1 ~]$ ssh -i /home/test1/my-key.txt upload@815.677.151.45 Permission denied (publickey,gssapi-keyex,gssapi-with-mic). Have any of you done this successfully before? Or know what the issue may be? Thanks in advance ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] google cloud compute with PEM file
In article <573b48c8.1070...@consistentstate.com>, Dustin Kempter wrote: > Hi all, > I am using the google cloud compute engine and we have a client > that does not want to share their ssh keys. So I have been attempting to > set up a PEM file for ssh access. Both the local server I used for > testing and the cloud vm are centos 6. > > I created a user on the cloud box, ran "ssh-keygen -t rsa" and took the > defaults. I then copied the id_rsa.pub file to the local centos box, > renamed it then made my test user the owner of the file. I then > attempted to connect to the user I created on the google cloud box with > the PEM file as shown below, but got the following error. > > [test1@pgpool1 ~]$ ssh -i /home/test1/my-key.txt upload@815.677.151.45 > Permission denied (publickey,gssapi-keyex,gssapi-with-mic). > > Have any of you done this successfully before? Or know what the issue > may be? Try adding -v to the ssh command, to get more information. But also, on the server you are trying to log in to, the public key needs to be copied into ~/.ssh/authorized_keys - not left in its own file. Also make sure that the ~/.ssh/directory is owned by the user and has permissions of 700. Cheers Tony -- Tony Mountifield Work: t...@softins.co.uk - http://www.softins.co.uk Play: t...@mountifield.org - http://tony.mountifield.org ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] google cloud compute with PEM file
On 5/17/16 10:47 AM, Tony Mountifield wrote: In article <573b48c8.1070...@consistentstate.com>, Dustin Kempter wrote: Hi all, I am using the google cloud compute engine and we have a client that does not want to share their ssh keys. So I have been attempting to set up a PEM file for ssh access. Both the local server I used for testing and the cloud vm are centos 6. I created a user on the cloud box, ran "ssh-keygen -t rsa" and took the defaults. I then copied the id_rsa.pub file to the local centos box, renamed it then made my test user the owner of the file. I then attempted to connect to the user I created on the google cloud box with the PEM file as shown below, but got the following error. [test1@pgpool1 ~]$ ssh -i /home/test1/my-key.txt upload@815.677.151.45 Permission denied (publickey,gssapi-keyex,gssapi-with-mic). Have any of you done this successfully before? Or know what the issue may be? Try adding -v to the ssh command, to get more information. But also, on the server you are trying to log in to, the public key needs to be copied into ~/.ssh/authorized_keys - not left in its own file. Also make sure that the ~/.ssh/directory is owned by the user and has permissions of 700. Cheers Tony Thank you! I added the authorized keys on the server I am trying to connect to and now when I run the same command on the test server it is asking me for the passphrase, as I did not set one I just hit enter and then get the same permission denied error as before. Is there something I missed? permissions are correct for sure on the google cloud server that im trying to connect to. The key file on the test server is set to 0600 Thanks in advance! ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] google cloud compute with PEM file
On Tue, 17 May 2016 13:59:18 -0600 Dustin Kempter wrote: > Is there something I missed? ssh -v serveryouwanttoconnectto That will tell you what the problem is. If you don't understand the output, post it here. -- MELVILLE THEATRE ~ Real D 3D Digital Cinema ~ www.melvilletheatre.com ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] google cloud compute with PEM file
On 5/17/16 2:12 PM, Frank Cox wrote: On Tue, 17 May 2016 13:59:18 -0600 Dustin Kempter wrote: Is there something I missed? ssh -v serveryouwanttoconnectto That will tell you what the problem is. If you don't understand the output, post it here. Here is the command and output [test1@pgpool1 ~]$ ssh -v -i /home/test1/my-key.txt upload@144.167.188.62 OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to 104.197.158.61 [104.197.158.61] port 22. debug1: Connection established. debug1: identity file /home/test1/my-key.txt type 1 debug1: identity file /home/test1/my-key.txt-cert type -1 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3 debug1: match: OpenSSH_5.3 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_5.3 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr hmac-md5 none debug1: kex: client->server aes128-ctr hmac-md5 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: Host '104.197.158.61' is known and matches the RSA host key. debug1: Found key in /home/test1/.ssh/known_hosts:1 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic debug1: Next authentication method: gssapi-keyex debug1: No valid Key exchange context debug1: Next authentication method: gssapi-with-mic debug1: Unspecified GSS failure. Minor code may provide more information Credentials cache file '/tmp/krb5cc_501' not found debug1: Unspecified GSS failure. Minor code may provide more information Credentials cache file '/tmp/krb5cc_501' not found debug1: Unspecified GSS failure. Minor code may provide more information debug1: Unspecified GSS failure. Minor code may provide more information Credentials cache file '/tmp/krb5cc_501' not found debug1: Next authentication method: publickey debug1: Offering public key: /home/test1/my-key.txt debug1: Server accepts key: pkalg ssh-rsa blen 277 debug1: PEM_read_PrivateKey failed debug1: read PEM private key done: type Enter passphrase for key '/home/test1/my-key.txt': debug1: No more authentication methods to try. Permission denied (publickey,gssapi-keyex,gssapi-with-mic). [test1@pgpool1 ~]$ ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] google cloud compute with PEM file
On Tue, 17 May 2016 14:34:03 -0600 Dustin Kempter wrote: > Enter passphrase for key '/home/test1/my-key.txt': Since your private key is encrypted, have you entered the passphrase for the private key when asked at this point in the login? -- MELVILLE THEATRE ~ Real D 3D Digital Cinema ~ www.melvilletheatre.com ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] google cloud compute with PEM file
On 5/17/16 2:43 PM, Frank Cox wrote: On Tue, 17 May 2016 14:34:03 -0600 Dustin Kempter wrote: Enter passphrase for key '/home/test1/my-key.txt': Since your private key is encrypted, have you entered the passphrase for the private key when asked at this point in the login? Yes I did ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] google cloud compute with PEM file
On Tue, 2016-05-17 at 14:34 -0600, Dustin Kempter wrote: > Connecting to 104.197.158.61 [104.197.158.61] port 22. (1) I would change the port from 22 to something more difficult to guess, perhaps 49026 (for example) and then block port 22 in the firewall. (2) Allow to port 49026 (for example) traffic from your IP and block traffic from all other IPs. Do not forget there are people out there desperate to get into your computer system, so make it more difficult for them. -- Regards, Paul. England, EU. England's place is in the European Union. ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] google cloud compute with PEM file
On May 17, 2016, at 7:56 PM, Always Learning wrote: > (1) I would change the port from 22 to something more difficult to > guess, perhaps 49026 (for example) and then block port 22 in the > firewall. If you’re going to change the port, change it to something <1024. You don’t want to have sshd running on a port that a non-root user can bind to. -- Jonathan Billings ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] google cloud compute with PEM file
On Tue, 2016-05-17 at 20:12 -0400, Jonathan Billings wrote: > On May 17, 2016, at 7:56 PM, Always Learning wrote: > > (1) I would change the port from 22 to something more difficult to > > guess, perhaps 49026 (for example) and then block port 22 in the > > firewall. > > If you’re going to change the port, change it to something <1024. You don’t > want to have sshd running on a port that a non-root user can bind to. But if, as I suggested, the enquirer restricts access to that port to his own IP, access attempts from other IPs will fail. Ports > 1024 can be accessed by authorised non-root users using the authorised originating IP whilst preventing access from all other IPs. -- Regards, Paul. England, EU. England's place is in the European Union. ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] google cloud compute with PEM file
On 2016-05-17, Always Learning wrote: > > (1) I would change the port from 22 to something more difficult to > guess, perhaps 49026 (for example) and then block port 22 in the > firewall. > > (2) Allow to port 49026 (for example) traffic from your IP and block > traffic from all other IPs. > > Do not forget there are people out there desperate to get into your > computer system, so make it more difficult for them. If you've blocked access to the sshd port for all but whitelisted IPs, there's little point in moving sshd to a nonstandard port. If you want defense in depth, use the cloud firewall, the host firewall, and something like sshguard, and just leave sshd on port 22. --keith -- kkel...@wombat.san-francisco.ca.us ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] google cloud compute with PEM file
On Wed, May 18, 2016 at 03:25:11AM +0100, Always Learning wrote: > On Tue, 2016-05-17 at 20:12 -0400, Jonathan Billings wrote: > > If you’re going to change the port, change it to something <1024. You > > don’t want to have sshd running on a port that a non-root user can bind to. > > But if, as I suggested, the enquirer restricts access to that port to > his own IP, access attempts from other IPs will fail. Ports > 1024 can > be accessed by authorised non-root users using the authorised > originating IP whilst preventing access from all other IPs. That's not the point. If you bind to a port > 1024, then if your non root account is compromised (or some other non-root account), then it can start up a trojaned sshd on that port. As others have said, might as well keep it on port 22, and just block connections from any network but what you trust. Make sure you keep your packages up to date and run SELinux enabled. -- Jonathan Billings ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] google cloud compute with PEM file
On Tue, May 17, 2016 16:34, Dustin Kempter wrote: ere. >> > Here is the command and output > > > [test1@pgpool1 ~]$ ssh -v -i /home/test1/my-key.txt > upload@144.167.188.62 . . . > debug1: Authentications that can continue: > publickey,gssapi-keyex,gssapi-with-mic > debug1: Next authentication method: gssapi-keyex > debug1: No valid Key exchange context > debug1: Next authentication method: gssapi-with-mic > debug1: Unspecified GSS failure. Minor code may provide more > information > Credentials cache file '/tmp/krb5cc_501' not found > > debug1: Unspecified GSS failure. Minor code may provide more > information > Credentials cache file '/tmp/krb5cc_501' not found > > debug1: Unspecified GSS failure. Minor code may provide more > information > > > debug1: Unspecified GSS failure. Minor code may provide more > information > Credentials cache file '/tmp/krb5cc_501' not found > > debug1: Next authentication method: publickey > debug1: Offering public key: /home/test1/my-key.txt > debug1: Server accepts key: pkalg ssh-rsa blen 277 > debug1: PEM_read_PrivateKey failed > debug1: read PEM private key done: type > Enter passphrase for key '/home/test1/my-key.txt': > debug1: No more authentication methods to try. > Permission denied (publickey,gssapi-keyex,gssapi-with-mic). > [test1@pgpool1 ~]$ > > > If SELinux is enabled then try this: restorecon -R ~/.ssh -- *** e-Mail is NOT a SECURE channel *** Do NOT transmit sensitive data via e-Mail Do NOT open attachments nor follow links sent by e-Mail James B. Byrnemailto:byrn...@harte-lyne.ca Harte & Lyne Limited http://www.harte-lyne.ca 9 Brockley Drive vox: +1 905 561 1241 Hamilton, Ontario fax: +1 905 561 0757 Canada L8E 3C3 ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos