Remote Lab Access and Control

A requirement I’ve quickly come to realize with building my lab is remote access into lab my equipment. This requirement is two fold, I don’t feel like always sitting in my basement to build topologies and I’m not always home when I will be studying. This need naturally led me to acquiring a terminal server, which was very helpful in fulfilling my first need of not having to always hang out in the basement when studying. I didn’t like the idea of always leaving my lab equipment on wasn’t exciting to me as I don’t like wasting electricity, so I found a Remote Power Control (RPC) unit also known as a switched PDU.

I enjoyed setting everything up so I figured I’d share the configuration steps I took to get two devices communicating with each other and functioning. The two devices I used were a Opengear IM7200 terminal server and a Avocent (Cyclades) PM10. The setup is pretty straightforward with minimal steps.

First you need to make sure the RPC unit is cable properly, for the PM10 a serial console connection is made of a UTP straight through cable from one of the serial ports on the Opengear terminal server to the “In” port on the PM10. You can daisy chain multiple PM10s together by going from the “out” port to the “in” port on the next PM10, but I recommend setting up each PM10 as an individual serial port on the terminal server. This gives more flexible control and you won’t lose multiple RPCs if you have a failure “up stream” in the daisy chain. After the cabling is taken care of its time to move on to the fun part, configuration!

The first configuration component is to configure the serial port on the IM7200 to the PM10. To do so navigate to the Serial Port configuration section: ynwxbpg

The next step is to configure the serial port connected to the PM10 by editing the port on the IM7200:um6g9qy

The following settings are specific to the PM10 connection and need to be configured on the serial port on the IM7200 for connectivity:rbf9hxzoihsmtcSettings include:

  • Label – Port name you would like
  • Baud Rate – 9600
  • Data Bits – 8
  • Parity – None
  • Stop bits – 1
  • Flow control – None
  • Port Pinout – Cisco Straight (X1)
  • Terminal Type – ansi

In addition to the required serial settings, the serial port must be set to a device type of “RPC” so that the terminal server knows how to handle the port:r8igm0v

Next navigate to the RPC configuration under Serial & Networks:mj3mucf

Next click on ” Add RPC”:ijx5dch

Next setup the RPC configuration on the IM7200 withe the following settings:dly8d0pSettings include:

  • Connected via – Serial Port previously configured
  • RPC Type – Cyclades PM10
  • Name – Whatever you would like to name it
  • Outlets (optional) – set it to 10 or leave it as default for auto-probing
  • Username / Password – Set to admin/password for PM10
  • Log Status – Enabled (Checked)
  • Log Rate – Setting you would like

The next step is to configure serial ports connected to console ports on the devices controlled by the RPC with the Power Menu enabled:twmrllo

The last step is to setup a Managed Device for each device to be controlled by the RPC, to do so navigate to “Managed Devices” under Serial & Networks:kawabbv

Click “Add Device”:fr3x9gy

Finally configure the device with a name, assigned console port, and assigned RPC port:f8ohwtg

After configuration the devices can be managed under devices:tlbf8dt

Or right from the console sessions via the terminal server:yla5om8

Happy labbing!

A short little time lapse I made…

I decided that I wanted to almost double the time it took to re-cable my CCIE Lab so I made a time lapse video out of it. I think it turned out pretty well!

 

 

The layout is pretty straight forward, I have a 2801 and 3560 as a “hub” which acts is a central place of connectivity for 5 other “pods” that consist of a 1841 and 3560. A diagram will follow I’m sure.

 

Enjoy 🙂

Cisco ISE REST API & Python

I’ve been faced with a fun little challenge on how to make sure our ISE deployment has every NAD (Network Access Device) configured appropriately to allow for successful EAP communications. Originally I was planning on utilizing a CSV and the bulk import tool to regularly import new devices into ISE as they were built. This allows for a number (small or large) of devices to be imported into ISE without taking too much time. This has worked well in the past but creates an reliance on making sure the CSV is proper and that someone (me) still has to manually login and import the file. With that I decided to look into other possibilities to remove the “me” from the process flow. At first I was looking into ways to automatically populate the CSV and then script out away to login to ISE and force the bulk import. While that option would work, it seemed to be too complicated to really deploy and rely on. I finally decided to give another whack at using the REST API ( I had previously tried years prior with ACS but did not have much luck).

