Replacing the self-signed Certificate on NSX-T

Ran into a difficulty trying to use the self-signed certificate that comes pre-configured on the manager for NSX-T. In my case, Pivotal Operations Manager refused to accept the self-signed certificate.

So, for NSX-T 2.1, it looks like the procedure is:

    1. Log on to the NSX Manager and navigate to System|Trust
    2. Click CSRs tab and then “Generate CSR”, populate the certificate request details and click Save
    3. Select the new CSR and click Actions|Download CSR PEM to save the exported CSR in PEM format
    4. Submit the CSR to your CA to get it signed and save the new certificate. Be sure to save the root CA and any subordinate CA certificates too<. In this example, certnew.cer is the signed NSX Manager certificate, sub-CA.cer is the subordinate CA certificate and root-CA.cer is the Root CA certificate
    5. Open the two (or three) cer files in notepad or notepad++ and concatenate them in order of leaf cert, (subordinate CA cert), root CA cert
    6. Back in NSX Manager, select the CSR and click Actions|Import Certificate for CSR. In the Window, paste in the concatenated certificates from above and click save
    7. Now you’ll have a new certificate and CA certs listed under Certificates. The GUI only shows a portion of the ID by default, click it to display the full ID and copy it to the clip board
    8. Launch RESTClient in Firefox.
      • Click Authentication|Basic Authentication and enter the NSX Manager credentials for Username and Password, click “Okay”
      • For the URL, enter https://<NSX Manager IP or FQDN>api/v1/node/services/http?action=apply_certificate&certificate_id=<certificate ID copied in previous step>
      • Set the method to POST and click SEND button
      • check the Headers to confirm that the status code is 200
    9. Refresh browser session to NSX Manager GUI to confirm new certificate is in use

Notes:
I was concerned that replacing the certificate would break the components registered via the certificate thumbprint; this process does not break those things. They remain registered and trust the new certificate

Resolutions for 2018

If I put it here, I’m much more likely to follow-through.  Like many, I work best under some pressure.  Here is a list of what I want to do differently (with regard to technology) next year.

  1. Do more blogging.  I can make a ton of excuses for not blogging as much this year.  I love sharing what I’ve learned; the more new stuff I learn, the more I share.  So….
  2. Do more for NSX for vSphere and NSX-T.  I feel strongly that SDN is critical to the future of how datacenters operate.  NSX is the logical leader in this space and will only grow in interest.  There is still a tendency to replicate what was done with pre-SDN technology and I’d like to see modern ways to solve problems while finding and pushing the limits of what can be done in SDN.
  3. PKS
    Do more with containers and PKS.  The technologies that Pivotal provides are cutting edge.  Already and continuing, containers and applications-as-code methods are growing and will define the datacenter of the future.  Just as a few years ago, we stopped thinking of hardware servers as single-purpose, we’ll embrace multiple workloads within a VM.
  4. Do more coding.  I love concourse and pipelines, but have a lot to learn.  Let’s find the limits of BOSH and pipelines.  Can we not only deploy, but automate the operation and maintenance of a PaaS solution?
  5. Do more coding.  I feel that as we move to “applications-as-code”, it’s important to understand what that means to developers and operators.  What sort of problems become irrelevant in this approach?  What molehills become mountains?

Hope to see you next year!

 

Removing NSX-T VIBs from ESXi hosts

I’d wanted to revert my environment from (an incomplete install of) NSX-T v2.0 back to NSX for vSphere v6.3.x, but found that the hosts would not complete preparation.  The logs indicated that something was “claimed by multiple non-overlay vibs”.

Error in esxupdate.log

