Automic Workload Automation

Expand all | Collapse all

How do I pass decrypted value from protected attribute on Promptset On Windows Agent to External Interpreter code block?

  • 1.  How do I pass decrypted value from protected attribute on Promptset On Windows Agent to External Interpreter code block?

    Posted Dec 27, 2018 06:41 PM

    Automic community,

     

    This question is in particular related to Windows Agent (Server 2012 R2, if it matters).


    How do I pass decrypted value from protected attribute on Promptset On Windows Agent to External Interpreter code?

     

    Given following attributes on Promptset on Custom Action

     

    username               --> &UNAME#
    password (protected)   --> &UPWD#



    Windows JOBS excerpt (my attempt with some ???? placeholders):

     

    &UC_JOBMD CMD="????? &UPWD#"
    :SET &decryptedPW# = ???

    :BEGIN_EXT_INT PYTHON

    user = '&UNAME#'
    pwd = '&decryptedPW#'

    access_resource(user, pwd)


    :END_EXT_INT PYTHON

     

    Do you have some pointers how to approach solution for this problem?

     

    I know if python code was part of external python file, I could pass it as input option parameters, like shown below, but how to make it work as part of embedded external interpreter code is not clear to me.

     

    &UC_JOBMD CMD="python D:/my-file.py --user '&UNAME#' --password '&UPWD#'"


  • 2.  Re: How do I pass decrypted value from protected attribute on Promptset On Windows Agent to External Interpreter code block?

    Posted Dec 28, 2018 02:29 PM

    I ended up solving issue on my own and wanted to share the solution with Automic Community.

     

    I had researched issue further and reviewed how some of the out-of-the box Automic Actions approach the problem.
    I found that following existing INCLUDE script helped to get around the issue (PCK.ITPA_SHARED.PRV.INCLUDE.DECRYPT_PASSWORD).

     

    Pre-requisites:
       Option "Batch" should be selected for Interpreter Type on WINDOWS JOBS object.

     

    Given following attributes on Promptset on Custom Action

     

    username               --> &UNAME#
    password (protected)   --> &UPWD#

     

    @echo off

    :INC PCK.ITPA_SHARED.PUB.INCLUDE.ATTACH
    :SET &UC4RB_ENCRYPTED_PASSWORD_TMP# = "&UPWD#"
    :INC PCK.ITPA_SHARED.PRV.INCLUDE.DECRYPT_PASSWORD

    :BEGIN_EXT_INT PYTHON
    import os

    user = '&UNAME#'
    pwd = os.getenv('UC4_DECRYPTED_PWD')

    # at this point variable pwd has decrypted value

    :END_EXT_INT PYTHON


  • 3.  Re: How do I pass decrypted value from protected attribute on Promptset On Windows Agent to External Interpreter code block?

    Posted Mar 18, 2019 08:33 AM

    Hi, Can you provide some documentation links for this Action packs



  • 4.  Re: How do I pass decrypted value from protected attribute on Promptset On Windows Agent to External Interpreter code block?

    Posted Mar 25, 2019 11:10 AM

    I don't think there is specific documentation exist on PCK.ITPA_SHARED.PRV.INCLUDE.DECRYPT_PASSWORD.

     

    It is part of shared libraries that is dependency for many other Action Packs.

    I just did some analyses how some other actions where using it and adapted for the the use within External Interpreter section for the scripts.

     

    ITPA Shared Action Pack