UCSD - Access VM Credentials Set in Catalog

Version 6
    Task Name

    In UCSD the VM credentials for a user can be auto generated.  This examples uses root, but it could be any other user.  The credentials are accessible by the end user via a pop up screen.  This task will retrieve the auto generated password and make it available in a workflow for further processing (ssh / custom e-mail to user).

    Description

     

    Prerequisites

    Minimum UCSD version: 5.4.0.2

    CategoryCustom task
    Components
    User Inputs

     

    User Output

    Instructions for Regular Workflow Use:

    Instructions for Regular Workflow Use:

    1. Download the attached .ZIP file below to your computer. *Remember the location of the saved file on your computer.
    2. Unzip the file on your computer. Should end up with a .WFD file.
    3. Log in to UCS Director as a user that has "system-admin" privileges.
    4. Navigate to "Policies-->Orchestration" and click on "Import".
    5. Click "Browse" and navigate to the location on your computer where the .WFD file resides. Choose the .WFD file and click "Open".
    6. Click "Upload" and then "OK" once the file upload is completed. Then click "Next".
    7. Click the "Select" button next to "Import Workflows". Click the "Check All" button to check all checkboxes and then the "Select" button.
    8. Click "Submit".
    9. A new folder should appear in "Policies-->Orchestration" that contains the imported workflow. You will now need to update the included tasks with information about the specific environment.

     

    A thank you goes out to: Logesh Kandasamy and Shankar Varanasy

     

    The catalog setting for the credentials (Template password):

     

    Screen Shot 2016-03-07 at 8.11.18 AM.png

     

    The end user access:

     

    Screen Shot 2016-03-07 at 8.10.43 AM.png

     

    The password auto generated password:

    Screen Shot 2016-03-07 at 8.10.49 AM.png

     

    The workflow:

     

    Screen Shot 2016-03-07 at 8.09.47 AM.png

     

    The workflow execution:

     

    Screen Shot 2016-03-07 at 8.09.35 AM.png

     

    The custom task:

     

    importPackage(com.cloupia.model.cIM);

    importPackage(com.cloupia.service.cIM.inframgr);

     

     

    //var vpw = VMUserData(input.vmId);

    //var pwd1 = vpw.getCustomPassword();

     

     

    var vpw = VMViewUtils.getVMUserData(input.vmId);

    var pwd1 = vpw.getCustomPassword();

    var pwd2 = vpw.getTemplatePassword();

    var user1 = vpw.getCustomUser();

    //

    // comment out below lines in production code

    //

    logger.addWarning("Comment out below logger lines in production code");

     

     

    logger.addInfo("Password 1 for the VM "+input.vmId+" is : "+pwd1);

    logger.addInfo("Password 1 for the VM "+input.vmId+" is : "+pwd2);

    logger.addInfo("User 1 for the VM "+input.vmId+" is : "+user1);

     

     

    logger.addWarning("Comment out above logger lines in production code");

    //

    // comment above below lines in production code

    //

     

     

     

     

    output.vmPassword1 = pwd1;

    output.vmPassword2 = pwd2;

    output.User1 = user1;

     

     

    The SQL from a SQL trace helping me trace down the library call:

     

     

    SELECT 'com.cloupia.model.cIM.VMUserData' AS NUCLEUS_TYPE,`A0`.`ACTIVEVMAPPCOST`,`A0`.`APPCATEGORYID`,`A0`.`CATALOGID`,`A0`.`CHARGEFREQUENCY`,`A0`.`COMMENTS`,`A0`.`COSTMODELID`,`A0`.`CREDENTIALSHARE`,`A0`.`CUSTOMPASSWORD`,`A0`.`CUSTOMUSER`,`A0`.`DELETEVMTASKEXECOUNT`,`A0`.`DELETIONTIME`,`A0`.`DELIVEREDDELETEMSGCOUNT`,`A0`.`DELIVEREDLEASEMSGCOUNT`,`A0`.`GROUPID`,`A0`.`INACTIVEVMAPPCOST`,`A0`.`KEYNAME`,`A0`.`LEASEEXPTASKEXECOUNT`,`A0`.`OLDVDCID`,`A0`.`OS`,`A0`.`OTHERAPPS`,`A0`.`OTHEROS`,`A0`.`PROVISIONEDTIME`,`A0`.`RESOURCEUSERNAME`,`A0`.`SCHEDULEDTERMINATIONTIME`,`A0`.`SERVICEREQUESTID`,`A0`.`SLAPOLICYID`,`A0`.`TEMPLATEPASSWORD`,`A0`.`TEMPLATEUSER`,`A0`.`USERLABEL`,`A0`.`VMAPPCOSTCHARGEFREQUENCY`,`A0`.`VDCID`,`A0`.`VMID`,`A0`.`VMNAMEINCONTAINER`,`A0`.`VMROLEINCONTAINER`,`A0`.`VMUSERDATA_ID` FROM `VMUSERDATA` `A0` WHERE `A0`.`VMID` = 1945

     

     

    In the custom task the DOC button can be activated and deliver the java documents:

     

    Screen Shot 2016-03-07 at 8.23.01 AM.png

     

    The VM View Utils:

     

    Screen Shot 2016-03-07 at 8.23.30 AM.png

     

    The get VM user data:

     

    Screen Shot 2016-03-07 at 8.23.51 AM.png

     

    The options for the library call:

     

    Screen Shot 2016-03-07 at 8.24.31 AM.png

     

    There is also an API call as an alternative:

     

    Screen Shot 2016-03-07 at 8.28.30 AM.png

     

    The API call with VM id:

     

    Screen Shot 2016-03-07 at 8.29.53 AM.png

     

    The API execution:

     

    Screen Shot 2016-03-07 at 8.30.05 AM.png

     

    The password is jammed (possible way to un jam it):

     

     

    > importPackage(com.cloupia.lib.util);

    > var str = "SDlnbncwUXQ=“;

    > var str2 = Base64Coder.decodeString(str);

    > str2; H9gnw0Qt