I found that the hosts still had the NSX-T VIBs loaded, so to remove them, here’s what I did:

  1. Put the host in maintenance mode.  This is necessary to “de-activate” the VIBs that may be in use
  2. Login to the host via SSH
  3. Run

    /etc/init.d/netcpad stop
    /etc/init.d/nsx-ctxteng stop remove
    /etc/init.d/nsx-da stop remove
    /etc/init.d/nsx-datapath stop remove
    /etc/init.d/nsx-exporter stop remove
    /etc/init.d/nsx-hyperbus stop remove
    /etc/init.d/nsx-lldp stop remove
    /etc/init.d/nsx-mpa stop remove
    /etc/init.d/nsx-nestdb stop remove
    /etc/init.d/nsx-platform-client stop remove
    /etc/init.d/nsx-sfhc stop remove
    /etc/init.d/nsx-support-bundle-client stop remove
    /etc/init.d/nsxa stop remove
    /etc/init.d/nsxcli stop remove

  4. Run this all in one line; note the the order of the vibs is important

    esxcli software vib remove -n nsx-ctxteng -n nsx-hyperbus -n nsx-platform-client -n nsx-nestdb -n nsx-aggservice -n nsx-da -n nsx-esx-datapath -n nsx-exporter -n nsx-host -n nsx-lldp -n nsx-mpa -n nsx-netcpa -n nsx-python-protobuf -n nsx-sfhc -n nsx-support-bundle-client -n nsxa -n nsxcli -n nsx-common-libs -n nsx-metrics-libs -n nsx-nestdb-libs -n nsx-rpc-libs -n nsx-shared-libs -n nsx-python-gevent -n nsx-python-greenlet

  5. reboot the host

Configuring NSX Load-Balancer for PCF

There’s not a lot of specific information out there for this configuration.  There’s some guidance from Pivotal and some how-tos from VMware, so with a little additional detail, we should be able to figure this out.

Edit – 2/1/17 – Updated with OpenSSL configuration detail
Edit – 3/20/17 – Updated SubjectAltNames in config

Preparation

  1. SSL Certificate. You’ll need the signed public cert for your URL (certnew.cer), the associated private key (pcf.key) and the public cert of the signing CA (root64.cer).
    1. Download and install OpenSSL
    2. Create a config file for your request – paste this into a text file:

      [ req ]
      default_bits = 2048
      default_keyfile = rui.key
      distinguished_name = req_distinguished_name
      encrypt_key = no
      prompt = no
      string_mask = nombstr
      req_extensions = v3_req

      [ v3_req ]
      basicConstraints = CA:FALSE
      keyUsage = digitalSignature, keyEncipherment
      extendedKeyUsage = serverAuth, clientAuth
      subjectAltName = DNS: *.pcf.domain.com, DNS:ServerShortName, IP:ServerIPAddress, DNS: *.system.pcf.domain.com, DNS: *.apps.pcf.domain.com, DNS:*.login.system.pcf.domain.com, DNS: *.uaa.system.pcf.domain.com

      [ req_distinguished_name ]
      countryName = US
      stateOrProvinceName = State
      localityName = City
      0.organizationName = Company Name
      organizationalUnitName = PCF
      commonName = *.pcf.domain.com

    3. Replace the values in red with those appropriate for your environment. Be sure to specify the server name and IP address as the Virtual IP and its associated DNS record. Save the file as pcf.cfg.  You’ll want to use the wildcard “base” name as the common name and the server name, as well as the *.system, *.apps, *.login.system and *.uaa.system Subject Alt Names.
    4. Use OpenSSL to create the Certificate Site Request (CSR) for the wildcard PCF domain.

      openssl req -new -newkey rsa:2048 -nodes -keyout pcf.key -out pcf.csr -config pcf.cfg

    5. Use OpenSSL to convert the key to RSA (required for NSX to accept it)

      openssl rsa -in pcf.key -out pcfrsa.key

    6. Submit the CSR (pcf.csr) to your CA (Microsoft Certificate Services in my case), retrieve the certificate (certnew.cer) and certificate chain (certnew.p7b) base-64 encoded.
    7. Double-click certnew.p7b to open certmgr. Export the CA certificate as 64-bit encoded x509 to a file (root64.cer is the file name I use)
  2. Networks.  You’ll need to know what layer 3 networks the PCF components will use.  In my case, I set up a logical switch in NSX and assigned the gateway address to the DLR. Probably should make this a 24-bit network, so there’s room to grow, but not reserving a ridiculous number of addresses. We’re going to carve up the address space a little, so make a note of the following:
    • Gateway and other addresses you typically reserve for network devices.  (eg:  first 9 addresses 1-9)
    • Address that will be assigned to the NSX load balancer.  Just need one (eg: 10)
    • Addresses that will be used by the PCF Routers.  At least two. These will be configured as members in the NSX Load Balancer Pool.
  3. DNS, IP addresses.  PCF will use “system” and “apps” subdomains, plus whatever names you give any apps deployed.  This takes some getting used to – not your typical application.  Based on the certificate we created earlier, I recommend just creating a “pcf” subdomain.  In my case, the network domain (using AD-DNS) is ragazzilab.com and I’ve created the following:
    • pcf.ragazzilab.com subdomain
    • *.pcf.ragazzilab.com A record for the IP address I’m going to assign to the NSX Load-Balancer

