<?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>Scripts on SneakU</title><link>https://sneaku.com/categories/scripts/</link><description>Recent content in Scripts on SneakU</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Tue, 01 Dec 2020 00:00:00 +0000</lastBuildDate><atom:link href="https://sneaku.com/categories/scripts/index.xml" rel="self" type="application/rss+xml"/><item><title>VMware Configuration Maximums PowerShell Module</title><link>https://sneaku.com/2020/12/01/vmware-configuration-maximums-powershell-module/</link><pubDate>Tue, 01 Dec 2020 00:00:00 +0000</pubDate><guid>https://sneaku.com/2020/12/01/vmware-configuration-maximums-powershell-module/</guid><description>&lt;p&gt;A couple of weeks ago when I was helping a colleague out with a script to &lt;a href="https://sneaku.com/2020/11/18/monitoring-nsx-fw-rules-per-host/"&gt;count the number of DFW rules on a host&lt;/a&gt; , I needed to see what other (if any) configuration maximums had changed between 2 releases of NSX-T.&lt;/p&gt;
&lt;p&gt;If you take a look at the configmax site &lt;a href="https://configmax.vmware.com"&gt;https://configmax.vmware.com&lt;/a&gt; , there is a link which will &amp;ldquo;Compare Limits&amp;rdquo; for you.&lt;/p&gt;
&lt;p&gt;&lt;img loading="lazy" src="https://sneaku.com/2020/12/01/vmware-configuration-maximums-powershell-module/images/image-1024x295.png"&gt;&lt;/p&gt;
&lt;p&gt;And this allows you to choose the releases that you want to compare&lt;/p&gt;</description></item><item><title>Monitoring NSX FW Rules per host</title><link>https://sneaku.com/2020/11/18/monitoring-nsx-fw-rules-per-host/</link><pubDate>Wed, 18 Nov 2020 00:00:00 +0000</pubDate><guid>https://sneaku.com/2020/11/18/monitoring-nsx-fw-rules-per-host/</guid><description>&lt;p&gt;Today I was asked for some help in figuring out the number of NSX-T Distributed Firewall rules configured for all filters on a given ESXi host.&lt;/p&gt;
&lt;p&gt;Why do we need to figure out this value? If you take a look at the configurations maximums page at &lt;a href="https://configmax.vmware.com"&gt;configmax.vmware.com&lt;/a&gt;, you&amp;rsquo;ll see one of the NSX-T Configuration Maximums is the number of &lt;strong&gt;Distributed Firewall Rules per Hypervisor Host&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Up until recently (NSX-T 3.0.2), this number had always remained the same at 10,000 and was something that you should monitor to make sure you remained within this (soft) limit.&lt;/p&gt;</description></item><item><title>Counting Exploded NSX-v DFW Rules</title><link>https://sneaku.com/2020/06/09/counting-exploded-nsx-v-dfw-rules/</link><pubDate>Tue, 09 Jun 2020 00:00:00 +0000</pubDate><guid>https://sneaku.com/2020/06/09/counting-exploded-nsx-v-dfw-rules/</guid><description>&lt;p&gt;When working with a customer recently, there was a question raised about how to calculate the actual number of NSX-v distributed firewall rules configured for a given VM on the dataplane of an ESXi host.&lt;/p&gt;
&lt;p&gt;Whilst the short answer was to jump onto the console of the hypervisor or SSH into the host and look at the rules configured on the filter with the following command:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;vsipioctl getrules -f &amp;lt;filtername&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Looks easy enough right? However, It didn&amp;rsquo;t really work in this specific customers environment as SSH and console access to the hypervisors was managed by a 3rd party and hence it was impossible for the customer to run the above command.&lt;/p&gt;</description></item><item><title>How to sync a dynamic NSX-T group to an external system</title><link>https://sneaku.com/2020/03/02/how-to-sync-a-dynamic-nsx-t-group-to-an-external-system/</link><pubDate>Mon, 02 Mar 2020 00:00:00 +0000</pubDate><guid>https://sneaku.com/2020/03/02/how-to-sync-a-dynamic-nsx-t-group-to-an-external-system/</guid><description>&lt;p&gt;One of the things that makes NSX-T such a flexible platform when it comes to creating security policy is the ability to group membership defined by dynamic criteria, or based on objects such as a logical segment.&lt;/p&gt;
&lt;p&gt;Once a group has been defined in NSX-T based on dynamic criteria, its membership can grow and shrink based on the specified criteria, which is awesome, and allows for virtual workloads to be added/removed from groups based on other attributes (e.g tags, amongst other attributes). But one of the sticking points of this extremely dynamic behaviour is that the groups are only available within the specific NSX-T environment for which they are configured.&lt;/p&gt;</description></item><item><title>NSX-v: Where is my object used that I am trying to delete?</title><link>https://sneaku.com/2017/09/07/nsx-v-where-is-my-object-used-that-i-am-trying-to-delete/</link><pubDate>Thu, 07 Sep 2017 00:00:00 +0000</pubDate><guid>https://sneaku.com/2017/09/07/nsx-v-where-is-my-object-used-that-i-am-trying-to-delete/</guid><description>&lt;p&gt;Over the past few years of working with NSX vSphere, one of the more frustrating things that would happen is that you would try to delete an object of some description (IP Set, Security Group, Service etc) and you would get the annoying message in the UI which says the object is in use, but it doesn&amp;rsquo;t give you any more information or any context of where to even start looking to find out where it is being used.&lt;/p&gt;</description></item><item><title>Log Insight &amp; NSX-v DFW</title><link>https://sneaku.com/2017/05/05/log-insight-nsx-v-dfw/</link><pubDate>Fri, 05 May 2017 00:00:00 +0000</pubDate><guid>https://sneaku.com/2017/05/05/log-insight-nsx-v-dfw/</guid><description>&lt;p&gt;I was recently asked by a customer who is running NSX vSphere (NSX-v) and Log Insight, is there a way they can export data from Log Insight that will give them the unique source/destination/protocol/destinationPort from the DFW logs for a given ruleId over a given time period. This exported data could then be fed into a &lt;a href="https://github.com/vmware/"&gt;PowerNSX&lt;/a&gt; (&lt;a href="https://github.com/vmware/"&gt;Get it on GitHub&lt;/a&gt;) script to create the required firewall rules.&lt;/p&gt;
&lt;p&gt;My initial response to the question was &amp;ldquo;buggered if I know, but I will send an email to some people that will know&amp;rdquo;.&lt;/p&gt;</description></item><item><title>My Python Virtual Env Setup Instructions</title><link>https://sneaku.com/2016/11/17/my-python-virtual-env-setup-instructions/</link><pubDate>Thu, 17 Nov 2016 00:00:00 +0000</pubDate><guid>https://sneaku.com/2016/11/17/my-python-virtual-env-setup-instructions/</guid><description>&lt;p&gt;Seeing as though I am always building different Ubuntu virtual machines to perform various python actions on (often on different customer sites), I find myself setting up the same things over and over again.&lt;/p&gt;
&lt;p&gt;My notes for this process are normally scattered between Notepad/TextEdit and Evernote, so its about time to put them all in the one spot so I can reference them easily.&lt;/p&gt;
&lt;p&gt;Depending on the environment I am working in, I may need to do an upgrade of the Ubuntu OS.&lt;/p&gt;</description></item><item><title>NSX-v - How to find Object IDs for almost everything!</title><link>https://sneaku.com/2016/07/12/nsx-v-how-to-find-object-ids-for-almost-everything/</link><pubDate>Tue, 12 Jul 2016 00:00:00 +0000</pubDate><guid>https://sneaku.com/2016/07/12/nsx-v-how-to-find-object-ids-for-almost-everything/</guid><description>&lt;p&gt;When starting out with the NSX-v API, you will quickly learn that there are times where you are required to reference an object, like when you want to add a member to a security group, you are required to know the object ID of the object you want to add as a member to the security group, as well as the object ID of the security  group itself.&lt;/p&gt;
&lt;p&gt;When using the NSX-v UI, you can try as hard as you want, but your aren&amp;rsquo;t going to be able to find the security group object ID. So how do you find it?&lt;/p&gt;</description></item><item><title>NSXRAMLCLIENT on Ubuntu Issues</title><link>https://sneaku.com/2015/09/30/nsxramlclient-on-ubuntu-issues/</link><pubDate>Wed, 30 Sep 2015 00:00:00 +0000</pubDate><guid>https://sneaku.com/2015/09/30/nsxramlclient-on-ubuntu-issues/</guid><description>&lt;p&gt;Following on from my last post about the &lt;a href="http://www.sneaku.com/2015/09/18/nsx-vsphere-raml-client/"&gt;NSXRAMLCLIENT&lt;/a&gt;, I decided to setup an Ubuntu machine dedicated to being able to run the NSXRAMLCLIENT in my home lab.&lt;/p&gt;
&lt;p&gt;Using my own instructions that I had written previously to get it up and running on my OSX 10.10.5 machine, I came across a peculiar issue when trying to initiate a connection to the nsx manager.&lt;/p&gt;
&lt;p&gt;Here is the code I was running which works on my OSX machine without issues:&lt;/p&gt;</description></item><item><title>NSX vSphere RAML Client</title><link>https://sneaku.com/2015/09/18/nsx-vsphere-raml-client/</link><pubDate>Fri, 18 Sep 2015 00:00:00 +0000</pubDate><guid>https://sneaku.com/2015/09/18/nsx-vsphere-raml-client/</guid><description>&lt;p&gt;Up until now, my programmatic interactions with the NSX API have all been hacked together based on the NSX API Guide, due to the lack of a specific NSX API scripting interface.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;For typical vSphere scripting, there has been PowerCli and also pyvmomi and I am sure a few more I don&amp;rsquo;t know about, but nothing created specifically for NSX. This meant that for individuals like myself, who wanted to write scripts to interact with the NSX-v API through python, we would have to create all the API calls from scratch which is time consuming and then learn how to parse the responses and content.&lt;/p&gt;</description></item><item><title>Scripting: NSX-v – Bulk DFW Rule Creation</title><link>https://sneaku.com/2015/08/26/scripting-nsx-v-bulk-dfw-rule-creation/</link><pubDate>Wed, 26 Aug 2015 00:00:00 +0000</pubDate><guid>https://sneaku.com/2015/08/26/scripting-nsx-v-bulk-dfw-rule-creation/</guid><description>&lt;p&gt;Recently when doing some performance testing with a customer, we wanted to have the ability to bulk create a number of DFW rules. By leveraging some python scripting and the NSX-v API, I came up with a flexible and re-useable script which can be used to create a new section and populate it with up to 997 DFW rules. The reason for creating a new section is so that when it comes time to delete the test rules, its as simple as just deleting the section, which will delete all rules within the section.&lt;/p&gt;</description></item><item><title>Scripting - Resetting NSX-v objects</title><link>https://sneaku.com/2015/06/14/scripting-resetting-nsx-v-objects/</link><pubDate>Sun, 14 Jun 2015 00:00:00 +0000</pubDate><guid>https://sneaku.com/2015/06/14/scripting-resetting-nsx-v-objects/</guid><description>&lt;p&gt;On various engagements I am involved with, I often need to produce some code to add or delete objects from NSX-v. These objects in general are things like IP Sets, MAC Sets, Security Groups, Security Tags, Services, Service Groups, Security Policies and even deleting the FW rulebase itself.&lt;/p&gt;
&lt;p&gt;Until recently I was doing this manually as I was dealing with relatively small numbers of objects, however on a previous engagement I was working on a script to import up to 33,000 objects and when testing the script in a dev environment, we needed a way to go through and delete everything we had just imported and set it back to &amp;ldquo;defaults&amp;rdquo;.&lt;/p&gt;</description></item><item><title>Scripting syslog server configurations on NSX-v Controllers</title><link>https://sneaku.com/2015/05/28/scripting-syslog-server-configurations-on-nsx-v-controllers/</link><pubDate>Thu, 28 May 2015 00:00:00 +0000</pubDate><guid>https://sneaku.com/2015/05/28/scripting-syslog-server-configurations-on-nsx-v-controllers/</guid><description>&lt;p&gt;Its well documented that the only way to configure syslog settings on NSX-v controllers is via the REST API. One of the things I find myself constantly doing over and over again on customer engagements is configuring syslog servers details on the NSX-v controllers, whether its because I am at a new client, or someone decides to change the destination for their syslog and we need to update them all.&lt;/p&gt;</description></item><item><title>Scripting: NSX-v – Displaying Security Group Members</title><link>https://sneaku.com/2015/04/24/scripting-nsx-v-displaying-security-group-members/</link><pubDate>Fri, 24 Apr 2015 00:00:00 +0000</pubDate><guid>https://sneaku.com/2015/04/24/scripting-nsx-v-displaying-security-group-members/</guid><description>&lt;p&gt;Often when working in customer environments, there is a requirement to define security group members which are not virtual machines within the visualised environment. To achieve this, these security group members must be defined as an IP Set.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.sneaku.com/wp-content/uploads/2015/04/IPSet-01.png"&gt;&lt;img alt="IPSet-01" loading="lazy" src="https://sneaku.com/2015/04/24/scripting-nsx-v-displaying-security-group-members/images/IPSet-01-300x297.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.sneaku.com/wp-content/uploads/2015/04/IPSet-02.png"&gt;&lt;img alt="IPSet-02" loading="lazy" src="https://sneaku.com/2015/04/24/scripting-nsx-v-displaying-security-group-members/images/IPSet-02-1024x389.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The IP Set can then be included as an object in a security group.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.sneaku.com/wp-content/uploads/2015/04/IPSet-03.png"&gt;&lt;img alt="IPSet-03" loading="lazy" src="https://sneaku.com/2015/04/24/scripting-nsx-v-displaying-security-group-members/images/IPSet-03-1024x598.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;However, within the UI, it doesn&amp;rsquo;t show you all the non-vm members of a security group.&lt;/p&gt;</description></item><item><title>Scripting: NSX-v - Security Groups with Dynamic membership</title><link>https://sneaku.com/2015/02/19/scripting-nsx-v-security-groups-with-dynamic-membership/</link><pubDate>Thu, 19 Feb 2015 00:00:00 +0000</pubDate><guid>https://sneaku.com/2015/02/19/scripting-nsx-v-security-groups-with-dynamic-membership/</guid><description>&lt;p&gt;NSX-v allows the creation of Security Groups to group objects to be used in DFW rules and security policies. Each security group can have a mix of static and dynamic membership (If you want to get picky, you can also statically exclude objects). One of the possible ways to dynamically include members into the security group is to match on a security tag. This allows a VM to have security tags assigned to them, and based on the security tag, a VM can be dynamically added as a security group member.&lt;/p&gt;</description></item><item><title>Scripting: NSX-v - Importing Checkpoint Objects</title><link>https://sneaku.com/2015/02/06/scripting-nsx-v-importing-checkpoint-objects/</link><pubDate>Fri, 06 Feb 2015 00:00:00 +0000</pubDate><guid>https://sneaku.com/2015/02/06/scripting-nsx-v-importing-checkpoint-objects/</guid><description>&lt;p&gt;When faced with migrating from a Checkpoint installation to a VMware NSX-v installation, at some point someone is going to need to get all the objects across to the new firewall platform. I was recently asked to help add some functionality to a script to take some data from an odumper csv output and pump it into NSX-v.&lt;/p&gt;
&lt;p&gt;The following script is a bit of a hack I put together. The script is based off one written by Brett Drayton (&lt;a href="http://www.brettdrayton.com"&gt;www.brettdrayton.com&lt;/a&gt;) in &lt;a href="http://brettdrayton.com/nsx-importing-data-checkpoint-ve/"&gt;this post&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Scripting: Querying NSX-v service objects by port</title><link>https://sneaku.com/2015/02/05/scripting-querying-nsx-v-service-objects-by-port/</link><pubDate>Thu, 05 Feb 2015 00:00:00 +0000</pubDate><guid>https://sneaku.com/2015/02/05/scripting-querying-nsx-v-service-objects-by-port/</guid><description>&lt;p&gt;When using the NSX-v distributed firewall (DFW) have you ever need to find out if a service has already been configured in the system for a particular port number?&lt;/p&gt;
&lt;p&gt;Recently I was given a sample ruleset from a client to re-create in the DFW, and one thing that stood out was that when creating NSX firewall rules and faced with a random port number that needed to be configured for a rule, there is no easy way to find out if a service has already been configured using that port.&lt;/p&gt;</description></item><item><title>Scripting, Scripting and more Scripting</title><link>https://sneaku.com/2015/02/03/scripting-scripting-and-more-scripting/</link><pubDate>Tue, 03 Feb 2015 00:00:00 +0000</pubDate><guid>https://sneaku.com/2015/02/03/scripting-scripting-and-more-scripting/</guid><description>&lt;p&gt;Over my years as a network engineer there has always been some element of scripting required. Whether it was formally required by a project, a particular situation or whether it was because i was sick of doing the same thing over and over again and wanted to make my life easier.&lt;/p&gt;
&lt;p&gt;As part of my new role at VMware, I get to play with NSX for vSphere or NSX-v, and one thing that becomes apparent, is that if you don&amp;rsquo;t learn how to use the REST API, there will be certain situations where you will not be able to achieve your desired outcome. The NSX REST API, can be used to configure items which are not exposed in the UI, or you can use your favourite scripting language and script repetitive tasks.&lt;/p&gt;</description></item></channel></rss>