Contact Free trial Login

Gateway Startup Encryption in Mule 3

Gateway startup encryption allows you to encrypt sensitive information stored by the runtime such as policies, contracts, and the required credentials to configure the connection between your Mule application and Anypoint Platform.

Configuring the Runtime to Use Encryption

You can encrypt your Anypoint Platform credentials (client ID, client secret, and proxy password) using a 16-characters long encryption key, and pass this encryption key to your runtime during start-up through the anypoint.platform.encryption_key property so that the runtime can decrypt and use your encrypted credentials:

$MULE_HOME/bin/mule start -Danypoint.platform.encryption_key=MyEncryptionKey1

While the runtime is starting it checks for an encryption key. Then it gets the client ID and client secret values from its wrapper.conf file.

Encrypting Credentials using the Agent

To enable the runtime to use encryption you need to pass the argument encryption-key to the agent using your encryption key as value. The agent then encrypts the client ID and Secret.

When starting the runtime, you need to pass the encryption key using the anypoint.platform.encryption_key property as instructed above.

Gateway Encryption Tool

The gateway encryption tool provides a way to inspect the policy files that Mule runtime engine 3.9.3 and later encrypts. It also provides a way to encrypt offline policies, and pass encrypted client credentials to the runtime.

The tool has two modes, policy and property.

Policy

This mode encrypts and decrypts the policy XML files.

To encrypt a policy file:

java -jar gateway-encryption-tool.jar policy <encrypt|decrypt> <key> <input_policy_file> <output_policy_file>

This tool takes the policy passed in <input_policy_file> and encrypts it using the encryption key passed in <key> and stores the result in the file in <output_policy_file>.

This tool does not verify the validity of the policy.

Property

This mode encrypts and decrypts the values of the properties set in the wrapper.conf file.

To encrypt a property of you configuration file:

java -jar gateway-encryption-tool.jar property <encrypt|decrypt> <key> <input_value>

This tool takes the key passed in <key> and use it to encrypt the value passed in <input_value>.

When using the decrypt option, it is possible that your terminal might interpret some of the characters of the encrypted value. To avoid this scenario, wrap the encrypted value in single quotation marks:

java -jar gateway-encryption-tool.jar property decrypt 1234567812345678 '![FefVUnvDJpbXnUvrGAEezg==]'

Policies Encryption

Some of your policies may contain sensitive data. If the runtime is configured to use an encryption key, the runtime encrypts all online policies before storing them in disk. The same applies to the policy cache that is generated for the same reason. When a policy that has been encrypted is open, instead of seeing a normal XML file, the file will look like this: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kv4Dha5jQM15uKP/22fMrMkKljGEhApKlhBwevlb542TeXWETlaRU8sZpXLscrLPCHiU
XskWI+xK19uVgofmK88iyhWr3gdYY5Aefvdj6Lxr/MMVgve4kYpd7jJpYycS9GzObPIyaOEvL5DG
Hvw=]

If you need to debug or troubleshoot your policies configuration, you can use the policy mode of the gateway encryption tool to recover the non-encrypted XML.

The runtime does not automatically encrypt offline policies. However, if you provide the offline policy files already encrypted, the runtime is able to decrypt them and use them normally.

When running in clusters, offline policies remain encrypted in the node in which the policy was originally deployed, assuming you configured that node to use encryption. When propagating to other nodes, the policy will follow your node’s configuration. If the node is configured to use encryption, then the policy will propagate encrypted to that node. If the node is not configured to use encryption, the policy will propagate unencrypted to that node.