SSH Access to ASA

Answered Question
Apr 23rd, 2010

I can't access our ASA 5505 via SSH from the outside. I've configured this through the ASDM to allow SSH (Device Management > Management Access > ASDM/HTTPS/Telnet/SSH). I added a rule that allows SSH on the outside interface from 0.0.0.0 0.0.0.0. When I try to ssh in with putty, it says "server unexpectedly closed network connection" When I watch the logs on the ASA, it shows a Built inbound TCP connection on port 22, but then immediately a Teardown TCP connection. It doesn't show it's being blocked by any rule. Is there something I'm missing on enabling SSH?

Thanks,

Scott

I have this problem too.
0 votes
Correct Answer by Federico Coto F... about 6 years 7 months ago

Hi,

Besides allowing the permitted hosts to SSH to the ASA, you need to define RSA keys for the secure connection.

In the CLI:

crypto key generate rsa

For these key to work, you should have a hostname/domain-name configured on the ASA as well (unless you configure a dedicated RSA keys).

So basically, configure a hostname, domain name and generate the RSA key pair:

hostname NAME_OF_ASA

domain-name NAME_OF_DOMAIN

crypto key generate rsa

Accept the default of 1024 and it should work.

Federico.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 4.5 (3 ratings)
Loading.
Correct Answer
Federico Coto F... Fri, 04/23/2010 - 10:40

Hi,

Besides allowing the permitted hosts to SSH to the ASA, you need to define RSA keys for the secure connection.

In the CLI:

crypto key generate rsa

For these key to work, you should have a hostname/domain-name configured on the ASA as well (unless you configure a dedicated RSA keys).

So basically, configure a hostname, domain name and generate the RSA key pair:

hostname NAME_OF_ASA

domain-name NAME_OF_DOMAIN

crypto key generate rsa

Accept the default of 1024 and it should work.

Federico.

Scott Pazelt Fri, 04/23/2010 - 10:50

Thanks for your response.

I had to enter that command through the ASDM and got the results below. Do I need to replace the existing key?

Result of the command: "crypto key generate rsa"

WARNING: You have a RSA keypair already defined named .

Do you really want to replace them? [yes/no]:
% Please answer 'yes' or 'no'.
Do you really want to replace them? [yes/no]:
% Please answer 'yes' or 'no'.
Do you really want to replace them? [yes/no]:
% ERROR: Timed out waiting for a response.
ERROR: Failed to create new RSA keys named

Federico Coto F... Fri, 04/23/2010 - 10:54

Are those RSA keys already in used for something else?  If not, you can do:  crypto key zeroize and regenerate the RSA keys.

You should be able to SSH fine.

We know the connection is getting to the ASA because you see the log.

Can you regenerate the RSA keys and attempt the connection?

If it does not work, please post the output of the ''sh run ssh'' command and the public IP address where the SSH client connection is coming from.

Federico.

Scott Pazelt Fri, 04/23/2010 - 11:15

I ran "crypto key zeroize" and removed the key, then ran" crypto key generate rsa" to regenerate the key. I tried ssh'ing back in, but got the same error. I checked the logs and saw the same thing again.

Here is the output of sh run ssh

ssh scopy enable
ssh 0.0.0.0 0.0.0.0 inside
ssh 0.0.0.0 0.0.0.0 outside
ssh timeout 60

Thanks,

Scott

Joseph Dworak Tue, 08/26/2014 - 09:25

I'm sure you have this figured out by now.  But you have to go to Configuration > Device management > Users/AAA > AAA Access and "Enable" SSH and assign to "LOCAL".  Doing a Debug ssh 127 will show you keys to the reason.  If you are getting a "no AAA" message then your device is trying to use external AAA.  Enable it to Local and you are good to go.

Scott Pazelt Fri, 04/23/2010 - 11:32

I wonder if since I'm running these commands from the ASDM CLI, if they're running all the way. I thought when you run the crypto key generate rsa command it asks you some questions. I didn't get anything returned. Is there a way to pull up an actual cli session from the ASDM?

Federico Coto F... Fri, 04/23/2010 - 11:37

Scott,

I think you're correct and the RSA needs to be done via the CLI.

Can you telnet/SSH to the ASA?

Cannot be done via ADSM.

Federico.

Scott Pazelt Fri, 04/23/2010 - 11:49

I can't. It's at a remote location in another country so I don't even have physical access. Not sure how I'm going to do this, but thanks for your help.

Federico Coto F... Fri, 04/23/2010 - 11:53

To be sure, we can run the debug for SSH:

debug ssh 127

The output of this command should tell us what the problem is.

Federico.

Scott Pazelt Fri, 04/23/2010 - 12:09

Is there a way to run this in the ASDM CLI? I tried from but got the message "debug commands are not supported".

Federico Coto F... Fri, 04/23/2010 - 12:27

As far as I've seen you'll need CLI access to enable SSH.

Debugs don't seem to work on ASDM either.

Apologies, I always use CLI only.

Federico.

gyterpena Tue, 02/05/2013 - 08:05

Be careful with "crypto key zero noconfirm" as it will remove ALL keys you have configured on ASA including 3rd party that might be used.

Actions

This Discussion

Related Content