LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 08-11-2017, 01:05 PM   #1
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 789

Rep: Reputation: Disabled
Allow SSH client to connect without username or ssh key


A remote client is behind a firewall and the firewall is configured to allow outgoing access only and to only allow outgoing access to a single IP which is myserver.com.

The remote client executes the following:

ssh -R 2222:localhost:22 someuser@myserver.com

Then on myserver.com, the following can be executed to create a ssh tunnel into the remote client:

ssh -p 2222 someuser@localhost

That is, until I accidentally deleted all the keys in myserver's /home/someuser/.ssh/authorized_keys

Is it possible to configure myserver to allow user someuser to ssh into myserver without a password or ssh key?

Is it possible to retreive the remote client's public key when it attempts to connect?
 
Old 08-11-2017, 02:22 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
ssh-copy-id attempts to add the file ~/.ssh/id_rsa.pub to the authorized_keys file on a remote host. You could enable password login long enough to do this, or you can copy the file manually and append it to authorized_keys. I don't know an easy way to capture it out of the ssh handshake (except maybe using wireshark).
 
Old 08-11-2017, 02:37 PM   #3
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 789

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by smallpond View Post
ssh-copy-id attempts to add the file ~/.ssh/id_rsa.pub to the authorized_keys file on a remote host. You could enable password login long enough to do this, or you can copy the file manually and append it to authorized_keys. I don't know an easy way to capture it out of the ssh handshake (except maybe using wireshark).
Either way I have to gain physical access to the machine. Which is possible, just a pain. I am starting to think there public key is never passed upon initial connection attempt, only its key because presumably it already exists on the remote server.
 
Old 08-11-2017, 03:36 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,699

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Except for the ssh-copy-id command the actual keys are never sent between the client and the server during a ssh session.

You can enable the server for password authentication and you can allow empty passwords but the later is highly discouraged. If the public key still exists on the remote server you will either need to gain physical access or have someone send you the key in some other manner.

If the public key does not exist on the remote server you will need to generate new keys.

Last edited by michaelk; 08-11-2017 at 03:39 PM.
 
Old 08-11-2017, 03:58 PM   #5
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,306
Blog Entries: 3

Rep: Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720
Quote:
Originally Posted by michaelk View Post
If the public key does not exist on the remote server you will need to generate new keys.
Or might as well generate new keys, it can be a good opportunity to rotate keys. Though if the private keys are still available on the client the public keys can be regenerated easily with ssh-keygen

Code:
ssh-keygen -f mykey_rsa -y > mykey_rsa.pub
 
Old 08-11-2017, 04:02 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,699

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Yep, forgot about that..
 
Old 08-11-2017, 04:03 PM   #7
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,306
Blog Entries: 3

Rep: Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720
I usually do to. It has come in handy about twice so far though.
 
Old 08-12-2017, 09:41 AM   #8
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939
If you want "neither passwords nor an ssh-key," just use telnet.

Seriously.

An SSH connection provides no(!) more actual security than telnet, if it is possible for anyone in the world to get to a login: prompt.

If you want to secure the connection without inconveniencing your users, simply use an OpenVPN tunnel, secured by tls-auth and unique digital keys. The users on both sides will find that "the other side is 'part of our local network.'" And yet, communication between the two is provably secure, and the identity of the party on the far side of the link can be relied-upon. Although the encryption process is now made entirely invisible to authorized users, it is there.

And, with tls-auth, it is invisible to the outside world: there are no "open ports," and attempts to start an OpenVPN connection are ... silently ignored. Authorized users pass swiftly through. L33T H4X0RZ cannot detect that the secret door exists.

"Number of unauthorized connection attempts: Zero."

Last edited by sundialsvcs; 08-12-2017 at 09:44 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: What is SSH Key? How To Generate SSH Key in Linux? LXer Syndicated Linux News 0 04-30-2017 07:42 AM
connect to ssh with public key marchelloUA Linux - General 5 09-30-2016 09:58 AM
ssh: can't connect: no key found? RandomTroll Linux - Software 3 05-10-2015 10:57 PM
Rsyncing between windows client and gentoo server, over ssh, using key for auth. Passive Linux - Networking 0 08-03-2005 11:05 AM
to 2.6.10 from 2.4.26 | ssh client | Host key verification failed kaN5300 Slackware 6 01-05-2005 10:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 09:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration