05-08-2017 05:54 AM - edited 03-03-2019 08:32 AM
I want to use SCP from a unix server to batch collect backup of my configuration files in our Cisco devices.
I have ASA firewall's, ISR Routers and 3850 switches.
All devices is configured to use aaa validation on a Cisco ACS tacacs server for interactive CLI and ASDM management.
i successfully created a RSA public key / private key file pair on the UNIX server.
i have enabled the scp server on all my cisco devices.
The public key information has been added to the ip ssh pubkey-chain on the IOS devices
ASA version 9.7.1
ISR version IOS XE 03.13.04.S
3850 version IOS XE CAT3K 03.07.05E
ASA SSH login and SCP filetransfer works fine.
But for the IOS XE devices it do not work as expected.
Devices accepts the login authentication but fails in the authorization.
Any one have a sugestion on how to fix this?
here is some verbose output from connection attempt to a IOS XE device:
ssh -i backup-rsa-key backupuser@192.168.140.17 -v
OpenSSH_6.6.1, OpenSSL 1.0.1i-fips 6 Aug 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 25: Applying options for *
debug1: Connecting to 192.168.140.17 [192.168.140.17] port 22.
debug1: Connection established.
debug1: identity file backup-rsa-key type 1
debug1: identity file backup-rsa-key-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 1.99, remote software version Cisco-1.25
debug1: no match: Cisco-1.25
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<7680<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 ea:0c:72:d8:cd:4f:9a:40:40:d7:6c:8d:99:f0:df:0c [MD5]
debug1: Host '192.168.140.17' is known and matches the RSA host key.
debug1: Found key in /home/myuserid/.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,keyboard-interactive,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: backup-rsa-key
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey). <------------------------------------------------------------Authentication OK
Authenticated to 192.168.140.17 ([192.168.140.17]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
III --------------------------------------------------
III THIS DEVICE IS PART OF A PRIVATE NETWORK
III ---------------------------------------------------
III Use is subject to audit at any time by XXXX.
III
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
III Unauthorised access or use of this equipment is prohibited
III If you are not authorised to use this system,
III Terminate this session now.
III
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
% Authorization failed. <--------------------------------------------------------------------------------------------------Autorization failed
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
Connection to 192.168.140.17 closed.
Transferred: sent 4136, received 3000 bytes, in 2.1 seconds
Bytes per second: sent 1949.0, received 1413.7
debug1: Exit status 0
myuserid@myserver:~>
On device this is seen as:
DKPGSWBA01#sh deb
General OS:
AAA Authorization debugging is on
DKPGSWBA01#term mon
DKPGSWBA01#
DKPGSWBA01#
May 8 12:39:21.407: AAA/BIND(000006DA): Bind i/f
May 8 12:39:21.417: %SEC_LOGIN-5-LOGIN_SUCCESS: Login Success [user: backupuser] [Source: 192.168.140.250] [localport: 22] at 12:39:21 UTC Mon May 8 2017
May 8 12:39:21.425: AAA/AUTHOR (0x6DA): Pick method list 'default'
May 8 12:39:21.440: AAA/AUTHOR/EXEC(000006DA): Authorization FAILED
DKPGSWBA01#
AAA configuration and pubkey-chain
aaa new-model
!
!
aaa group server tacacs+ ipgacs
server-private 192.168.140.10 key xxxxxxxxx
!
aaa authentication attempts login 5
aaa authentication login default group ipgacs local-case
aaa authentication enable default group ipgacs enable
aaa authorization exec default group ipgacs local if-authenticated
!
ip ssh pubkey-chain
username backupuser
key-hash ssh-rsa 7E7188FE2DE9281D011642510016EE6E
ip scp server enable
!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide