r/networking • u/throwM3aBurrito • Jan 24 '22
Other Embarrassing post coming from a network engineer. I never paid attention to this. Please help.
The following code is an example from an IOS-XE ASR router.
Throughout my career I've focused so much on routing/switching that I never really paid attention to services configs and their behaviour. I always just copied the AAA, local and vty line configs from other devices. Last week I realized, holy shit I don't actually know how to configure logins from scratch nor understand the order of operations.
So, reading Cisco docs is not really clear. Is there anyone that knows how the order works based on configurations for AAA, local passwords and line configs?
Which config part overwrites which part?
If you want a local login as a backup, is that the "local" keyword at the end of AAA lines?
Not gonna lie, I don't really know what "exec", "system", "default","start-stop" actually means here. Are the "username", and "AAA" config lines the foundation, and then you apply them to the console or line vty lines? Do the line vty line configs dictate the login mechanism?
For example:
username admin privilege 15 secret 5 <encrypted password>
aaa session-id common
aaa new-model
aaa group server tacacs+ TACACS_SERVER
server-private 1.1.1.1 key 7 <key1>
server-private 1.1.1.2 key 7 <key2>
ip tacacs source-interface Loopback0
aaa authentication login SSH group TACACS_SERVER local
aaa authentication login CONSOLE none
aaa authorization exec SSH group TACACS_SERVER local
aaa accounting system default start-stop group tacacs+
ip ssh maxstartups 3
ip ssh authentication-retries 5
ip ssh version 2
ip ssh pubkey-chain
username <automation_station)
key-hash ssh-rsa <hash> <user@station-id>
line con 0
logging synchronous
login authentication CONSOLE
stopbits 1
line aux 0
stopbits 1
line vty 0 4
access-class net-mgmt-access in vrf-also
exec-timeout 30 0
authorization exec SSH
logging synchronous
login authentication SSH
transport input ssh
line vty 5 15
access-class net-mgmt-access in vrf-also
exec-timeout 30 0
transport input sshDon't tell my boss I asked this question I might be fired and sent to McDonalds.
EDIT: Shoutout to u/derek below for his great explanation. It's so thorough that I feel like an idiot. You are awesome mate!
469
u/derek shnosh.io Jan 24 '22 edited Jan 25 '22
I'll step through the relevant commands from your config snippet.
Create a local user
This local
adminuser will be given priv-15 access if used for auth.Create an AAA server group
Define TACACS servers into a group named
TACACS_SERVERS. Configure the router/switch to source requests from theLo0interface... this is important to the TACACS server network device configuration.Create an AAA authentication method named
SSHFirst attempts authentication via the
TACACS_SERVERAAA server group, but fails back tolocaluser authentication if the servers in the TACACS group are unreachable.Create another AAA authentication method named
CONSOLEThis login method requires no login. I prefer
localhere (in place ofnone), regardless of physical security. Worried about forgetting the local password? It's a non-issue with a well maintained password vault.Create an AAA authorization method named
SSHAuthorize users for
execlevel access (enable) using the servers in theTACACS_SERVERgroup, fails back tolocaluser authorization if the servers in the TACACS group are unreachable.Create an AAA accounting method
Send accounting messages to any/all configured
tacacs+servers on the router/switch. This should probably begroup TACACS_SERVERto be more explicit.Configure the console port
lineparameterslogin authentication CONSOLEreferences theCONSOLEAAA authentication method (which requires no login at all), so one can connect to the console port and get access without logging in.Configure VTY
lineparametersYou generally want to modify line configs with
line vty 0 15. They'll still show in the running/startup configuration as separate groups, but you can apply the config to all available VTY lines that way.transport input sshmeans the VTY lines will only accept SSH requests (no telnet/etc).exec-timeoutdefines how long an active VTY session will survive idle/no-input.access-classuses an access-list to allow/deny SSH requests.login authentication SSHsays that the AAA authentication method namedSSHwill be used for user authentication; meaning that first it will try authentication via the servers in theTACACS_SERVERgroup, then fail back to local if they're unreachable.authorization exec SSHsays that the AAA authorization method namedSSHwill be used to authorize users for exec level access (enable); again, meaning that first it will try authorization via the servers in theTACACS_SERVERgroup, then fail back to local if they're unreachable.Further Reading
Thanks
Edit: Sheesh, very flattered by all the awards. Admittedly not entirely sure what to do with it all, but I'll figure it out. đđź
Edit 2: Because a few folks stated they were copying this to their notes, I created a Github gist so you can copy the raw markdown format.
25
u/ZPrimed Certs? I don't need no stinking certs Jan 24 '22
The person who wrote a novel was pretty thorough, but to expand on one thingâŚ
When you put âlocalâ last, it only ever gets hit if all the radius/TACACS servers are unreachable. So it truly is an âemergency onlyâ account. The AAA servers will always take precedence then, and if your âlocalâ account doesnât also exist in AAA, it will fail logins unless you disconnect the device from them (or disable AAA, or shut down the AAA servers, etc).
Just something to be aware of.
8
u/dustin_allan Jan 24 '22
So many upvotes for this post and comment replies from a 20+ year network engineer.
I can usually figure it all out when I see it, but creating the aaa config from scratch is beyond me without a cheat sheet.
26
u/VTOLfreak Jan 24 '22
I want the large fries and diet-coke.
6
u/skelley5000 Jan 24 '22
Honestly your not the only one , I work with a few people who couldnât configure this or even know what it means .. like you theyâve always copied and pasted.. but itâs good you are swallowing your pride and figuring it out and learning ..
3
u/Icarus_burning CCNP Jan 24 '22
Ahahahaha :D Sorry, everything that is useful is already told. I am just sitting here, laughing. Been there as well 2 years ago, I could configure you routing stuff but couldnt figure out for the life of me how this stuff works. Always good to know there are always people who share your pain :P
3
u/[deleted] Jan 25 '22
This is a great post and reminds me that over the years I have installed hundreds of networks and have always relied on my previous cookie cutter configurations many of which I am not even 100% sure how they work anymore as they just do and always have.
2
u/TheShortGuyThatsTall Jan 24 '22
To add to everything that was already said, the "AAA new-model" command enables AAA.
2
u/2jah Jan 25 '22
Donât delete this post, please. Would be helpful for someone later on.
2
u/nof CCNP Jan 25 '22
Absolutely not unusual for this part to get copied around forever because someone stumbled onto a config that "works for the most part." đ
1
u/sunny_monday Jan 25 '22
To be fair... every time I have to do this, I have to re-google it. The process makes sense, but to me, it is not straight-forward. Also... I typically set this and forget this. We dont normally need these commands on a regular basis.
2
u/[deleted] Jan 25 '22
Don't be ashamed for this, you're a pro for asking.
1
u/[deleted] Jan 24 '22
Hmmmmm... yep, guilty of that as well.
0
u/[deleted] Jan 25 '22
[deleted] â view deleted comment
0
u/[deleted] Jan 25 '22
[deleted] â view deleted comment