NSX

Assuming NSX is already installed and configured.  Create or identify an existing NSX Edge that has an interface on the network where PCF will be / is deployed.

  1. Assign the address we noted above to the inteface under Settings|Interfaces
  2. Under Settings|Certificates, add the our SSL certificates
    • Click the Green Plus and select “CA Certificate”.  Paste the content of the signing CA public certificate (base64.cer) into the Certificate Contents box.  Click OK.
    • Click the Green Plus and select “Certificate”.  Paste the content of the signed public cert (certnew.cer) into the Certificate Contents box and paste the content of the RSA private key (pcfrsa.key) into the Private Key box. Click OK.
  3. Under Load Balancer, create an Application Profile. We need to ensure that NSX inserts the x-forwarded-for HTTP headers.  To do that, we need to be able to decrypt the request and therefore must provide the certificate information.  I found that Pool Side SSL had to be enabled and using the same Service and CA Certificates.
    Router Application Profile
    Router Application Profile

     

  4. Create the Service Monitor.  What worked for me is a little different from what is described in the GoRouter project page. The key points are that we want to specify the useragent and look for a response of “ok” with a header of “200 OK”.

    Service Monitor for PCF Router
    Service Monitor for PCF Router
  5. Create the Pool.  Set it to ROUND-ROBIN using the Service Monitor you just created.  When adding the routers as members, be sure to set the port to 443, but the Monitor Port to 80.

    Router Pool
    Router Pool
  6. Create the Virtual Server.  Specify the Application Profile and default Pool we just created.  Obviously, specify the correct IP Address.
    Virtual Server Configuration
    Virtual Server Configuration


PCF – Ops Manager

Assuming you’ve already deployed the Ops Manager OVF, use the installation dashboard to edit the configuration for Ops Manager Director.  I’m just going to highlight the relevant areas of the configuration here:

Networks.  Under “Create Networks”, be sure that the Subnet specified has the correct values.  Pay special attention to the reserved IP ranges.  These should be the addresses of the network devices and the IP address assigned to the load-balancer.  Do not include the addresses we intend to use for the routers though.  Based on the example values above, we’ll reserve the first 10 addresses.

Ops Manager Network Config
Ops Manager Network Config

Ops Manager Director will probably use the first/lowest address in range that is not reserved.

PCF – Elastic Runtime

Next, we’ll install Elastic Runtime.  Again, I’ll highlight the relevant sections of the configuration.

  1. Domains.  In my case it’s System Domain = system.pcf.ragazzilab.com and Apps Domain = apps.pcf.ragazzilab.com
  2. Networking.
    • Set the Router IPs to the addresses (comma-separated) you noted and added to as members to the NSX load-balancer earlier.
    • Leave HAProxy IPs empty
    • Select the point-of-entry option for “external load balancer, and it can forward encrypted traffic”
    • Paste the content of the signed certificate (certnew.cer) into the Certificate PEM field.  Paste the content of the CA public certificate (root64.cer) into the same field, directly under the certificate content.
    • Paste the content of the private key (pcf.key) into the Private Key PEM field.
    • Check “Disable SSL Certificate verification for this environment”.
  3. Resource Config.  Be sure that the number of Routers is at least 2 and equal to the number of IP addresses you reserved for them.

 