There are a two things that need to be done on ISE prior to being able to utilize the REST API. The below screens and settings are based on ISE 2.2 but are similar between all recent releases of ISE:

  1. Create an account that will be utilized for the REST calls.  To do this navigate to: Administration > Admin Access > Administrators > Admin Users and click on “Add”:ialbmj4
    Currently there are two different access types you can assign: Read/Write or ReadOnly. For the code about to be run, we need Read/Write.
  2. Enable ERS (External RESTful Services) to allow REST calls. To do this navigate to: Administration > System > Settings > ERS Settings then select “Enable ERS for Read/Write” under the Primary Administration Node:fsdtf17
    This setting must be enabled after each upgrade as its set to disabled during the upgrade. If you plan to utilize the REST API, I recommend adding to your upgrade documentation / process that the REST API is enabled at the end of the upgrade.

After a user account is created and ERS is enabled the REST API can be utilized via HTTPS on port 9060. API documentation can be found at: https://ISE-PAN-IP:9060/ers/sdk

Now that the API is exposed its now for some fun! But first some cautions / warnings..

  1. This is by no means a tutorial about REST API or Python.
  2. You really should have a good understanding about REST API before enabling it. I’m still skeptical about the security around access when it comes to REST.
  3. You should never use a production system to develop code that makes changes to it.
  4. Use the code shown at your own risk!

And a few notes about the code…

  1. The below code is not complete, and needs tweaking to be functional. Its intention is simply to show a proof of concept for automating device creation.
  2. The code calls ‘nad.xml’ which is a separate XML file (can be found on my github repository). I will not be going over the file in this tutorial, but can be manipulated for actual use.
  3. The final output is not pretty and may not be complete depending on the number of devices being imported.
  4. The code below is a picture due to me not knowing how to easily paste code that looks nice on wordpress. A copy of the code can by found on my github repository.
  5. The IP address or FQDN of your ISE PAN needs to be updated prior to running the code.
  6. A proper authorization key needs to be added prior to running the code. This will be from the account you created earlier.
  7. It would be a good idea to create a variable for the ISE PAN information to use for multiple URLs.
  8. It would be a good idea to create a variable for the authorization information to use for multiple calls.

Now its really time for the fun part!

The below code is intended to do two things: Bulk create network devices in ISE and to verify the status of the bulk job:

kdtfnke

Code Breakdown:

  • Lines 2 – 8 are simply to deal with importing the XML file. You could just include it in the script and assign it to the payload variable (referenced in line 18) but that doesn’t make this usable in a production environment.
  • Line 11 is the URL used for the first API call. Don’t forget to update with your ISE PAN information.
  • Line 15 is where you should update your authorization information.
  • Line 18 has an extra variable in the request which is “verify” set to “False”. This lets you ignore certificate warnings. In my lab I didn’t bother deploying trusted certs so I needed this.
  • Line 18 is the actual API call being pushed. If you do not care about the status you could simply end here or just print the response.
  • Line 21 grabs just the location header from the response from the API call. The location header is a URL containing the BULK ID that is parsed from the entire URL to use for the second portion of the script.
  • Line 28 is the URL used for the second API call + the BULK ID. Don’t forget to update with your ISE PAN information.
  • Line 32 is where you should update your authorization information.
  • Line 36 has an extra variable in the request which is “verify” set to “False”. This lets you ignore certificate warnings. In my lab I didn’t bother deploying trusted certs so I needed this.

Lets see the code in action!

First we will look to see whats configured in ISE for network devices:9aczrfjNow lets run the script:hghklfn

As can be seen the XML containing 10 network devices was still in progress when the status check was run. If this was production code there are multiple options to avoid this such as a timer could be implemented, the user could be asked when to run the check, or constant checking until it completes.

Now lets see what we have in ISE:qghpxe9Ten brand new devices!

The API in Cisco ISE has many different functions that can allow for the creation, modification, or deletion of several different objects outside of network devices. This is just one example of the power that is available for automating functions within ISE that have been around for a while.

 

IKEv2 with RSA Signatures

Currently my studies have taken me on an adventure into the wonderful world of Cisco Security. I am studying for the 300-209 (SIMOS) certification exam which is VPN technologies including DMVPN, FlexVPN, and a few other flavors of VPN.I find it interesting that so many try very hard to avoid having to implement security because its hard, or because that’s not how they did it at their old job. In this post I am going to go over the simple process of adding RSA Signatures into a DMVPN phase 3 deployment.

 

Below is the high level topology I’ve been  using for my DMVPN labs:

DMVPNTopologyAs can been seen, its a single hub deployment with two spokes (one with two routers and the other with a single router). I am utilizing two separate tunnel types to allow for the addition of another hub (Datacenter) later on down the road. For this post, addressing doesn’t matter too much as I am only going over the parts that are required for RSA Signatures to work.

Lets start with the basics of what’s already in place:

  • NTP (Time) – All routers are already configured with NTP to have synchronized time. This is important for certificates as they have Valid From and Valid To fields that are enforced.
  • DMVPN Phase 3 with Pre-Shared Keys (PSKs)
    • This includes all parts from IKEv2 Policies, all the way to tunnel protection being configured. Maybe another time I’ll go over my lab but there’s a good amount of posts about DMVPN already so not sure it’s really worth while.
  • Routing
    • Both on the FVRF (Front Door VRF) and Internal VRF
  • PKI Infrastructure
    • I setup a single Signing CA for my lab environment with auto enrollment to allow for easy certificate signing on my routers.

Now that what’s in place has been gone over, lets see if things actually working.

dmvpn1

As can be seen, from DMVPNR2 (which is the DMVPN hub for the second tunnel), both remote locations are currently using PSKs and sessions are in a healthy state.

And now the fun part,  actually authenticating the CA, getting a signed RSA signature, and utilizing it with the current DMVPN configuration! As note, any configurations done on a device will be in italics, and any variable that can be changed will be in red like the following: hostname Branch2-R1

1.Generate a RSA keypair for your router:
crypto key generate rsa modulus 2048 label Branch2-R1.dmpvn.com

2.Configure the CA trustpoint:
crypto pki trustpoint TrustedCA
    enrollment url http://10.0.0.6
    rsakeypair Branch2-R1.dmpvn.com
    fqdn Branch2-R1.dmpvn.com
    subject-name CN=Branch2-R1,O=dmpvn.com
    revocation-check crl none

3. Authenticate CA
crypto pki authenticate TrustedCACA Authenticate.jpg

4.Enroll with the CA
crypto pki enroll TrustedCA

CA Enroll

The following fields will need to be filled out:

  • Password – This is needed to revoke the certificate
  • The option to include the Serial number in the subject name (Yes or No)
  • The option to include IP address in the subject name (Yes or No)
    • If yes – it must be configured
  • Accept the request to a certificate from CA (Yes or No)

The certificate request process runs in the background and syslogs are shown when the certificate is received from the CA. The command show crypto pki certificate verbose TrustedCA can be utilized to view the certificate fingerprints for the configured CA.

5. Create a certificate map
crypto pki certificate map CMAP 10
    issuer-name co CA
For my lab environment, I simply created a certificate map that looks for the word “CA” in the issure-name field of the certificate. This can be a very specific variable to allow for strict control over what exactly is allowed for authentication.

6. Create / Modify IKEv2 profile for RSA Signature based authentication
crypto ikev2 profile FVRF-IKEv2
    identity local dn
    match certificate CMAP
    authentication local rsa-sig
    authentication remote rsa-sig
    pki trustpoint TrustedCA

It’s important to make sure you add the authentication local and remote commands for rsa-sig, without them PSKs will still be used! In addition, if the profile is being reused and had the configuration for PSKs, the command for PSKs is NOT overwritten when the rsa-sig command is issued and need to be removed with the “no authentication remote pre-share” if it is no longer desired to utilize PSKs for IKEv2 SAs.

 

And that’s it! Any new SA for DMVPN IPSEC tunnels will be created utilizing RSA. Now, the way Cisco IOS maintains security SAs, they will be active with their negotiated security settings until the SA is renegotiated (if supported) or torn down. This means the old sessions (if RSA was added to an already configured deployment) will have been setup with PSKs. The easiest way to “refresh” these SA’s is to flap the tunnel. Extreme caution should be used when pushing changes to production environments, and as always test in your lab first!

Hiding (filtering) a specific user from reporting in Cisco ISE

I ran into an interesting problem preparing for an 802.1x deployment – the authentications report in Cisco ISE was full of all the network devices checking to make sure ISE was still available (health checks). As seen below the load balancer’s keep alive fill the logs pretty much on their own, imagine trying to troubleshoot a login issue!1 YUCK!

Something else I found interesting that my Google Foo (or knowledge of ACS and how to filter out a certain user) was no match for trying to find a solution for my issue. Because of this, I decided a quick how-to on this would be helpful (I can’t be the only person who will want to filter out such an annoying problem).

First Navigate to Administration > System > Logging:2

Once in the System Settings for Logging, navigate to “Collection Filters”:3

At this point, the rest is pretty straight forward. But for completeness I am going to finish the whole process, so click “Add”:4

After that just fill in the type of attribute you want to filter (Username, Policy Set Name, NAS IP Address, Device IP Address, or MAC Address), the Value for the selected attribute, and the Filter Type (Filter All, Filter Passed, FIlter Failed, or Bypass Suppression [with time limit]). Finally, click “Submit”!

5

For me, it made the most sense to filter the username used for the monitors, and to only filter on passes for that username. This allows me to use the least amount of filters, and if a health monitor fails for any reason will show up in the reporting still.

Final result (don’t mind the old logs, I was too impatient to wait for them to clear):

6

Happy troubleshooting!

Attacking HSRP and how to protect it

I covered HSRP (Hot Standby Router Protocol) in a previous post that went into great detail on how HSRP functioned and a few enhancements to it. This time around I figured it would be fun to see what we could do to a typical HSRP deployment, and then research ways to further protect it.

For this scenario the following topology will be used:

Diagram1

. The topology includes a basic HSRP configuration between two routers (R01 and R02), a basic layer 2 switch (sw1) and a webserver sitting on the “Internet”. For verification purposes, the active HSRP router is checked:  12

With the verification completed its now time to start the reconnaissance. For this Kali Linux was used along with a hand full of tools running on it. This post is not intended to explain how to use the tools and will not go over them, a simple Google search will give you all the information you need for that…

A quick wireshark trace shows there is in fact HSRP traffic flowing on the subnet:Screenshot from 2015-07-19 09_37_13

The attack is launched and a new HSRP takes over as active:

Screenshot from 2015-07-19 09_41_253

Executing the attack alone is enough to cause a DDoS event for that subnet. All traffic is routed to the rouge Active HSRP “router” and if it is not setup properly will cause all traffic destined for an outside subnet to be dropped:4

For some a DDoS is the end goal of the attack, but that’s not as fun as being able to be in the middle of the traffic without users even knowing. For the MITM to be successful a few things needed to be configured on the kali Linux device in order to get traffic flowing properly. Once setup traffic was able to leave the subnet:

5

Now that the attacker is in the middle of all traffic leaving the subnet, it is possible to sniff any traffic going through with wireshark. If anything is sent in clear text (unencrypted) the attacker is able to see it in wireshark including login information:Screenshot from 2015-07-19 10_05_10

The easiest way to add a layer of protection onto HSRP is to utilize MD5 authentication. This can be accomplished through key chains, key strings, or a mixture of the two. The configuration to use a key string is very straight forward. On all routers participating in HSRP for that group add the single command line: standby [HSRP group #] authentication text  [Authentication String]. Once configured, all devices will use the string to hash message data. If a router attempts to join the HSRP group with a incorrect key the following warning is seen:

6

SNMP traps can be setup so that an alert is sent immediately if the bad authentication is seen allowing for network staff to investigate the issue.

To homelab or not to homelab….? That is a question.. (Part 2) – Diagrams

In my previous post in this series I went over the gradual growth of my lab from just being on my desk to having its very own 42u network rack. Since then, my lab has grown and changed. Previously I was using the virtual switch right on my esxi hosts (which were 5.1), along with having separate local storage and managing them individually.

Today my virtual environment is managed by vCenter, has centralized storage, runs ESXi 5.5, and utilizes Cisco Nexus 1000v for distributed switching. I plan to do another post eventually on my centralized storage setup running FreeNAS so I won’t be talking directly about it too much. Instead, through building out my virtualized environment I realized that I don’t actually have any diagrams for my home network / lab.

The first diagram I started to work on is for my “server” environment. This includes my storage servers as well as my ESXi hosts and the guests running on the guests. It took a bit of time to figure out a good way to represent how the VMS are connected to the network but I think I found a good way of doing it.

Servers

Going through the diagram:

  • ESXi-1 (C1100)
    • 72 GB ECCRAM
    • iSCSI LUN
    • Dual connected IP and iSCSI connectivity
    • 25 Configured VMs
      • 11 Active
  • ESXi-2 (C1100)
    • 72 GB ECC RAM
    • iSCSI LUN
    • Dual connected IP and iSCSI connectivity
    • 29 Configured VMs
      • 11 Active
  • unRAID (WhiteBox)
    • 8GB RAM
    • Single DataStore (1 Disk Parity) [ 22TB]
    • Dual connected IP connectivity
  • FreeNAS (C2100)
    • 24GB ECC RAM
    • Single DataStore (1 Disk Parity) [ 22TB]
    • Dual connected IP connectivity
    • Quad connected iSCSI connectivity
    • Dual PSU
  • Access Switch
    • WS-C2960S-48LPS-L
  • Other
    • APC BR1500G (1500VA/865W)
    • APC BR24BPG (additional four 9Ah batteries for UPS)

 

Next steps will be to add the rest of the equipment, and my CCIE Lab. Can’t forget about that 🙂