2016-12-22 12 views
1

application.ymlで暗号化されたプロパティでspring-cloud-config-serverを実行しようとしています。spring-cloud-config-serverでの暗号化

--- 

server: 
    port: 8888 

spring: 
    cloud: 
    config: 
     server: 
     git: 
      uri: file:/Users/gadams/git/cs-config 

encrypt: 
    key-store: 
    location: classpath:/config-server.jks 
    password: password 
    alias: alias 
    secret: secret 

security: 
    user: 
    password: '{cipher}encryptedPassword' 

私は、起動時に次のエラーを取得する:

java.lang.IllegalStateException: Cannot decrypt: key=security.user.password 
    at org.springframework.cloud.bootstrap.encrypt.EnvironmentDecryptApplicationInitializer.decrypt(EnvironmentDecryptApplicationInitializer.java:201) ~[spring-cloud-context-1.1.6.RELEASE.jar:1.1.6.RELEASE] 
    at org.springframework.cloud.bootstrap.encrypt.EnvironmentDecryptApplicationInitializer.decrypt(EnvironmentDecryptApplicationInitializer.java:165) ~[spring-cloud-context-1.1.6.RELEASE.jar:1.1.6.RELEASE] 
    at org.springframework.cloud.bootstrap.encrypt.EnvironmentDecryptApplicationInitializer.initialize(EnvironmentDecryptApplicationInitializer.java:95) ~[spring-cloud-context-1.1.6.RELEASE.jar:1.1.6.RELEASE] 
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener$DelegatingEnvironmentDecryptApplicationInitializer.initialize(BootstrapApplicationListener.java:333) ~[spring-cloud-context-1.1.6.RELEASE.jar:1.1.6.RELEASE] 
    at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:635) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE] 
    at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:349) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:313) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE] 
    at com.collegescheduler.ConfigServerApplication.main(ConfigServerApplication.java:12) [bin/:na] 
Caused by: java.lang.UnsupportedOperationException: No decryption for FailsafeTextEncryptor. Did you configure the keystore correctly? 
    at org.springframework.cloud.bootstrap.encrypt.EncryptionBootstrapConfiguration$FailsafeTextEncryptor.decrypt(EncryptionBootstrapConfiguration.java:152) ~[spring-cloud-context-1.1.6.RELEASE.jar:1.1.6.RELEASE] 
    at org.springframework.cloud.bootstrap.encrypt.EnvironmentDecryptApplicationInitializer.decrypt(EnvironmentDecryptApplicationInitializer.java:193) ~[spring-cloud-context-1.1.6.RELEASE.jar:1.1.6.RELEASE] 
    ... 9 common frames omitted 

私はorg.springframework.cloud:spring-cloud-dependencies:Camden.SR3を使用しています。設定サーバーで春のセキュリティユーザーのパスワードを暗号化するにはどうすればよいですか?

+0

をあなたは私の答えをチェックしましたか? –

答えて

0

ログのキーストア設定に問題があります。

keytoolを使用して、キーストアのパス/シークレット/エイリアスを最初に検証します。

+0

キーストア設定は、githubの設定で暗号化されたプロパティに対して正常に動作します。ブートストラップ段階では、設定サーバーのapplication.ymlのプロパティーでは機能しません。 – gadams00

0

prerequisitesを尊敬しましたか?

前提条件:(それは デフォルトでありません) あなたのJVMにインストールされ、完全な強度JCEを必要暗号化と復号化機能を使用します。 Oracleから「Java Cryptography Extension(JCE) 無制限強度管轄ポリシーファイル」をダウンロードし、インストールのために 指示に従います(基本的に、JRE lib/securityディレクトリの2つのポリシーファイルをダウンロードしたものに置き換えてください)。

また、あなたのpom.xmlを持っている必要があります。

<dependency> 
    <groupId>org.springframework.security</groupId> 
    <artifactId>spring-security-rsa</artifactId> 
</dependency>