Basic Device Security
On this page
Purpose
- Similar to the Basic Device Setup guide, this page is a good checklist for the basics of securing a cisco device
- Some topics have more in depth configurations that may or may not be needed
Enable Passwords
- Setting a password to prevent unauthorized access to enable mode
- Even if local logins are configured on console, or a user has authenticated via ssh, they will still need this separate enable password to enter privileged exec mode
- Using
algorithm-typekeyword lets you set more advanced hashing algorithms than the defaultmd5hash, so bad actors can’t get their hands on a config file and reverse the hash to plain textscryptis the best option
- The device will only save a hash of your password in the config file
enable algorithm-type scrypt secret {password}Local Usernames and Passwords
- Creating usernames and passwords locally on the device is a good option if you can’t or don’t have centralized AAA server like tacacs+, radius or ISE server on the network
- If you can use centralized AAA server you should
- Even if using central AAA server you should have a local user account as a backup if the AAA server was down or unreachable
- Same as enable passwords it’s good to use a more advanced hashing algo like scrypt
user {username} algorithm-type {hash-protocol} secret {password}User Privilege Levels
- Setting privilege levels for users allows you to configure what commands a user can run
- 0 is the lowest level allowing only basic commands like
pingtraceroute - 1 allows all command in basic user EXEC mode
- 2 -14 allow you to set custom levels and define what commands the user at a given level can use
- Still can’t access config mode
- Drops them right into a version of privileged exec mode that sllowsco
- 15 is full access allowing privilege exec mode config mode, debug, everything
user {username} privilege {level}- Setting custom 2-14 levels commands, repeat command to allow more commands
- Def need to test this before giving user account to remote tech to make sure it’s working as you want it to
privilege exec level {level} {command-to-allow}Console Line Security
- You can require local user auth on the console line to prevent unauthorized users from connecting to console
- Configure a login timeout
line con 0
login local
exec-timeout {minutes}SSH and VTY Lines
- SSH requires
- hostname
- domain name
- generating a crypto key
- rsa 4096 is a good safe choice
- some devices do support ECDSA which has smaller keys and quicker handshakes
- creating a local username and password
- enabling local login on vty line
- Devices support a set number of vty lines. Example
line 0 15allows 16 vty connections at once - Best practice to configure all the same so none are left in default
- Devices support a set number of vty lines. Example
- You should also enforce ssh version 2
- Optionally configure access list to allow login only from certain ip’s
hostname {hostname}ip domain-name {example.com}crypto key genrate rsa 4096ip ssh version 2- optional acl config
access-list {acl-nubmer} permit {subnet} {wildcard-mask}line vty {start} {end}
transport input ssh
login local
! optional acl
access-class {acl-number} inAvoiding VLAN Hoping (Re-visit)
- DESCRIBE VLAN HOPPING
- The following 2 sections will allow you to avide VLAN hopping attacks
Native Vlan Best Practice
- VLAN other than 1 that is configured as native VLAN on trunk links
- No SVI or ip address range for this VLAN configured
vlan 999
name BLACKHOLE
!
! On trunk links
int {trunk-int}
switchport mode trunk
switchport trunk native vlan 999- VLAN 1 is used for various management protocols, so offloading VLAN 1 from trunk links helps avoid any congestion in vlan 1
Access Port Best Practices (Revist)
- Should include descriptions and configs for
- BPDU Guard
- Root Guard
- Port Security
- limit mac addresses
- other stuff
- DHCP Snooping
- DAI
- IP source Guard (new to me)
- Storm Control (new to me)
- ACLs
- Disabling CDP and LLDP
- Disabling DTP
- VLAN that is unused and configured on unused and disabled access ports, so if they were enabled they traffic would still go nowhere
- No SVI or ip address range configured for this VLAN
- Best practice to also
- turn off trunk negotiation
- enable STP bpduguard to avoid rouge devices becoming root bridge
- Disable CDP
- Disable LLDP
vlan 998
name UNUSED-ACCESS-VLAN
!
! Unused access interfaces
int rage {unused-access-int-range}
switchport access vlan 998
switchport mode access
switchport nonegotiate
no lldp transmit
no lldp receive
no cdp enable
spanning-tree portfast edge
spanning-tree bpduguard enable
shutdownVLAN Hopping Description Attempt
Setting up a blackhole native vlan avoids the possibility of a vlan hopping attack. VLAN hopping is when a bad actor connects to an enabled access port in the default vlan, so basically an access port left in default state, then they send traffic tagged with native vlan header, and vlan header actually in use. This allows the traffic to be sent into the network because the port allows native vlan traffic, then when it hits a trunk link it’s sent in the vlan they are targeting.
This attack requires physical access to access switches, which hopefully are behind physical security, but sometimes business needs don’t allow access switches to be locked away.
I don’t know if this is an attack that is very common, and I’ve heard that it’s not a super big risk, but can be easily avoided by creating a blackhole native vlan
Blackhole native vlan is a vlan other than 1, what will not have an svi anywhere in the network, and traffic in this vlan will be sent to the bit bucket
null0interfaceVLAN that is unused and shutdown, configured as native vlan on trunk links to essentially disable native vlans, configured on unused disabled access ports, so if they were enabled traffic still can’t leave the port unless they are put in a used vlan
Service Password Encryption
Securing L2 Technologies
Notes from SCOR book Chapter 6
Choose an unused VLAN for native VLAN other than 1
Avoid using VLAN 1 anywhere
Statically configure access ports, so DTP is disabled
Use port security to limit number of MAC addresses learned on ports
STP - Use BPDU Guard and Root Guard
Turn of CDP on untrusted ports or anywhere it’s not a benefit
On new switches, shut down all ports and assign them to unused vlan (parking lot)
Basic device security
- enable passwords
- local username and passwords
- privilege levels
- console
- console login with local usernames
- console timeout
- logging synchronous
- ssh config
- crypto key
- vty line config
- login local
- using remote auth server?
- ssh versions
- blackhole native vlan?
- Unused Port Config
- Service password encryption
- Is this needed in a properly configured device?
- Might still be good in case your dealing with customers are brownfield?
- What level of security does this really offer vs re-configuring passwords the correct way
- What is the correct way vs using this?