Troubleshooting

Help! The Pool Status is down when the Service Monitor is enabled.

This could occur if your routers are behaving differently from mine.  Test the response by sending a request to one of the routers  through curl and specifying the user agent as HTTP-Monitor/1.1

curl -v -A “HTTP-Monitor/1.1” “http://{IP of router}”

 

Testing router with curl
Testing router with curl

The value in the yellow box should go into the “Expected” field of the Service Monitor and the value in the red box should go into the “Receive” field. Note that you should not get a 404 response, if you do, check that he user agent is set correctly.

 

Notes

This works for me and I hope it works for you.  If you have trouble or disagree, please let me know.

Automating syslog configuration on NSX

If you’re here, you’ve probably already found VMKB2092228 and been frustrated by the lack of an easy and consistent way to configure all the NSX components to send log data.  Me too.

I put together a vRO workflow to help configure (and reconfigure) syslog on NSX.

  1. It prompts for the NSX manager connection info and Syslog server info
  2. Creates a REST host for the NSX manager using the admin super-user account
  3. Adds several REST operations to the NSX Manager REST host
  4. Deletes and readds the syslog configuration on the NSX Manager
  5. Optionally configures Activity Monitoring on the NSX Manager
  6. Identifies each running Controller; deletes and readds the syslog config on each
  7. Identifies each deployed and “Green” Edge (including DLRs); deletes and readds the syslog config on each
  8. Removes the NSX Manager REST host created earlier

Notes

  • It must use the NSX Manager admin account – it’s the only superuser account that can update teh manager config.
  • If a Controller is not running when the workflow runs, its syslog config will not be updated
  • If an Edge’ state is not “green” or is not fully deployed, its syslog config will not be updated
  • REST-HTTP plugin for vRO is required
  • Tested with vRO 6.0.2 and NSX 6.2.1
  1. Get the package Download Here

    By downloading any code, package or file, you acknowledge that:There is no explicit or implied warranty or support for the code.  Neither Brian Ragazzi, his employer nor anyone else is responsible for any problems, errors, omissions, unexpected behavior, breakage, trauma, outage, fatigue, lost time, lost work or incontinence that may occur as a result of using the code or package.

  2. Import package into vRO
  3. Run the ConfigureSyslogNSX workflow
    Workflow Step 1
    Workflow Step 1

    Workflow Step 2
    Workflow Step 2

About Cross-vCenter NSX

I’ve spent the past several weeks testing, trying to understand Cross-vCenter NSX and make it work in a useful way.  Here’s what I’ve learned so far.

Environment and Set up:

I knew I needed two “sites” with discrete storage, but had a few physical limitations.  I.e; I only own one managed router (Cisco C2821) and one managed switch (Force 10 S50).  I trunked the management and vtep network to all the hosts, but configured a discrete transit network for each “site”.  I hope to work with a much larger lab environment and do a thorough review of the setup and configuration.  In the meantime, here’s the basics.

  • Two-host cluster, NSX manager and vCenter Server for primary site
  • 1 host cluster, NSX manager and vCenter Server for recovery site
  • vSphere 6.0 U1b
  • NSX for vSphere 6.2.1
  • Universal Transport Zone includes both clusters, configured for Local Egress.
  • VTEPs in same L3 network (for simplicity’s sake)
  • Edge per site, discrete transit networks
  • Universal DLR for tenant networks, uplinked to both site ESGs
  • OSPF area for each ESG->UDLR
Partial Lab Network
Partial Lab Network

