how to hide the passsword in the log file when the package fails.

  • I have an encryption and decryption package and the keyId public and private from GPG coming from config file of package. for testing purpose provided incorrect key id in the config file that will fail the package as gpg didn't find the local key and in the log file captured complete command with passphrase too. do we have any option to hide passphrase and keyid's in the log file.

     

    Here is the log file

    Source: Execute Process Task

    Description: In Executing "C:\Program Files (x86)\GNU\GnuPG\gpg2.exe" " --batch  --yes  --passphrase Blockqite354* -r 76385G77"  The process exit code was "2" while the expected was "0".

    End Error

    DTExec: The package execution returned DTSER_FAILURE (1).

    Started:  3:39:30 PM

    Finished: 3:39:31 PM

    Elapsed:  0.625 seconds

    Fri 09/13/2019

    03:39 PM

    *** "TimeDetails data Genrates files to ADPGV" process failed

    *** Exit Code From SSIS package: 1

     

    Here is the batch file

     

    SETLOCAL

    REM Setting up variables

    SET DTEXec="Path for Dtexec"

    SET Desc="Test File"

    SET Folder=D:\TestSET logdir=%Folder%\Logs

    SET File="%Folder%\---.dtsx"

    SET Config="%Folder%\---.dtsConfig"

    SET CommandFile="%Folder%\---.conf"

    REM =================================================================================

    ECHO Execution of %Desc% started (initiated by: %userdomain%\%username%)

    FOR /F "USEBACKQ TOKENS=2,3,4 DELIMS=/ " %%I IN (DATE/T) DO SET RUNDATE=%%K%%I%%J

    FOR /F "TOKENS=1-4 DELIMS=: " %%A IN ('TIME /T') DO (SET CURRENTTIME=%%A%%B%%C)

    SET LOG=%logdir%\%RUNDATE%_%CURRENTTIME%_%Desc%.log

    set LOG="%LOG:"=%"

    ECHO Execution of %Desc% started (initiated by: %userdomain%\%username%)> %LOG%

    Date/t >> %LOG%

    Time/t >>  %LOG%

    %DTEXec% /file %File% /conf %Config% /CommandFile %CommandFile% >> %Log%

    SET /a RET=%ERRORLEVEL%

    IF "%RET%" NEQ "0" (

    Date/t >> %LOG%

    Time/t >> %LOG%

    ECHO *** %Desc% process failed >> %LOG%

    ECHO *** %Desc% process failed

    )

    IF "%RET%" EQU "0" (

    :SUCCESS

    Date/t >> %LOG%

    Time/t >>  %LOG%

    ECHO *** %Desc% process completed successfully >> %LOG%

    ECHO *** %Desc% process completed successfully

    )

    ECHO *** Exit Code From SSIS package: %RET% >> %LOG%

    ECHO *** Exit Code From SSIS package: %RET%

    EXIT /B %RET%

    ENDLOCAL

     

  • You can use this technique: https://www.codeproject.com/Articles/22055/Automated-File-Decryption-Using-GnuPG-and-C

    Instead of creating a batch file and executing the batch file - you redirect the input and output to variables.  Another option is to use a .NET wrapper and perform the process in a script task.

    https://www.nuget.org/packages/Gpg.NET/

    https://wiki.gnupg.org/APIs

    https://github.com/gpgme-sharp/gpgme-sharp

    The first option is probably the easiest to implement.

     

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply