Spring config server renew vault token auth

2.5k views Asked by At

I am using spring config server with 2 backends : git and vault (for secrets), and i have a clients apps that connect to the config server to get distant configuration (git and vault).

I have this configuration: config server

    server:
      port: 8888
    
    spring:
      profiles:
        active: git, vault
      cloud:
        config:
          server:
            vault:
              host: hostName
              kvVersion: 1
              order: 1
              backend: secret/cad
              scheme: https
              port: 443
            git:
              order: 2
              uri: [email protected]_repo
              ignoreLocalSshSettings: true
              force-pull: true
              deleteUntrackedBranches: true
              privateKey: key

and client side

    spring:
      application:
        name: my_app_name
    
      cloud:
        vault:
          config:
            uri: http://localhost:8888
            token: s.token
            fail-fast: true

With this way I have to change the token for every client every day (token expire 24h). Is there a way to renew the token with this configuration or there is another way to authenticate to the vault?

1

There are 1 answers

0
Vy Do On
spring.cloud.vault:
    config.lifecycle:
        enabled: true
        min-renewal: 10s
        expiry-threshold: 1440m
        lease-endpoints: Legacy

1440 minutes = 24h

Reference: https://cloud.spring.io/spring-cloud-vault/reference/html/#vault-lease-renewal