Objectives

  1. Eliminate need for manual synchronization between sites/NSX instances
    • Success! The distributed firewall and universal objects are respected by the NSX manager at both sites.  Universal Security Groups and Logical Switches are usable at either end.
  2. Span VXLANs between sites
    • Success! This is not really a surprise.  As long as the clusters share a Transport Zone and teh VTEPs can route to each other, this works great.
  3. Minimize network alterations when used with Site Recovery Manager to failover protected VMs between vCenter Servers.
    • Partial success.  A placeholder/recovered VM will be in the same Universal Security Groups as the protected VM and the distributed firewall rules will apply as expected without any changes needed.  However, even with Local Egress enabled, you’ll have to apply some sort of route updates so that traffic destined for the recovered VMs can get there.  It looks like the route redistribution for egress us handled automatically though.  This configuration pushed the limits of what I can do with my lab.
  4. Make use of site-to-site microsegmentation (my definition:  application of security policy regardless of L3 network scope)
    • Partial Success.  I was really disappointed here. When the document states that you can add IP Sets, MAC Sets and other Universal Security Groups to a Universal Security Group, it means that’s ALL you can add.  I’ve blogged a few times about adding VMs to a Security Group – even doing it as a Resource Action in vRA.  That won’t work with Universal Security Groups!  The only workaround I see is to add the desired VM’s IP or MAC to a Set and include the Set in the Security group.  Blech!
  5. Retain ability to assign security policy via security group membership through vRA
    • FAILURE.  As noted above, we cannot assign Universal security group membership to a VM using any of the existing custom properties.

Notes and Observations

I guess I get it.  The vm id between vCenter Servers will differ, so saying that “vm-123 is a member of securitygroup-456” is not valid on a different vCenter Server.  But a table of IPs and MACs would be universally valid.  I’m hoping that in a near-future version, the universal security group membership capabilities can be extended; perhaps with a shared or replicated vCenter Inventory Service.

 

Automating NSX Security Groups with vCAC/vRA – Part 2

***UPDATE***  The download link is currently broken.   I seem to have lost the file, will fix the link as soon as I find or recreate it.  Sorry about that. 😦

In part 1 of this series, we created a list of security groups and displayed that list to users during the request.  In this post, we want to enhance that functionality by adding these features.

  • Creation of Security Groups and inclusion in Dropdown lists
  • Add a VM to a Security Group post-provisioning
  • Import existing Security Groups into vRA inventory
  • Add a Security Group to a Dropdown list

We’re going to do that by importing a vCO package with some new workflows and actions, then link up the workflows to Advanced Services and Resource Actions.  As before, we’ll require the NSX and vCAC/vRA plugins for Orchestrator.

Preparation

  • Complete the creation of the VCNS.SecurityGroup.Names.production property dictionary and valuelist attribute from Part 1.  We’re going to reuse those items. so make a note of the exact name of the property dictionary and the valuelist attribute.  In my case, I’ve named the Property Dictionary VCNS.SecurityGroup.Names.production and also named the valuelist attribute for it VCNS.SecurityGroup.Names.production
  • Make sure vRA Advanced Services Server Configuration is complete and test the connection to the Orchestrator server.  The default, built-in VCO is fine.
  • Login to vCO client as a vCO Admin. Set the mode to “Design” and navigate to the Inventory tab.  Make sure that you have a connection listed under “vCAC Infrastructure Administration” and a connection listed under “NSX”.

 

Confirm that you have the necessary connections on the inventory tab
Confirm that you have the necessary connections on the inventory tab

Get the Package

I’ve put together a handful of workflows and actions that use or expand the NSX plugin to provide information of functionallity back to vRA.  Where possible, I reused existing library workflows, but in some cases, I had to use the API to create a REST call and consume that in an action.

By downloading any code, package or file, you acknowledge that:

There is no explicit or implied warranty or support for the code.  Neither Brian Ragazzi, his employer nor anyone else is responsible for any problems, errors, omissions, unexpected behavior, breakage, trauma, outage, fatigue, lost time, lost work or incontinence that may occur as a result of using the code or package.

Download the zip file.  It contains the package and a couple of images that can be used for the advanced services

