LoginSignup
0
0

[MuleSoft]セキュアプロパティの設定

Posted at

1. プロパティの暗号化

1.1 セキュアプロパティツールJarファイルをダウンロードします。

セキュアプロパティツールを使用してプロパティを暗号化するからダウンロードできます。

1.2 プロパティ(文字列)を暗号化します。

java -cp secure-properties-tool.jar com.mulesoft.tools.SecurePropertiesTool \
string \
encrypt \
Blowfish \
CBC \
mulesoft \
"password"

image.png

1.3 プロパティファイルに暗号化したプロパティを追加します。

properties-dev-secure.yamlファイルを作成し、暗号化したプロパティを![]で追加します。

tls:
  keystore:
    keyPassword: "![Qvg+/L86Aw7HxUc+4uszNw==]"
    password: "![Qvg+/L86Aw7HxUc+4uszNw==]"

2. Muleアプリケーションの設定

2.1 Anypoint Studioで「Mule Secure Configuration Properties Extension Module」を追加します。

「Search in Exchange」をクリックします。
image.png
「secure」で検索し「Mule Secure Configuration Properties Extension Module」をAddします。
image.png

2.2 1.3で作成したプロパティファイルを「Secure Configuration Properties」に登録します。

Global Elements画面で「Create」をクリックし、「Secure Properties Config」を検索します。
image.png
必要な情報を設定します。
image.png

	<secure-properties:config
		name="securePropertiesConfig"
		doc:name="Secure Properties Config"
		doc:id="66d97761-a04b-4323-9c8c-19f0adfc9677"
		file="properties-${env}-secure.yaml"
		key="${secure.key}">
		<secure-properties:encrypt
			algorithm="Blowfish" />
	</secure-properties:config>

2.3 登録したセキュアなプロパティファイル内の値にアクセスします。

セキュアなプロパティファイル内の値にアクセスするには、値が暗号化されていない場合でも ​secure::​ プレフィックスを使用する必要があります。

例えば以下のようにアクセスできます。

	<tls:context
		name="TLS_Context"
		doc:name="TLS Context"
		doc:id="95e36dfe-ba2a-43cf-b21c-5fe01e7124ab">
		<tls:key-store
			type="${tls.keystore.type}"
			path="${tls.keystore.path}"
			alias="${tls.keystore.alias}"
			keyPassword="${secure::tls.keystore.keyPassword}"
			password="${secure::tls.keystore.password}" />
	</tls:context>

3. Safely Hide Application Properties

mule-artifact.jsonを設定します。
image.png

4. Muleアプリケーションのデプロイ

Anypoint StudioでMule Appを実行する場合、JVM引数を設定する必要があります。

-M-Denv=dev -M-Dsecure.key=mulesoft

CloudHubへデプロイする際に、Runtime Manager画面にてPropertiesのenvとsecure.keyを入力します。
image.png
デプロイ後のPropertiesのsecure.keyとanypoint.platform.client_secretがSafely Hideになっていることが確認できます。
image.png

参考情報

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0