-
Notifications
You must be signed in to change notification settings - Fork 129
rabbitmq jasypt encryption update #669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
DaanHoogland
wants to merge
1
commit into
apache:4.22
Choose a base branch
from
shapeblue:ghi13352-rabbitmqEncryption
base: 4.22
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+26
−6
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -162,10 +162,20 @@ changes can control the behaviour. | |||||||||||||||||||
|
|
||||||||||||||||||||
| The ``eventNotificationBus`` bean represents the | ||||||||||||||||||||
| ``org.apache.cloudstack.mom.rabbitmq.RabbitMQEventBus`` class. | ||||||||||||||||||||
|
|
||||||||||||||||||||
| If you want to use encrypted values for the username and password, you have to include a bean to pass those | ||||||||||||||||||||
| as variables from a credentials file. | ||||||||||||||||||||
|
|
||||||||||||||||||||
| .. note:: | ||||||||||||||||||||
| Older versions of this guide referenced | ||||||||||||||||||||
| ``org.jasypt.spring3.properties.EncryptablePropertyPlaceholderConfigurer``, which comes | ||||||||||||||||||||
| from the ``jasypt-spring3`` artifact. That artifact is not shipped with CloudStack and is | ||||||||||||||||||||
| not compatible with the Spring 5 used since CloudStack 4.x, so beans referencing it fail | ||||||||||||||||||||
| to load with a ``ClassNotFoundException``. Use | ||||||||||||||||||||
| ``com.cloud.utils.crypt.EncryptablePropertyPlaceholderConfigurer`` instead, which ships | ||||||||||||||||||||
| with CloudStack and works the same way. This bean also expects encrypted values to be | ||||||||||||||||||||
| wrapped as ``ENC(...)``, matching the convention used elsewhere in CloudStack. | ||||||||||||||||||||
|
|
||||||||||||||||||||
| A sample is given below | ||||||||||||||||||||
|
|
||||||||||||||||||||
| .. code:: bash | ||||||||||||||||||||
|
|
@@ -191,29 +201,39 @@ changes can control the behaviour. | |||||||||||||||||||
| </bean> | ||||||||||||||||||||
|
|
||||||||||||||||||||
| <bean id="environmentVariablesConfiguration" class="org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig"> | ||||||||||||||||||||
| <property name="algorithm" value="PBEWithMD5AndDES" /> | ||||||||||||||||||||
| <property name="algorithm" value="PBEWITHHMACSHA512ANDAES_256" /> | ||||||||||||||||||||
| <property name="passwordEnvName" value="APP_ENCRYPTION_PASSWORD" /> | ||||||||||||||||||||
| </bean> | ||||||||||||||||||||
|
|
||||||||||||||||||||
| <bean id="configurationEncryptor" class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor"> | ||||||||||||||||||||
| <property name="config" ref="environmentVariablesConfiguration" /> | ||||||||||||||||||||
| <property name="ivGenerator"> | ||||||||||||||||||||
| <bean class="org.jasypt.iv.RandomIvGenerator" /> | ||||||||||||||||||||
| </property> | ||||||||||||||||||||
| </bean> | ||||||||||||||||||||
|
|
||||||||||||||||||||
| <bean id="propertyConfigurer" class="org.jasypt.spring3.properties.EncryptablePropertyPlaceholderConfigurer"> | ||||||||||||||||||||
| <bean id="propertyConfigurer" class="com.cloud.utils.crypt.EncryptablePropertyPlaceholderConfigurer"> | ||||||||||||||||||||
| <constructor-arg ref="configurationEncryptor" /> | ||||||||||||||||||||
| <property name="location" value="classpath:/cred.properties" /> | ||||||||||||||||||||
| </bean> | ||||||||||||||||||||
| </beans> | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| Create a new file in the same folder called ``cred.properties`` and the specify the values for username and password as jascrypt encrypted strings | ||||||||||||||||||||
| Create a new file in the same folder called ``cred.properties`` and specify the values for | ||||||||||||||||||||
| username and password as jasypt encrypted strings, wrapped as ``ENC(...)``. | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Sample, with ``guest`` as values for both fields: | ||||||||||||||||||||
|
|
||||||||||||||||||||
| .. code:: bash | ||||||||||||||||||||
|
|
||||||||||||||||||||
| username=nh2XrM7jWHMG4VQK18iiBQ== | ||||||||||||||||||||
| password=nh2XrM7jWHMG4VQK18iiBQ== | ||||||||||||||||||||
| username=ENC(nh2XrM7jWHMG4VQK18iiBQ==) | ||||||||||||||||||||
| password=ENC(nh2XrM7jWHMG4VQK18iiBQ==) | ||||||||||||||||||||
|
|
||||||||||||||||||||
| ``PBEWithMD5AndDES``, used in earlier releases of this guide, is a weak algorithm and should | ||||||||||||||||||||
| not be used for new deployments; ``PBEWITHHMACSHA512ANDAES_256`` above is a stronger, | ||||||||||||||||||||
| future-proof alternative. Use the ``jasypt`` CLI tools (or any tool using the jasypt library) | ||||||||||||||||||||
| with the same algorithm, IV generator and ``APP_ENCRYPTION_PASSWORD`` to produce the | ||||||||||||||||||||
| encrypted values for ``cred.properties``. | ||||||||||||||||||||
|
Comment on lines
+232
to
+236
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| #. Restart the Management Server. | ||||||||||||||||||||
|
|
||||||||||||||||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this might not be needed