Import the Package

  1. Extract the zip file
  2. In the vCO Client, navigate to the packages tab.
  3. Click the “import package” button and select the extracted .package file
  4. On the Package Import Information step, click “Import

    Package Import Information
    Package Import Information
  5. On the Import package… step, check the “Select/Deselect all” box to check all of the items.  Please note the server path, these should not be duplicates of anything else you have in your vCO inventory (unless you’ve already imported this package previously).  Click “Import Selected elements”.

    Select all items
    Select all items
  6. Review the workflows and actions added to your inventory.

Configure Advanced Services – Create Security Group

This service enables the user to create a new NSX Security Group and automatically adds its name to the appropriate dropdown list of security groups.  It can be added once for each different list of security groups.  You’ll need to know the exact name of the Property Dictionary and valuelist attribute you created in Part 1.

NSX Management Services
NSX Management Services
NSX Security Groups in vRA Items
NSX Security Groups in vRA Items
  1. While logged into vRA as a service architect, navigate to the Advanced Services tab, click “Custom Resources
  2. We need to make vRA aware of NSX Security Groups.  Click the Add button.
  3. In the Orchestrator Type field, enter “NSX:SecurityGroup“; for the Name, I suggest “NSX Security Group“, click Next

    Add NSX Security Group as Custom Resource
    Add NSX Security Group as Custom Resource
  4. On the details form, we’re not going to make any changes, but if you wanted to hide certain properties, you could here.  Click “Add“.
  5. Click “Service Blueprints”, then the “Add” button.
  6. On the Workflow tab, select the AddNewSecurityGrouptoDropdown workflow, click next.

    Select "AddNewSecurityGrouptoDropdown" workflow
    Select “AddNewSecurityGrouptoDropdown” workflow
  7. On the Details tab, set the name to something like “Create new Production NSX Security Group“, because we’re going to create the security group and add its name to the “production”dropdown list.  Click Next.

    Set the Service Item Name
    Set the Service Item Name
  8. On the Blueprint  Form tab, under the “Step” Form page (default), mouseover the text field labelled “Name of Custom Property Dictionary in vCAC/vRA”.  Click the pencil “edit” icon when it appears.

    Edit the Form Fields
    Edit the Form Fields
  9. Click the Constraints tab of the “Edit Form Field” window.  On the Value field, select “Constant” and enter “VCNS.SecurityGroup.Names.Production” (or whatever suffix you used) for the Property Dictionary.  Set the Visible value to “No” so it doesn’t show up. Click Submit on the Edit Form Field window.

    Set the name of the Property Dictionary to be updated
    Set the name of the Property Dictionary to be updated
  10. Using the same method, set the Name of the Attribute appropriately and its visibility to no
  11. Edit the “Value to be appended to the ValueList attribute” field.  Set the label to “New Security Group Name“.  Do not set a value or make this one invisible, we need the user to enter a value, submit to save.
  12. Edit the vCACIaaSHost field – using the Constraints tab again– when setting the value, choose constant, then click Add by the green plus, to display a treeview, where you can choose your connection to the IaaS Server.  Visible: No, submit to save.

    Select connection to IaaS host
    Select connection to IaaS host
  13. Edit the “NSX endpoint” field in the same way, selecting the NSX connection.
  14. When done, all fields except “New Security Group Name” will have a value.  Click Next.
  15. On the Provisioned Resource tab, select “securityGroup [NSX Security Group]“.  Click Add to save the service blueprint.
  16. Repeat steps 5-15 for any other dropdown lists containing security groups; say “Non-Production” for instance
  17. Highlight the Service Blueprint and click “Publish” to make the blueprint available for entitlements
  18. Navigate to Administration, Services.
  19. Add a new Service named “NSX Management” (for example) – I included a nifty image in the zip file
  20. Under Catalog Items, click the “Create new Production NSX Security Group” item to edit it.
  21. The Catalog item should inherit the Security Group icon from vCO, set its Service to “NSX Management”,click update to save.
  22. Create or Edit an entitlement to include the new Service and/or catalog item.
  23. Try it out, confirm that the Security Group was created in NSX, is visible in vCAC items and it name was added to the Property Dictionary

Configure Advanced Services – Import Security Group

This service allows you to make existing security groups visible as items in the vCAC Items view.  Once this is done, we’ll add actions that allow you to add the security group to a dropdown list.

  1. Click “Service Blueprints”, then the “Add” button.
  2. Select the “GetNSXSecurityGroup” workflow, click Next
  3. On the details tab, set the name to “Import NSX Security Group“, click Next
  4. On the Blueprint form, set the “connection” to the NSX connection in vCO, then hide the field.  Security Group Name will be a dropdown list of existing NSX Security Groups for the user to choose from. Click Next
  5. On the Provisioned Resource tab, select “securityGroup [NSX Security Group]“.  Click Add to save the service blueprint.
  6. Just as before, publish the service blueprint, add it to a service and an entitlement.

 Configure Advanced Services – Add Security Group to Dropdown list

With this service, we’ll let the user add the name of an existing Security Group to a drop down list.  Unlike the first two, this is implemented as a Resource Action, meaning it’ll be executed against an existing item (a Security Group in this case)

  1. Under Resource Actions, click “Add”
  2. For the Workflow, select the “AddExistingSecurityGrouptoDropdown“, click Next
  3. On the “Input Resource” tab, keep NSX Security Group, click Next
  4. On the Details tab, set the Name to “Add Security Group to Production list” or similar, set the description, leave the Type options unchecked.  click Next

    Set Action Name and Description
    Set Action Name and Description
  5. On the Form tab, just like the first service blueprint, set the Property Dictionary and Attribute names as appropriate.  VCNS.SecurityGroup.Names.production in my example, set visible to no on both.
  6. Again, we’ll set the vCACIaaSHost to the connection to the Server and hide the field
  7. Click Add to save the action.
  8. Repeat steps 1-6 for each security group dropdown list (say “non-production” for instance)
  9. Publish the action and add it to an entitlement

    Add Action to Entitlement
    Add Action to Entitlement
  10. Test by navigating toNSX under Items, highlight a Security group and Select “Add Security Group to…” from the Actions menu.

    Yay! A Resource Action
    Yay! A Resource Action

 Configure Advanced Services – Add VM to a Security Group

This service lets you add a provisioned VM to additional Security Groups.  So, at provisioning-time, the VM is added to the Security Group selected by the user, but we may need to refine the security by adding that VM to additional Security Groups.

  1. Under Resource Actions, click “Add
  2. For the Workflow, select the “AddVMtoSecurityGroup“, click Next
  3. On the “Input Resource” tab, keep IaaS VC VirtualMachine, click Next
  4. On the Details tab, set the name to “Add VM to a Security Group“, click Next
  5. On the Form tab, set the connection Value to the NSX connection.
  6. Leave the NSX Security Group field visible, click Add to save the action
  7. Publish the action and add it to an entitlement
  8. Test by selecting a machine under Items and “Add VM to a Security Group” from the Actions menu

    VM Resource Action for Security Groups
    VM Resource Action for Security Groups
  9. You’ll be presented with the list of allNSX Security Groups to which you can add the selected VM

    Select Security Group
    Select Security Group

Conclusion

This part of the series should help streamline the management of VMs and their membership in Security Groups.  Obviously, items like removing a VM from a Security Group or even removing a Security Group are not included here.  The NSX plugin is missing quite a bit of functionality available in the API, so those additional functions require significantly more configuration.

Thanks to John Dias for his information and examples posted here.

 

Automating NSX Security Groups with vCAC/vRA – Part 1

In this series, I’ll document how to automate the creation and (some of) the management of NSX security groups within NSX.

First, what’s the use case?  Why is this interesting?  Let’s assume that you’ve decided to use large “flat” networks instead of many small networks.  One reason you may make that decision is because of the challenges with either having many blueprints (one per network!) or making changes to the workflows to reliably set the appropriate properties.

Background

In this solution, we’ll have to have vCAC 6.1 or vRealize Automation 6.2, NSX 6.x and vCenter/vRealize Orchestrator with the vCAC and NSX plugins installed and configured. We have two Logical Switches, one for Production and one for Non-Production.  In addition, there’s a corresponding network profile and the business groups have reservations.  Now, we have to ensure that there  are security boundaries within the flat networks.  We’ll accomplish this through Security Groups.

