Page History
...
- The job encrypts a secret using the target AgentAgents' s certificate.
- A new variable is added to the workflow that holds the encrypted secret.
Examples:
For details see JS7 - How to encrypt and decrypt using Unix Shell
Code Block language bash title Example for Encryption using Unix Shell collapse true # encrypt secret result=$($JS7_AGENT_HOME/bin/js7_encrypt.sh --cert=$JS7_AGENT_CONFIG_DIR/foobar.crt --in="12345678") # forward "new_var" workflow variable holding the encrypted result echo "new_var=$result" >> $JS7_RETURN_VALUES
For details see JS7 - How to encrypt and decrypt using Windows Shell
Code Block language powershell title Example for Encryption using Windows Shell collapse true @rem encrypt secret and return result with JS7_ENCRYPT_VALUE environment variable call "%JS7_AGENT_HOME%\bin\js7_encrypt.cmd" "--cert=%JS7_AGENT_CONFIG_DIR%\foobar.crt" "--in=12345678" @rem forward "new_var" workflow variable holding the encrypted result echo new_var=%JS7_ENCRYPT_VALUE% >> %JS7_RETURN_VALUES%
For details see JS7 - How to encrypt and decrypt using PowerShell
Code Block language powershell title Example for Encryption using PowerShell collapse true # encrypt secret and return result with JS7_ENCRYPT_VALUE environment variable $result = Invoke-JS7Encrypt -CertificatePath $env:JS7_AGENT_CONFIG_DIR/foobar.crt -Value '12345678' -JavaLib $env:JS7_AGENT_HOME/lib # forward "new_var" workflow variable holding the encrypted result "new_var=$result" | Out-File $env:JS7_RETURN_VALUES -Append
...
- Workflow variables are provided from environment variables for shell jobs, see JS7 - Job Instruction.
- The job decrypts a secret using the current AgentAgents' s Private Key.
Examples:
Code Block language bash title Example for Decryption using Unix Shell collapse true # encrypted result is assumed being available from NEW_VAR environment variable secret=$($JS7_AGENT_HOME/bin/js7_decrypt.sh \ --key=$JS7_AGENT_CONFIG_DIR/private/foobar.key \ --in="$NEW_VAR") echo $secret
Code Block language powershell title Example for Decryption using Windows Shell collapse true @rem encrypted result is assumed being available from NEW_VAR environment variable call "%JS7_AGENT_HOME%\bin\js7_decrypt.cmd" ^ "--key=%JS7_AGENT_CONFIG_DIR%\private\foobar.key" ^ "--in=%NEW_VAR%" @echo %JS7_DECRYPT_VALUE%
Code Block language powershell title Example for Decryption using PowerShell collapse true # encrypted result is assumed being available from NEW_VAR environment variable $secret = Invoke-JS7Decrypt -Value $env:NEW_VAR -KeyPath $env:JS7_AGENT_CONFIG_DIR/private/foobar.key -JavaLib $env:JS7_AGENT_HOME/lib Write-Output $secret
...
- The job encrypts a secret using the target AgentAgents' s certificate and stores the encrypted result to a Job Resource variable.
Examples:
For details see JS7 - How to update a Job Resource using Unix Shell
Code Block language bash title Example for Encryption using Unix Shell collapse true $JS7_AGENT_HOME/bin/js7_set_job_resource.sh \ --url=http://joc-2-0-primary:7446 \ --controller-id=controller \ --user=root \ --password=root \ --job-resource=/ProductDemo/Variables/pdBusinessSecret \ --key=businessSecret \ --value='12345678' \ --env-var=BUSINESS_SECRET \ --encrypt-cert=$JS7_AGENT_CONFIG_DIR/foobar.crt
For details see JS7 - How to update a Job Resource using PowerShell
Code Block language bash title Example for Encryption using PowerShell collapse true Set-JS7JobResource ` -Path /ProductDemo/Variables/pdBusinessSecret ` -Key 'businessSecret' ` -Value '12345678' ` -EnvVar 'BUSINESS_SECRET' ` -EncryptCertificatePath $env:JS7_AGENT_CONFIG_DIR/foobar.crt ` -JavaLib $env:JS7_AGENT_HOME/lib
...
- An external application encrypts a configuration file using the target AgentAgents' s certificate. The encrypted configuration file is added to a Job Resource.
- When the Job Resource is assigned a workflow or job then JS7 takes care to transfer the Job Resource to all Agents that operate related jobs.
Examples:
For details see JS7 - How to update a Job Resource using Unix Shell
Code Block language bash title Example for Encryption using Unix Shell collapse true ./js7_set_job_resource.sh \ --url=http://joc-2-0-primary:7446 \ --controller-id=controller \ --user=root \ --password=root \ --job-resource=/ProductDemo/Variables/pdConfigurationData \ --key=configurationData \ --file=application.conf \ --env-var=CONFIGURATION_DATA \ --encrypt-cert=foobar.crt
For details see JS7 - How to update a Job Resource using PowerShell
Code Block language powershell title Example for Encryption using PowerShell collapse true Set-JS7JobResource ` -Path /ProductDemo/Variables/pdConfigurationData ` -Key 'configurationData' ` -File application.conf ` -EnvVar 'CONFIGURATION_DATA' ` -EncryptCertificatePath foobar.crt ` -JavaLib /js7/js7.encryption/lib
...
It is possible that jobs access an AgentAgents' s Private Key and SSL Certificate that are used to secure HTTPS connections, see JS7 - Agent HTTPS Connections. This requires the AgentAgents' s SSL Certificate certificate to be created with the dataEncipherment
key usage option. Many users consider it more secure to use separate keys for HTTPS connections and for encryption/decryption of secrets.
...