vRealize Automation DEM worker cannot connect to Orchestrator

In vRA 6.2, using vRO 6.0, you may find that the data collection and other vRO workflows fail with the error “You must have at least one properly configured vCenter Orchestrator endpoint that is reachable”.  The IaaS/Monitoring/Log will show which DEM worker threw the error.  When you check the DEM worker logs for that instance, if you find the message “Could not create SSL/TLS secure channel. —> System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel“, you have probably been affected by VMKB 2123455 and MS KB 3061588.

Although both articles seem to suggest that removing the offending patch will solve the problem, I think figuring out exactly which patch is rather awkward.  The easier fix is to apply a quick registry hack to your DEM workers (and wherever the vRA Designer runs).

  1. Logon as an account with admin rights (suggest the account your IaaS services run under)
  2. locate or add the key

    HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\
    KeyExchangeAlgorithms\Diffie-Hellman

  3. Add/update the DWORD value ClientMinKeyBitLength and set the value to 512 decimal (200 hex)
  4. Restart the DEM worker service

 

Notes:
The Microsoft patch sets the default minimum group size to 1024.  It appears that the vRO 6.0.x appliances use something less than that.  This registry hack indicates that SCHANNEL should accept keys as small as 512 bits.  I suggest only applying this to the necessary and affected machines since it does lower the bar for the DHE security requirements.

Thanks to Zach Milleson for reminding me that this workaround may not resolve everyone’s issue, depending on which MS patches are installed.  If this workaround doesn’t work for you, you may have to locate and remove the offending patch.  YMMV.

Pivotal Cloud Foundry vApp startup order workflow

After installing Pivotal Cloud Foundry (PCF) on vSphere, you’ll have a collection of at least 21 (probably closer to 60!) VMs with names that probably don’t match anyone’s convention.  Although, as noted in the PCF documentation, there is a correct order to starting up and shutting down the VMs in PCF, the installer does not configure a vApp so that we can control that order.  So, I dragged all the PCF VMs into a vApp and starting trying to determine which ones are in which role and quickly realized that it’s a pain.

Creating an AZ in Ops Manager on vSphere
Creating an AZ in Ops Manager on vSphere

As an aside, when you create your Availability Zone, you point it at a vSphere cluster and, optionally, a Resource Pool.  Unfortunately, if you specify a vApp Name instead of a Resource Pool name, BOSH will fail to deploy the VMs.  So, I’ve typically leave the Resource Pool field blank and then drag the VMs into a vApp post-deployment.

I put together a workflow that will help place the PCF VMs into correct startup/shutdown groups for you.

Example PCF VMNames
Example PCF VMNames

Instructions for Use

  1. Download the package from here
  2. Import the package into vRealize Orchestrator
  3. If you haven’t already, create a new vApp in your cluster and drag the Ops Manager, Ops Manager Director and all of the Elastic Runtime VMs into the vApp
  4. Run the “PCFvAppStartupOrder” workflow, select your new vApp as the input, click Submit
  5. If the PCF installation is scaled out to more VMs, just drag them to the vApp and rerun the workflow

How it works/What it does

  • The correct order is stored in a string array
  • The deployment, job and director custom fields are read for each VM in the vApp to get the VM’s assigned role
  • For the Ops Manager, the Notes field is read and if found, it is placed at the top of the startup sequnce
  • Unknown VMs are assigned a startup order higher than the last in the array.  This way, they start last and power-off first
  • Unknown VMs are those where the “deployment” field does not start with “cf”; with exceptions for Ops Manager (Notes field) and Ops Manager Director (“director” field value is “bosh-init”)

Additional suggestions and notes

  • Adjust the resources for the vApp based on VMware best practices and what makes sense for your environment
  • Use this at your own risk, there is no implied warranty

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

Weak Diffie-Hellman key in vRealize Orchestrator

{Edited Oct 19 2015 to reflect updated information inVMKB 2131619}

Recent versions of Google Chrome and Mozilla Firefox have begun rejecting connections using SSLv3 ciphers. Chrome complains of a weak ephemeral Diffie-Hellman public key, calling it a “disastrous misconfiguration”.  Firefox’s message also complains of a weak ephemeral Diffie-Hellman key in Server Key Exchange, but doesn’t foreshadow impending doom.

Interestingly (I guess), Internet Explorer 11, still happily connects…

Firefox message on vRO configuration page
Firefox message on vRO configuration page
Chrome message on vRO configuration page
Chrome message on vRO configuration page

Let’s fix Orchestrator so that we can use FF and Chrome…

Procedure

Confirmed this works on the vCO Appliance v5.5.2.1 through v6.0.2.1 and on the vRealize Automation Appliance v6.2.x

  1. SSH into the appliance
  2. Enter this to navigate to the configuration for the configuration page

    cd /etc/vco/configuration

  3. Enter this to backup the server.xml file

    cp ./server.xml ./serverxml.backup

  4. Use vi, or whatever you’re familiar with, to edit server.xml and replace the line that reads (as one line)

    ciphers=“TLS_DHE_RSA_WITH_AES_256_CBC_SHA,
    TLS_DHE_DSS_WITH_AES_256_CBC_SHA,
    TLS_RSA_WITH_AES_256_CBC_SHA,
    TLS_DHE_RSA_WITH_AES_128_CBC_SHA,
    TLS_DHE_DSS_WITH_AES_128_CBC_SHA,
    TLS_RSA_WITH_AES_128_CBC_SHA”

    with (again, as one line)

    ciphers=“TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
    TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
    TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
    TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA,
    TLS_ECDH_RSA_WITH_AES_256_CBC_SHA,
    TLS_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_AES_128_CBC_SHA,
    TLS_RSA_WITH_3DES_EDE_CBC_SHA”

  5. save the file
  6. Repeat the steps above for /etc/vco/app-server/server.xml
  7. Restart the vco-server and vcp-configurator services

    service restart vco-server
    service restart vco-configurator

That’s it, you should be good to go. There’s probably other VMware applications that will need the same treatment though.

Not Diffie-Hellman
Dang, wrong Hellman

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.