Caveats

We’ll create security groups and nod in the direction of security profiles, but will not be automating the creation of security profiles nor their assignment to the Security Group(s).  That can be done by the security admins through the NSX interface or maybe later we’ll add that capability too. 😉

 Procedure

  1. Create Security Groups.
    • Open vSphere Web Client and navigate to Networking and Security, then Service Composer.
    • Click the “New Security Group” icon
    • Enter a Name and Description for your new Security Group and click Next
    • If you want to create rules for dynamic membership or include/exclude existing VMs, you can do so in the subsequent steps.  Finish the wizard.
    • Repeat to create all of your security groups
    • Create Security Groups in NSX
      Create Security Groups in NSX
  2. Create Property Dictionaries invCAC/vRA.
    • Log into vCAC as an Infrastructure Admin and navigate to Infrastructure|Blueprints|Property Dictionary
    • Click “New Property Definition”, for the name enter “VCNS.SecurityGroup.Names.Production“.  You can replace “Production” with a name of your choosing, so you can have multiple lists.
    • Select “DropDownList” as the control type and check to make it required, click the green check to save.

      Create Property Dictionary
      Create Property Dictionary
    • Click the “Edit” link in the Property Attributes column
    • Click “New Property Attribute”, select “ValueList” as the attribute type
    • Set the name to something appropriate, such as the same name as the Property Definition or “ValueList” or “SecurityGroups”
    • In the Value field, enter the names of the security groups you want included.  Separate the group names by commas (no spaces).  If you have groups whose names include spaces or commas, put them in quotes.  Click the green check to save.
    • Repeat to create another property dictionary and attribute for the Non-Production list
  3. Update Blueprints.
    • Edit your “production” blueprints by adding the “VCNS.SecurityGroup.Names.Production” custom property. Set the value to your default security group or leave it blank to require a selection. Be sure to check the “Prompt User” box. Click the green check to save.

      Add Custom Property to Blueprint
      Add Custom Property to Blueprint
  4. Test
    • Submit a request for the affected blueprint and verify that the dropdown list of security groups looks like you expect it to. Remember, that unlike many other custom properties in vCAC (eg: Network Profiles), you CAN have multiple versions of this one and display different lists.

      Dropdown list of Security Groups
      Dropdown list of Security Groups
    • After a VMis provisioned, verify in the vSphere Web Client that ithas been assigned to the expected security group

      VM added to Security Group
      VM added to Security Group

Next

In the next parts of this series, I plan to address the problems of maintaining the dropdown list manually and having a single security group per machine.

Many thanks to my friend Grant Orchard for his article on selecting a security group in a blueprint . It was the inspiration for this series.

Connecting vRealize Automation Gugent in a Distributed deployment – some notes

Configuring a distributed vCAC 6.x or vRealize Automation 6.2 installation, ran into a few issues and thought I’d document them.

  • The Gugent points to the vCAC IaaS Manager Service, not the vCAC Web/Model Manager
  • Test by browsing to https://[vcacmanager]/VMPS
  • If you are using vCNS or NSX as your load balancer, use these settings for the virtual address (these worked for me):
    • Application Profile: TCP, no persistence
    • Pool: IP-HASH algorithm, Monitor: NONE.  One enabled member, port 443, not transparent
    • Virtual Server: TCP 443, Pool and App Profile from above
  • Confirm the Gugent is working properly before configuring a template for Application Services

NSX-v and vCNS Coexistence

It may or may not be apparent, but NSX for vSphere is in many ways the next version of vCNS. In my lab, I’ve attempted to keep vCNS while adding NSX to the same vCenter server. The license key or configuration apparently overlap; if vShield Manager boots up first, NSX indicates that it’s not licensed. If NSX manager boots first, the vShield Manager states that it’s not licensed.

I did not, but should have, performed an upgrade from vCNS to NSX and now will have to add NSX Edge Gateways to replace the vShield Edges.