<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Automation on 0x2142 | Networking Nonsense</title>
    <link>https://0x2142.com/tags/automation/</link>
    <description>Recent content in Automation on 0x2142 | Networking Nonsense</description>
    <image>
      <title>0x2142 | Networking Nonsense</title>
      <url>https://0x2142.com/logo.jpg</url>
      <link>https://0x2142.com/logo.jpg</link>
    </image>
    <generator>Hugo -- 0.143.1</generator>
    <language>en-us</language>
    <lastBuildDate>Sat, 13 Apr 2019 12:59:00 +0000</lastBuildDate>
    <atom:link href="https://0x2142.com/tags/automation/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Getting Started with Cisco NFVIS</title>
      <link>https://0x2142.com/getting-started-with-cisco-nfvis/</link>
      <pubDate>Sat, 13 Apr 2019 12:59:00 +0000</pubDate>
      <guid>https://0x2142.com/getting-started-with-cisco-nfvis/</guid>
      <description>A quick look at how to spin up NFVIS on a Cisco ENCS</description>
      <content:encoded><![CDATA[<p>A few weeks ago I got my hands on a Cisco UCS C220 M4 server - which I&rsquo;ve set up in a lab to install and test Cisco&rsquo;s Network Function Virtualization Infrastructure Software (NFVIS). I really wanted to get this running on an Enterprise Network Compute System (ENCS) box, but you can&rsquo;t always get everything what you want :). The UCS machine is also on the list of supported platforms, so we&rsquo;ll use that - but everything here should apply similarly to the ENCS platform.</p>
<h2 id="what-is-nfvis">What is NFVIS?</h2>
<p>NFVIS is an operating system developed by Cisco which is intended to be deployed at branch office locations - and allow for quick deployment of network services in lightweight VMs. For example, we might want to reduce cost and hardware footprint by deploying a single ENCS machine, then deploy our typical branch services on top of that (DNS, Firewalls, SDWAN, etc). Under the hood, NFVIS is built on top of CentOS and KVM.</p>
<p>In the image below, we have an ENCS unit that is running ISRv, FTDv, and a vEdge Cloud. NFVIS has the ability to build out traffic flows for service chaining. In this particular setup, we could have all branch traffic receive a default route up to our ISRv. The ISRv forwards traffic to a Firepower VM (FTDv) which performs some traffic inspection before passing everything up to the vEdge Cloud.</p>
<p><img alt="image" loading="lazy" src="/content/images/2019/03/image.png#center"></p>
<p>We&rsquo;ll be coming back to this diagram later to see how we can build out this flow of services. For now, let&rsquo;s dive into how we can get NFVIS up and running.</p>
<h2 id="installing-nfvis">Installing NFVIS</h2>
<p>Lucky for us - the installation of NFVIS is fairly straightforward!</p>
<ol>
<li>Create a bootable USB - or mount the installation ISO via CIMC</li>
<li>Upon boot, select &ldquo;Install Cisco NFV Infrastructure Software&rdquo;:</li>
</ol>
<p><img alt="image" loading="lazy" src="/content/images/2019/03/000-install.png#center"></p>
<ol start="3">
<li>Wait. A while. Install time can vary depending on your hardware.</li>
<li>Once completed, log into the CLI: Default login = admin/Admin123#</li>
<li>You&rsquo;ll be prompted to change the default admin password immediately:</li>
</ol>
<p><img alt="image" loading="lazy" src="/content/images/2019/03/image-1.png#center"></p>
<p>Install completed! Now let&rsquo;s look at some of our base configuration..</p>
<h2 id="initial-configuration">Initial Configuration</h2>
<p>By default the NFVIS install will have a LAN and WAN bridge (lan-br and wan-br, respectively). The LAN config will be set up with a static IP of 192.168.1.1/24, and the WAN will be set for DHCP. We can check the current network settings by running the <em>show system settings</em>command:</p>
<p><img alt="image" loading="lazy" src="/content/images/2019/03/image-2.png#center"></p>
<p>In this case, my WAN interface is able to get an IP via DHCP. We&rsquo;re likely going to want to change this to a static IP address - which we can do from the CLI or web interface. Let&rsquo;s start by trying this from the CLI:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">config t
</span></span><span class="line"><span class="cl">system settings wan ip address &lt;ip addr&gt; &lt;netmask&gt;
</span></span><span class="line"><span class="cl">system settings default-gw &lt;gateway addr&gt;
</span></span><span class="line"><span class="cl">system settings hostname &lt;hostname&gt;
</span></span></code></pre></div><p>Changes can then be applied using the <strong>commit</strong> command</p>
<p><img alt="image" loading="lazy" src="/content/images/2019/03/image-3.png#center"></p>
<p>We can verify these settings by repeating the <code>show system settings</code> command we used earlier.</p>
<p>Let&rsquo;s go ahead and log into the web interface to see what the network configuration looks like there:</p>
<ol>
<li>If we know our WAN or LAN IP from earlier, we can just pop that in our web browser.</li>
<li>Go ahead and log in using the new admin credentials we just created:</li>
</ol>
<p><img alt="image" loading="lazy" src="/content/images/2019/03/image-4.png#center"></p>
<ol start="3">
<li>We&rsquo;ll be taken to the primary NFVIS dashboard, which will currently show no active VMs deployed:</li>
</ol>
<p><img alt="image" loading="lazy" src="/content/images/2019/03/image-5.png#center"></p>
<ol start="4">
<li>In the left-hand menu, expand <strong>Host</strong>then click on <strong>Settings:</strong></li>
</ol>
<p><img alt="image" loading="lazy" src="/content/images/2019/03/image-6.png#center"></p>
<p>Here we can see that we already configured our IP Addressing/hostname - but we could use the <strong>Edit</strong> button at the bottom to change any of these values. For example - I&rsquo;m going to go ahead and select <strong>Static</strong> for both the Management (LAN) and WAN IP addresses.</p>
<p>Another quick tip - if we need to modify which physical network adapters are tied to an internal network bridge, we can find that under <strong>VM Life Cycle &gt; Networking:</strong></p>
<p><img alt="image" loading="lazy" src="/content/images/2019/03/image-7.png#center"></p>
<hr>
<p>That&rsquo;s all for this time. In the next post, we&rsquo;ll take a look at how to package VM images and deploy our service chain.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Where is all the Automation?</title>
      <link>https://0x2142.com/where-is-all-the-automation/</link>
      <pubDate>Tue, 24 Jul 2018 10:00:03 +0000</pubDate>
      <guid>https://0x2142.com/where-is-all-the-automation/</guid>
      <description>Learning Python for network automation doesn&amp;rsquo;t have to be scary. Let&amp;rsquo;s look at how to get started</description>
      <content:encoded><![CDATA[<p><sup><em>Note: I may receive commissions for purchases made through links in this post. This is to help support my blog and does not have any impact on my recommendations.</em></sup></p>
<hr>
<p><em>The future is APIs! SD-EVERYTHING! Automation! Orchestration! Artificial Intelligence and Machine Learning!</em>
Sound familiar? It&rsquo;s all part of the messaging going around in just about everything IT-related. With as much as you keep hearing about it, you might think that it&rsquo;s all anyone is doing anymore. Yet it still just seems like not a whole lot of people are really getting into it in my area. Every vendor event I&rsquo;ve gone to this year has asked attendees the same questions: &ldquo;How many of you are leveraging the APIs in your network hardware/software?&rdquo;. And every time the same answer - maybe two or three people in a room of 40 raise their hands.</p>
<p>So where is the problem? Is all of this just marketing fluff or am I just talking to the wrong people?</p>
<p>Let&rsquo;s think about this from a typical network admin&rsquo;s perspective. Shifting from traditional CLI to automation and APIs can seem difficult or overwhelming. Let&rsquo;s say I want to automate a new VLAN deployment. <em>Oh, you&rsquo;re telling me I need to stop and learn vendor APIs… but before that I need to understand how to write scripts. But I&rsquo;ve never even programmed something before. There are dozens of languages - how do I pick one? How much fundamental programming knowledge do I really need to have before starting? I don&rsquo;t want to be a developer!</em></p>
<p>Okay, okay - just stop there for a second. No one is asking you to drop networking and write code for a living. The end goal of all this programmability stuff isn&rsquo;t to turn networkers into developers - It&rsquo;s to enable network/systems admins to be more efficient at their jobs. Why  copy/paste the same config change to 100+ devices, if you can mass-deploy the change via an API? That&rsquo;s a lot of time savings that could be used toward educating yourself on new products, planning other projects, or thinking about your ideal network design.</p>
<p>I&rsquo;ve heard a lot of the same things over the past few years:</p>
<blockquote>
<p><em>&ldquo;Programming is difficult&rdquo; or &ldquo;I don&rsquo;t know where to start&rdquo;</em></p></blockquote>
<p>Try learning Python. It&rsquo;s simple to get started and you can build from there.</p>
<blockquote>
<p><em>&ldquo;I don&rsquo;t know what an API is or how to use it&rdquo;</em></p></blockquote>
<p>Don&rsquo;t worry about that yet - start with learning the basics and APIs will make sense later.</p>
<blockquote>
<p><em>&ldquo;I&rsquo;m not a developer&rdquo;</em></p></blockquote>
<p>No one is asking you to be one! But learning the basics of scripting and automation gives you a whole new toolset to solve problems.</p>
<p>For me personally - I would never want to be a developer. I can&rsquo;t stand the thought of coming into work every day and just writing code. Some people might enjoy that, but for me it doesn&rsquo;t sound like fun. However - I enjoy writing scripts to solve problems, especially when it ends up making my job easier. I think that&rsquo;s the part where some people tend to get stuck though. A lot of automation sounds like I need to be able to develop a huge 10,000+ line application to pull data from 15 sources and aggregate it to make intelligent network changes. Ehhh&hellip; Nope, not really. But what about just a quick script that runs every 5 minutes to check an interface statistic, and email you when a particular threshold is exceeded? Realistically that could be done in less than 50-100 lines of a script and maybe 30 minutes worth of work.</p>
<p>Still not interested? That&rsquo;s okay too. Traditional networking isn&rsquo;t going away any time soon, and over time the vendors will write all of that automation for you. They will package it up in a pretty GUI and sell it off to companies that want it. In fact, this has already happening and has been for quite some time. This isn&rsquo;t a bad thing - vendors need to make money, and not all companies will have the time or skilled resources to automate all the things. However, a network admin who can write their own scripts/automation won&rsquo;t be exclusively tied to a vendor to help them - and instead they will be empowered to solve more problems themselves.</p>
<p>Where do you get started? I already wrote a bit earlier this year on a few resources for learning Python - which you can find <a href="/you-should-automate-something-this-year/">here</a>. I also wanted to point out some other great resources that are a bit more specific to using those skills for network automation:</p>
<ul>
<li>
<p><a href="https://pynet.twb-tech.com/email-signup.html">Python For Network Engineers</a> - Don&rsquo;t know anything about Python yet? Start here! This is a free course provided by Kirk Byers for anyone who is interested in using Python for network automation. Once a week you&rsquo;ll get an email with all the great free content, but it will be up to you to spend time going through it. Go sign up, and set aside an hour or two each week to practice.</p>
</li>
<li>
<p><a href="https://developer.cisco.com">Cisco DevNet</a> - There is a ton of great content here. While DevNet does offer some tutorials on basic Python fundamentals,  the real value here is examples on how to use some network APIs (NX-OS, Meraki, UCS, etc). Also - one of the best parts about DevNet is the sandboxes they offer. Want to write scripts against the FirePower Management Center, but you don&rsquo;t have one to test with? Well with DevNet you can get access to one!  Get familiar with your Python basics, then come here to see where you can start using those skills with your existing infrastructure.</p>
</li>
<li>
<p><a href="https://amzn.to/2L7EiL1">Network Programmability and Automation</a> - This is a fantastic book. Not free, but it is well worth the ~$30. Once you have a good handle on how to write some basic network automation with Python, I highly recommend picking this up. While Python is covered here, the book does a great job of introducing you to all of the other toolsets available. Curious about how Linux or Ansible fit into network automation? You can find out here - and learn about APIs and source control systems too!</p>
</li>
</ul>
<hr>
<p>So - What are you waiting for? Go get started, and see what you can accomplish. Learn the basics - and keep an open mind for opportunities to use those skills.</p>
<p>Have suggestions on where else to learn? Comment below!</p>
]]></content:encoded>
    </item>
    <item>
      <title>Automated F5 Backups with CatTools</title>
      <link>https://0x2142.com/automated-f5-backups-with-cattools/</link>
      <pubDate>Tue, 27 Mar 2018 11:00:22 +0000</pubDate>
      <guid>https://0x2142.com/automated-f5-backups-with-cattools/</guid>
      <description>How to configure SolarWinds Kiwi CatTools to monitor &amp;amp; back up F5 load balancer configurations</description>
      <content:encoded><![CDATA[<p>We have some new F5 load balancers in our environment, which means I need a method of grabbing regular configuration backups. There are a number of methods out there, but I&rsquo;ve opted to use SolarWind&rsquo;s CatTools software since we already own it.</p>
<p>The config I used is based on <a href="https://lessonsintech.wordpress.com/2017/06/15/automate-f5-backups">this blog post</a>. It&rsquo;s a great write-up on how to back up F5 configurations using CatTools. I don&rsquo;t want to replicate what was written over there - but I did hit some issues that were specific to my use-case that I wanted to share.</p>
<p>While I was happy to find the article linked above, the immediate results didn&rsquo;t work so smooth for me. This may be due to some key configuration differences that I face in my network:</p>
<ul>
<li>All the F5&rsquo;s are LDAP integrated - so there isn&rsquo;t an easy way to provide LDAP users with direct bash access</li></li>
<li>All of my F5&rsquo;s are remote appliances, where the backup configuration is being copied across the WAN</li></li>
</ul>
<p>Getting around the first problem was my biggest challenge. CatTools is a very command/response-oriented application. Any remote LDAP authenticated users are immediately dropped into F5&rsquo;s shell: <strong>tmsh</strong>. To get from there to their &lsquo;advanced shell&rsquo; is as simple as typing <strong>bash</strong>. However, When the terminal prompt changes, it often throws CatTools into a state of &ldquo;I didn&rsquo;t receive the response prompt I expected, therefore kill the job - something went wrong&rdquo;. I spent a bit more time on this than I wanted to - but the underlying problem was that the &ldquo;<strong>F5.BigIP</strong>&rdquo; device type was specifically looking for the tmsh shell and couldn&rsquo;t handle the prompt change. The fix? Switch the device type to &ldquo;<strong>Linux.RedHat.Bash</strong>&rdquo;, then add the <strong>bash</strong> command to the first line of your backup script.</p>
<p>The next problem was using TFTP to copy the backup archives over the WAN. Even some of the new F5&rsquo;s with minimal configuration still generate a 10Mb file. Doesn&rsquo;t seem like much, but when you&rsquo;re copying that over a WAN between two datacenters, that turns into a ~5 minute file transfer. CatTools by default will only wait 30 seconds after executing a command before it expects a response. So every time I tried to run the job, CatTools would kill it only 30-seconds into the file transfer. Luckily enough, they support a utility command that can alter the normal timeout:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">%ctUM: Timeout <span class="m">600</span>
</span></span><span class="line"><span class="cl">tftp -m binary 192.168.1.10 -c put <span class="nv">$filename</span>
</span></span><span class="line"><span class="cl">%ctUM: Timeout <span class="m">0</span>
</span></span></code></pre></div><p>The command <code>%ctUM: Timeout 600</code> changes the timeout value to 600 seconds, or 10 minutes. The TFTP file transfer command is next, which is now permitted up to 10 minutes to finish. The last command resets the timeout back to the default (30 seconds).</p>
<p>I also realized that the original script doesn&rsquo;t purge the backup archive afterwards. For my use case, I would much rather automatically clean up the backup files once they&rsquo;ve been transferred to a central location.</p>
<p>So after all that, here is the version of that script that I&rsquo;m using:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">export</span> <span class="nv">date</span><span class="o">=</span><span class="sb">`</span>date +<span class="s2">&#34;%y%m%d&#34;</span>​<span class="sb">`</span>
</span></span><span class="line"><span class="cl"><span class="nb">export</span> <span class="nv">filename</span><span class="o">=</span><span class="nv">$HOSTNAME</span>.<span class="nv">$date</span>.ucs
</span></span><span class="line"><span class="cl">tmsh save /sys ucs /var/local/ucs/<span class="nv">$filename</span>
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> /var/local/ucs
</span></span><span class="line"><span class="cl">%ctUM: Timeout <span class="m">600</span>
</span></span><span class="line"><span class="cl">tftp -m binary 192.168.1.10 -c put <span class="nv">$filename</span>
</span></span><span class="line"><span class="cl">%ctUM: Timeout <span class="m">0</span>
</span></span><span class="line"><span class="cl">rm -f <span class="nv">$filename</span>
</span></span></code></pre></div><hr>
<p>Thanks again to the <a href="https://lessonsintech.wordpress.com/2017/06/15/automate-f5-backups">original blog post</a> for getting me on the right track with this! I hope that my ramblings here are helpful to anyone with a similar deployment scenario.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Thoughts on Cisco&#39;s 2018 Annual CyberSecurity Report</title>
      <link>https://0x2142.com/thoughts-on-ciscos-2018-annual-cybersecurity-report/</link>
      <pubDate>Wed, 21 Feb 2018 09:00:58 +0000</pubDate>
      <guid>https://0x2142.com/thoughts-on-ciscos-2018-annual-cybersecurity-report/</guid>
      <description>My thoughts on Cisco&amp;rsquo;s Annual CyberSecurity Report</description>
      <content:encoded><![CDATA[<p>When I started in networking, I never would have thought that security would be such an important part of my job. However, it has become something that I&rsquo;m involved with almost every day - tasks like applying security configurations, participating in audits, or spending a day chasing down the latest vulnerabilities. It&rsquo;s already become second nature to watch for what&rsquo;s new in the security realm, so that I&rsquo;ll be more prepared when someone asks about it.</p>
<p>Earlier today, Cisco released their <a href="https://www.cisco.com/c/en/us/products/security/security-reports.html">2018 Annual Cyber Security Report</a>. I&rsquo;ve spent some time digging through the report and thinking about what they&rsquo;ve written. It&rsquo;s interesting to read through the trends and survey results, and try to get an idea of where security efforts should be focused for the coming year.
This post is going to cover just a subset of what&rsquo;s in the complete report. I&rsquo;ll be covering the topics that I found particularly interesting, and give my own thoughts/views on them.</p>
<h2 id="the-encrypted-web-is-great-for-attackers">The Encrypted Web is Great&hellip; For Attackers</h2>
<p>Unsurprisingly, Cisco reports a growing trend in attacks and exploits that are taking advantage of encrypted transport. As a lot of large companies and Internet bodies are pushing for a 100% encrypted web, should we be surprised? Nah, it&rsquo;s the logical next step. Users want encryption because it means privacy - but that privacy also brings a method of concealing attacks.</p>
<p><img alt="image" loading="lazy" src="/content/images/2018/02/figure-1-volume-of-encrypted-traffic.png#center"></p>
<p>New exploits and malware are heavily leveraging encrypted transport to bypass all of the security we put in place to detect them. Typical defense technologies like intrusion prevention systems (IPS) are fantastic, but only when they can actually <em>read</em> the data. If a user download&rsquo;s malware through an HTTPS call, IPS won&rsquo;t usually catch it. And when that malware can now take advantage of SSL to reach back out to a command &amp; control server? Yeah, IPS might not help us there either.</p>
<p>There are technologies out there that allow enterprises to see this traffic - but maybe not enough of us are adopting it yet. A forward proxy for outbound web filtering is great. One that implements SSL decryption and inspection is even better. If your company isn&rsquo;t already decrypting outbound web traffic, then this needs to be a priority.</p>
<p>Inbound web traffic can be just as dangerous. New IIS vulnerability? Sure, let&rsquo;s grab the latest IPS signatures and &hellip; Oh wait, our IPS runs on our edge firewall, which sits in front of those web servers - which are all using SSL for encryption. That means any malicious traffic is going to slide right through our IPS undetected and land on our unpatched web servers. Get a Web Application Firewall (WAF), and let it front-end your SSL traffic. These things can be expensive and a nightmare to configure and tune properly, but right now they are one of your best options for inspecting web traffic.</p>
<h2 id="old-attacks-arent-going-away---theyre-just-getting-an-upgrade">Old Attacks Aren&rsquo;t Going Away - They&rsquo;re Just Getting an Upgrade</h2>
<p>This year&rsquo;s report highlighted that much of the older attacks are still here, and they&rsquo;re not giving up yet. Attacks via email are still present and doing more damage than you would hope. We&rsquo;re certainly getting better about implementing spam filters with reputation filtering, but attackers aren&rsquo;t giving up yet.</p>
<p>Email attacks are relying more on social engineering and targeted phishing. These messages are also utilizing SSL to encrypt the malicious links within the emails. Infected attachments are surprisingly still a big issue, with Microsoft Office and PDF files still being the worst offenders.
Just because attackers are finding new and exciting ways to hit us doesn&rsquo;t mean they&rsquo;re giving up on the tried and true methods. We still need to focus on all the standard attack vectors, like email. Implementing intelligent email/spam filters and providing user awareness training are the primary methods we have to combat this.</p>
<h2 id="the-cloud-is-secure-we-think">The Cloud is Secure! &hellip;We Think</h2>
<p>This one I found particularly fun. Out of all the companies surveyed by Cisco for this report, 57% of them said they believe the cloud offers better security. Wait - Did I misread that? More than <em>half</em>of respondents think that the cloud offers better security than their own infrastructure! This makes me wonder&hellip;</p>
<p><img alt="image" loading="lazy" src="/content/images/2018/02/figure-27-cloud-offers-security.png#center"></p>
<p>From my perspective, a cloud service provider is just another company. In most cases, they run just another network and hit a lot of the same challenges that non-cloud companies are facing. And we can only assume that cloud providers are prioritizing security and not just trying to turn a quick profit. Cloud companies have the advantage of being able to hire a dedicated security team that their customers can leverage. However, enterprises are complaining about lack of skilled security engineers, and I&rsquo;ll bet it&rsquo;s not because cloud providers are picking them all up.</p>
<p>Cloud definitely offers benefits - but this needs to be a well-calculated risk. For a smaller company without dedicated IT staff, a cloud solution would most likely offer security improvements over their own infrastructure. As companies scale, however, their security requirements do too. We need to make sure that the cloud providers we choose are also capable of adhering to those standards. Before you move to the cloud: ask questions about their security practices, get answers, and demand more information on the parts that are important to your business.</p>
<p>Another fun note from Cisco - some of the damage done by cloud providers is a simple mis-understanding of ownership. If you subscribe to a complete Software as a Service (SaaS) provider, chances are good that the provider worries about all of the critical security configurations. However, if you&rsquo;re going to a cloud provider just for infrastructure (like AWS), then you are likely responsible. In the case of AWS, you&rsquo;re being provided a server - and that&rsquo;s where Amazon&rsquo;s responsibilities end. It&rsquo;s up to the enterprise to still make sure that those servers are patched, hardened, and audited. Treat the cloud as an extension of your own infrastructure and polices, not a separate entity.</p>
<h2 id="diversifying-risks-maybe-not">Diversifying Risks? Maybe not</h2>
<p>It used to be a somewhat well-established security practice to use multiple vendors. Have a need for two sets of firewalls? Make sure you use two vendors, so that a vulnerability in one doesn&rsquo;t affect the other. Seems like sounds logic - until you have to train staff to be experts on multiple platforms, and keep up to date on all the latest patches from each vendor.</p>
<p>Cisco is finding that the more vendors a company has in their environment, the more problem we have maintaining everything. From my own experiences, I can say this is certainly a problem. In environments where I&rsquo;ve had up to four vendors for firewalls and switching, it becomes difficult to work with. It&rsquo;s hard on IT staff to maintain knowledge of configuration and best practices for each different vendor - and when a new vulnerability comes out, we end up spending way more time trying to track down each vendor&rsquo;s responses and patches.</p>
<p>It makes sense that companies who have a more tightly integrated infrastructure might have an easier time managing it. Cisco might want you to buy 100% into their ecosystem (of course), but I do think there is value in consolidating your infrastructure. One or two vendors will be much easier to establish relationships with than half a dozen of them. Your IT staff can dedicate their focus to mastering only a couple of technologies, rather than spreading themselves over a dozen different platforms. And when that new vulnerability is released? It should be much more straightforward to patch all of your systems quickly.</p>
<h2 id="theres-that-automation-thing-again">There&rsquo;s That Automation Thing Again</h2>
<p>I think we&rsquo;re finally beginning to reach a point where automation is really showing it&rsquo;s value in the security realm. A typical company is going to have so many different systems and alerts that it doesn&rsquo;t make sense for someone to manually review and act upon every one. This is where automation really begins to shine.</p>
<p>Cisco&rsquo;s report shows that more companies are relying heavily on automation. This can be used for alert response, reporting, and behavioral analytics. Especially when I keep hearing that there is a skills shortage in security, we need to take advantage of what automation can offer. This doesn&rsquo;t always have to be home-grown scripts either - there are a number of offerings already available.</p>
<p>Take a <a href="/you-should-automate-something-this-year/">second look</a> this year. Try to see where automation can fit into your infrastructure to help improve both operations and security.</p>
<hr>
<p>Thanks for reading! Just as a friendly reminder - All of the opinions stated in this post (and all others here) are 100% my own, and do not represent any vendor or employer. Since security has become more of an important part of my job, reports like this are always very interesting to read. I&rsquo;ve only covered a handful of what was in the report - just what was particularly interesting to me. If you&rsquo;re interested in reading more, check out the full report <a href="https://www.cisco.com/c/en/us/products/security/security-reports.html">here</a>.</p>
]]></content:encoded>
    </item>
    <item>
      <title>You Should Automate Something This Year</title>
      <link>https://0x2142.com/you-should-automate-something-this-year/</link>
      <pubDate>Tue, 09 Jan 2018 08:00:06 +0000</pubDate>
      <guid>https://0x2142.com/you-should-automate-something-this-year/</guid>
      <description>Need a push to start learning network automation?</description>
      <content:encoded><![CDATA[<p>Maybe 2018 isn&rsquo;t off to quite the best start. Recent processor vulnerabilities have people scrambling to patch and update systems. Stuff like this ends up being a fairly large sink of time for any systems/network administrator. The worst part is that we have practically no control of when this stuff happens or how much time it&rsquo;s going to take to resolve. What we <em>do</em>have control over, however, is our ability to make our own lives easier through automation.</p>
<p>A lot of people take the beginning of the year to make new resolutions and goals for the coming months. So this year, I&rsquo;m urging you to add one more to your list: Try and automate something that will make your life easier.</p>
<h2 id="where-to-start">Where to Start</h2>
<p>What you choose to automate doesn&rsquo;t need to be extremely complex or elaborate, just anything that will save you a little bit of time. Never used a scripting language? I can&rsquo;t recommend enough using <a href="https://learnpythonthehardway.org/book/">Learn Python The Hard Way</a> to start learning. This site is what I used about five years ago to get into scripting. Another great resource is <a href="https://www.codecademy.com/catalog/language/python">CodeAcademy</a>, where they have web-based interactive tutorials (also check out their specific module on <a href="https://www.codecademy.com/ru/courses/python-intermediate-en-6zbLp/0/1?curriculum_id=50ecb8cb058fd2ebda00003b">Python and APIs</a>).</p>
<p>Once you get a good handle on the basics, start thinking about repeatable tasks that are great candidates for automation. Start with something simple - maybe a script that prompts the user for information, then generates the command-line entries to configure new switch ports. Then someone can easily copy and paste the commands from the script output to achieve their desired configuration. Something like this might not immediately seem like a huge time savings, but it gives you a place to start and get familiar with what is possible. Once you get something like that working, it&rsquo;s not too difficult to extend the script later and actually include calls to the switch APIs to automate the changes.</p>
<p>Is Python/scripting your only option? Not at all. There are also automation toolsets like Ansible, which can abstract the code layer a bit. For quite a number of systems that I deploy to an average datacenter, I already have Ansible playbooks written to handle that work. My actual time involved in deploying standard network monitoring applications and tools to a new datacenter went from hours to less than five minutes. For the purposes of this post, I&rsquo;ll be speaking more to the Python/Scripting side. However, the important point is not necessarily which toolset you choose - it&rsquo;s the fact that you try to use any one of these tools or others to automate something.</p>
<h2 id="stick-with-it">Stick with it</h2>
<p>Learning a scripting language at first might seem like a very unnecessary and time consuming task. However, this is something that will pay off in the long run. When I started learning Python, all I wanted to do was parse data from several CSV files and combine the necessary data into one large file. Stupid simple script, but it saved me half an hour each day for a previously manual task.</p>
<p>I&rsquo;m not at all a fantastic developer by any means, nor would I want to write code for a profession. I just really enjoy problem solving, and sometimes the best way to solve a problem is with a bit of custom scripting. What gets me excited is the process of finding something that wouldn&rsquo;t normally be possible and knowing that I have the skills and ability to make it happen. Over the past five years, my basic level Python abilities have enabled me to work my way through a number of problems - or write various scripts to make my job easier.</p>
<p>You&rsquo;ll need to dedicate some time and put in the effort up front to learn a new skill, but trust me it will be worth it.</p>
<h2 id="look-for-new-opportunities">Look for New Opportunities</h2>
<p>Once you have learned the basics, start looking for ways to use your new skills. It&rsquo;s a different way of thinking in some cases, and will likely take a bit of adjustment. Whats that? Your load balancer doesn&rsquo;t have built-in reporting functionality to tell you how many server pools you have (and how many are actually fully functioning vs degraded)? Yep, they probably have an API which would be easy enough to pull that data from.</p>
<p>Over the years, I&rsquo;ve built scripts to automate load balancer configurations, generate reports, alert on BGP peering changes, auto-remediate IPSec VPN disconnects, and even a full <a href="/building-a-vpn-dashboard-using-django-and-junos-pyez-part-1-initial-thoughts/">IPSec VPN dashboard</a> (since the vendor doesn&rsquo;t supply one). As a network administrator, having the automation skills in Python has allowed me to accomplish many tasks that my co-workers have stated aren&rsquo;t possible (solely based on the functionality not being native to a product). Sure, I spend a bit of time up front writing and testing out scripts - but it not only saves me time/effort, but also my peers who I share the scripts with. For example, my team used to have a maintenance task that would take a full hour to complete on a monthly basis. About a week worth of my own effort to write a script, and all of that work is now automated into a 30 second process.</p>
<p>Think about how automation can help not just you, but your whole team.</p>
<h2 id="the-future-of-networking">The Future of Networking</h2>
<p>If you follow practically any news source for computer networking, I&rsquo;m sure you&rsquo;ve heard this already. Over the next few years the role of a traditional network administrator can and will change. Businesses are evolving more rapidly to meet customer demands, and we need to ensure that our networks can keep up. The only way this is going to be possible is through automation, or hiring an ridiculous number of people.</p>
<p>Practically all major networking vendors are integrating APIs into the new iterations of their device platforms. Some are fantastic, and some are less than ideal - but they&rsquo;re all working on it. In some way or another these new APIs will become a part of your job - whether you&rsquo;re writing the code to perform tasks or just using a script written by someone else. Does this mean we have an end to our careers in the future? No - the CLI will take a while to completely disappear. Even if it does go away completely, the role of a network admin will not be replaced, but evolve into something a bit different from what we know today. Even today, having the skills to automate tasks out of your daily job can allow you to spend your time on more important things (like a new network design, or that big project you haven&rsquo;t had time to look at yet).</p>
<p>You can probably get away with not learning scripting and automation for quite some time yet - but don&rsquo;t you want to make your life easier and be prepared for the future of your career? I know I do.</p>
]]></content:encoded>
    </item>
    <item>
      <title>The Argument for Standardized Configurations</title>
      <link>https://0x2142.com/the-argument-for-standardized-configurations/</link>
      <pubDate>Tue, 31 Jan 2017 08:00:45 +0000</pubDate>
      <guid>https://0x2142.com/the-argument-for-standardized-configurations/</guid>
      <description>Snowflake network designs always make sense at the time. But what happens when there are no standards?</description>
      <content:encoded><![CDATA[<p>There are quite a few things that you don&rsquo;t realize how great they are until you don&rsquo;t have them anymore. For me, one of those things was standard guidelines for device configurations. At my last job, documented standards were extremely important - we had them for everything. While some devices might ultimately be configured in a slightly different manner to accommodate their specific purpose, the underlying basics were all configured exactly the same. Fast forward to where I am at now, and when I started there was no such thing. One device might be configured for management access only over the out of band interface, while a few others might allow management traffic over <em>every</em>interface. Some devices had SNMP configured, some didn&rsquo;t, and yet others had default credentials still enabled.</p>
<p>The problem here stemmed from the fact that there were no documented standards in place. An engineer was given a device to configure, and it was configured depending on who did it and what they felt needed configuring. In a few cases, this actually led to unnecessary security risks being introduced into the environment because something was left enabled. In one instance, this included open root SSH logins via the Internet to a production firewall. Scary, huh?</p>
<p>So how do we go about changing this? Here is a quick little guide I threw together on my method for tackling the situation:</p>
<h2 id="1-define-a-standard">1. Define a standard</h2>
<p>Begin creating a baseline document, whether it be a spreadsheet, word doc, or a wiki page. Start small and choose a single system, like your external firewalls for example.</p>
<h2 id="2-research-best-practices">2. Research best practices</h2>
<p>Check out the vendor&rsquo;s website to see what they recommend. There are also some amazing free resources out there like the Center for Internet Security&rsquo;s <a href="https://benchmarks.cisecurity.org/downloads/browse/index.cfm?category=benchmarks.network">configuration benchmarks</a>, Do your research - there is plenty available to help you.</p>
<h2 id="3-figure-out-whats-best-for-your-network">3. Figure out what&rsquo;s best for your network</h2>
<p>Not all of the best practices or security hardening guides will be a perfect fit for your environment. So it will take a little manual review to see what actually fits. For example, many of these guides recommend disabling local authentication in exchange for something centralized like TACACS+ or RADIUS. But if you don&rsquo;t have that available, then you&rsquo;re going to stick with local authentication. This can still be a great time to find room for future improvement projects though.</p>
<h2 id="4-test">4. Test</h2>
<p>If you have a development or test environment available, then run a device or two through your checklist and make sure there are no big issues. If you don&rsquo;t have a dedicated test area, then try and choose a low-impact device - where not much will be impacted if the changes go wrong.</p>
<h2 id="5-roll-out-the-changes">5. Roll out the changes</h2>
<p>Make sure you have a list of every device that needs to be touched, so that you have a way to validate. Then make the configuration changes to get each device into compliance with your new standards. Have a validation/testing checklist ready, so that you can quickly ensure that no production traffic was impacted</p>
<h2 id="6-train-your-peers">6. Train your peers</h2>
<p>Configuration standards only work well as long as <em>everyone</em>follows them. It only takes one person to ignore the checklist and potentially expose a vulnerability. So take an afternoon, schedule a training session with your team. Help them understand the importance of maintaining these standards, and train them on how to apply the changes (if necessary).</p>
<h2 id="7-automate">7. Automate</h2>
<p>This part is optional, but highly recommended. If nothing else, spend the time to automate verification of the standards - which will make it easy to locate a device that falls out of compliance. If you or your team have the skill set, then automate the entire process from initial deployment to continuous validation. Why is this the last step, instead of being included with the roll out? I am a firm believer that you should completely understand how your device functions and reacts to changes before automating those changes.</p>
<p>So that&rsquo;s more or less how I worked to implement a standardized configuration at my current job. I began with a completely new device platform that we were integrating into our environment, then began to go back to older device platforms. It might be a lot of upfront work, but it certainly helps me sleep better at night not having to wonder if there might be one device out there that&rsquo;s misconfigured (and will cause an issue later, due to that misconfiguration).</p>
<p>So let me know in the comments below - have you ever implemented something like this? If so, what did you do differently? If not, then let me know if you give this a try!</p>
]]></content:encoded>
    </item>
    <item>
      <title>Getting Started with JunOS PyEZ</title>
      <link>https://0x2142.com/getting-started-with-junos-pyez/</link>
      <pubDate>Tue, 24 Jan 2017 08:00:20 +0000</pubDate>
      <guid>https://0x2142.com/getting-started-with-junos-pyez/</guid>
      <description>Quickly get started using Juniper&amp;rsquo;s Python SDK &amp;amp; interact with JunOS devices</description>
      <content:encoded><![CDATA[<p><sup>Note: I may receive commissions for purchases made through links in this post. This is to help support my blog and does not have any impact on my recommendations.</sup></p>
<hr>
<blockquote>
<p>This guide is written for CentOS 7. If you&rsquo;re running another distro, find your dependencies <a href="https://www.juniper.net/techpubs/en_US/junos-pyez1.0/topics/task/installation/junos-pyez-server-installing.html">here</a>.</p></blockquote>
<p>Last year we had to begin migrating off of some of our older Juniper SSG firewalls since we were beginning to push them to their throughput limits. We evaluated a couple of vendors but ultimately decided to stay with Juniper and purchase SRX 1500 firewalls, which are capable of up to 10G throughput. After a while of working with these firewalls, I have to say they&rsquo;re pretty solid devices and I&rsquo;m extremely happy with them. One of the main reasons I like them so much is the ease of automation, which is what we&rsquo;re going to dive into today. If you need a device for lab/test - Amazon has the <a href="https://www.amazon.com/gp/product/B01ICEO2U4/ref=as_li_qf_asin_il_tl?ie=UTF8&amp;tag=0x2142-20&amp;creative=9325&amp;linkCode=as2&amp;creativeASIN=B01ICEO2U4&amp;linkId=35fbe8300af4e5d1e26e7a860782b3ca">SRX 300</a> for less than $300. I&rsquo;ll likely be picking one up in the near future for easier automation testing.</p>
<p>Juniper provides an awesome library for SRX management called PyEZ. Here is what we need to get the toolkit ready to use in our scripts:</p>
<h2 id="install-dependencies">Install dependencies</h2>
<p>I run CentOS here, so I just needed to grab the following packages:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">yum -y install python-devel libxml2-devel libxslt-devel gcc openssl openssl-devel libffi-devel
</span></span></code></pre></div><p>Just a quick note - Juniper&rsquo;s web page doesn&rsquo;t actually mention openssl-devel, but their tools will fail to install without it</p>
<h2 id="get-pip">Get pip</h2>
<p>If you don&rsquo;t have it already, then download the pip installer <a href="https://bootstrap.pypa.io/get-pip.py">here</a>. Then just run the following:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">python get-pip.py
</span></span></code></pre></div><h2 id="install-pyez">Install PyEZ</h2>
<p>Once everything else is set, this is the easy part:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">pip install junos-eznc
</span></span></code></pre></div><p>After all that is done, we can get to the exciting part: automating something so you don&rsquo;t have to do it anymore! So here is what we&rsquo;re going to throw in our script just to get started:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># Import the JunOS modules we need</span>
</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">jnpr.junos</span> <span class="kn">import</span> <span class="n">Device</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Define the login credentials and address for the target firewall</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Need to provide device address, user account, and password</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Note: Juniper also provides authentication via key-pair, which would be more secure than username/password</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">srx</span> <span class="o">=</span> <span class="n">Device</span><span class="p">(</span><span class="s1">&#39;10.10.10.10&#39;</span><span class="p">,</span> <span class="n">user</span><span class="o">=</span><span class="s1">&#39;deviceuser&#39;</span><span class="p">,</span> <span class="k">pass</span><span class="o">=</span><span class="s1">&#39;devicepass&#39;</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Open the connection</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">srx</span><span class="o">.</span><span class="n">open</span><span class="p">()</span>
</span></span></code></pre></div><p>Once you have that going, it&rsquo;s pretty easy to start making calls to collect data or change the configuration. In one of the first projects I used this for, I was making use of the API to reset VPN tunnels. This was due to an issue with a cross-vendor tunnel, which would occasionally break during VPN re-keys and only negotiate a uni-directional tunnel. So the script was written to detect a uni-directional flow of traffic, then log into the SRX and reset the VPN - which would force a renegotiation and fix the issue.</p>
<p>So in order to accomplish the SRX-side of that script, I used the following to reset the IKE and IPSec security associations:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># Clear IKE security association for a given peer</span>
</span></span><span class="line"><span class="cl"><span class="n">response</span> <span class="o">=</span> <span class="n">srx</span><span class="o">.</span><span class="n">rpc</span><span class="o">.</span><span class="n">clear_ike_security_association</span><span class="p">(</span><span class="n">peer_address</span><span class="o">=</span><span class="s1">&#39;20.20.20.20&#39;</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Check to see if command was accepted</span>
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="n">response</span> <span class="o">==</span> <span class="kc">True</span><span class="p">:</span> <span class="nb">print</span> <span class="s2">&#34;IKE SA Cleared&#34;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Clear IPSec security association for a given peer</span>
</span></span><span class="line"><span class="cl"><span class="c1"># Note: In this case, you need to provide the index ID</span>
</span></span><span class="line"><span class="cl"><span class="c1"># Get the index ID from running &#39;*show security ipsec sa&#39; *on the SRX</span>
</span></span><span class="line"><span class="cl"><span class="n">response</span> <span class="o">=</span> <span class="n">srx</span><span class="o">.</span><span class="n">rpc</span><span class="o">.</span><span class="n">clear_ipsec_security_association</span><span class="p">(</span><span class="n">index</span><span class="o">=</span><span class="s1">&#39;123456&#39;</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Same thing - Check to make sure the command succeeded</span>
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="n">response</span> <span class="o">==</span> <span class="kc">True</span><span class="p">:</span> <span class="nb">print</span> <span class="s2">&#34;IPSec SA Cleared&#34;</span>
</span></span></code></pre></div><p>This provides a pretty basic example of how easy it is to control the SRX via a Python script. You might be wondering: This is great, but how do I find the names of those calls? Well, Juniper made that extremely simple as well! Just take any command on the SRX and pipe it through <code>display xml rpc</code> and the device will tell you exactly what you need. For example:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-xml" data-lang="xml"><span class="line"><span class="cl">root@SRX123&gt; show security ipsec sa | display xml rpc
</span></span><span class="line"><span class="cl"><span class="nt">&lt;rpc-reply</span> <span class="na">xmlns:junos=</span><span class="s">&#34;http://xml.juniper.net/junos/15.1X49/junos&#34;</span><span class="nt">&gt;</span>
</span></span><span class="line"><span class="cl">    <span class="nt">&lt;rpc&gt;</span>
</span></span><span class="line"><span class="cl">        <span class="nt">&lt;get-security-associations-information&gt;</span>
</span></span><span class="line"><span class="cl">        <span class="nt">&lt;/get-security-associations-information&gt;</span>
</span></span><span class="line"><span class="cl">    <span class="nt">&lt;/rpc&gt;</span>
</span></span><span class="line"><span class="cl">    <span class="nt">&lt;cli&gt;</span>
</span></span><span class="line"><span class="cl">        <span class="nt">&lt;banner&gt;</span>{primary:node0}<span class="nt">&lt;/banner&gt;</span>
</span></span><span class="line"><span class="cl">    <span class="nt">&lt;/cli&gt;</span>
</span></span><span class="line"><span class="cl"><span class="nt">&lt;/rpc-reply&gt;</span>
</span></span></code></pre></div><p>In this case, we are running the command which would normally print all of the connected IPSec tunnels. So the section under <em>rpc</em> is where we want to look. Now just take the get-security-associations-information, and change the dashes to underscores. So to use this in a script we would call srx.rpc.get_security_associations_information(). I&rsquo;ve actually used this command to build a VPN status dashboard using Python and Django, which I accomplished by just pulling all the IPSec tunnels and parsing them into a web table.</p>
<p>As a final note, I would <strong>highly</strong> recommend creating a separate service account on the SRX for scripting. A separate user account with limited permissions would be the recommended way to go here. It might seem like a pain to set up, but it&rsquo;s worth it in terms of security. Here is what I have configured on my SRX firewalls for the API service account:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="err">system</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="err">login</span> <span class="err">{</span>
</span></span><span class="line"><span class="cl">        <span class="err">class</span> <span class="err">api-class</span> <span class="err">{</span>
</span></span><span class="line"><span class="cl">            <span class="err">permissions</span> <span class="err">security-control;</span>
</span></span><span class="line"><span class="cl">            <span class="err">allow-commands</span> <span class="nt">&#34;(clear security ike)|(clear security ipsec)&#34;</span><span class="err">;</span>
</span></span><span class="line"><span class="cl">            <span class="err">deny-commands</span> <span class="s2">&#34;(clear)|(file)|(file show)|(help)|(load)|(monitor)|(op)|(request)|(save)|(set)|(start)|(test)&#34;</span><span class="err">;</span>
</span></span><span class="line"><span class="cl">        <span class="p">}</span>
</span></span><span class="line"><span class="cl">        <span class="err">user</span> <span class="err">apiuser</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">            <span class="err">full-name</span> <span class="err">API_Service_Acct;</span>
</span></span><span class="line"><span class="cl">            <span class="err">uid</span> <span class="err">125;</span>
</span></span><span class="line"><span class="cl">            <span class="err">class</span> <span class="err">api-class;</span>
</span></span><span class="line"><span class="cl">            <span class="err">authentication</span> <span class="err">{</span>
</span></span><span class="line"><span class="cl">                <span class="err">encrypted-password</span> <span class="err">*&lt;encrypted</span> <span class="err">string</span> <span class="err">here&gt;*</span>
</span></span><span class="line"><span class="cl">            <span class="p">}</span>
</span></span><span class="line"><span class="cl">        <span class="err">}</span>
</span></span><span class="line"><span class="cl">    <span class="err">}</span>
</span></span><span class="line"><span class="cl"><span class="err">}</span>
</span></span></code></pre></div><p>So using the above example, you should only define the necessary commands in the <em>allow-commands</em> section. If the account is ever compromised, we are severely limiting the amount of damage that could be done. A little extra effort, but potentially a big payoff.</p>
<p>So what did you think of this tutorial? Helpful? Have questions? Let me know in the comments below!</p>
]]></content:encoded>
    </item>
  </channel>
</rss>
