-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Salt-master doesn't renew vault token #51986
Comments
ping @carlpett seems you added a lot of the vault features. do you have any ideas here? |
It has been a few years, so somewhat foggy memory, but if I remember correctly, at the time of the initial implementation, we required a root token since Vault did not support granting some privilege needed. Since root tokens do not expire, renewal wasn't required. Since it seems this is no longer the case, it would be a very reasonable addition to ensure non-root tokens work well, in order to discourage using them. I'm myself no longer in a position where I use either Vault or Saltstack, sadly, so my ability to contribute this is very limited. |
thanks for the input i really appreciate it :) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue. |
Reviving this as it is still an issue we are affected by. |
Thank you for updating this issue. It is no longer marked as stale. |
In the meantime, maybe it can be good to improve documentation of salt/vault module setup. In my case, I'm using I also face secret_id expiration in my case and salt starts logging messages as following when the secret_id expire : |
@ptitdoc Did you find any resolution to this ? As I cannot get salt working with vault with token or approle at the moment due to this issue. |
I's currently working, I only need to reset the secret-id every month because of the TTL using So there is two ways around: 1/ Change the secret_id_ttl by providing a ttl in seconds but it is buggy. If you exceed 999999 seconds, it will just show 768h of ttl when writing a new secret-id: 2/ Set the secret_id_ttl to zero to disable completely ttl: |
@ptitdoc thanks, still trying to get this working myself. What do you have in /etc/salt/master.d/vault.conf to get this working and what's the policy you have in vault for the role? I'm getting the message of "Forbidden" when the minion is requesting a token from the master and am unset if it's the master refusing the minion or Vault upstream. |
Yeah that is hard to troubleshoot, and I struggled to make it work because hashicorp vault configuration is somehow hard to understand. My vault.conf look like this:
I loaded the following policy for the approle:
|
@ptitdoc Thanks. How did you set up that policy and approle in vault to get salt to be happy with it ? I've copied yours to test and salt is reporting "Bad: Request" with no other debug I can find atm. |
I don't really remember but there are several ways, including pushing a vault policy using salt states I followed a mix of several tutorials and vault documentation such as: Importing a policy file can be done like this: Associating policies if your already created your approle can be done using: |
@ptitdoc Thanks, I've been though most of them, though I think there are differences between a locally installed vault and https://portal.cloud.hashicorp.com as no policy I've tried is allowing the creation of tokens it seems |
@ptitdoc vault is not buggy, you need to increase the max_lease_ttl for your auth backend in vault if you want to get longer valid secrets than the default 768h This issue is talking about renewal of tokens in case the ttl of the token is less than the possible max_ttl of the given auth backend so that saltstack could request to extend the lifetime of the token. Expired secrets(the
I don't think this is an issue but rather a feature request. The approle method does not renew anything it just does a login to vault with the given role_id:secret_id and requests a new token. The |
Unfortunately there are no good docs for setting up Salt with vault. The debug output on the master when things don't work is dismal. Currently using approle for authentication, running salt-call -l debug vault.read_secret somepath/somesecret throws the following on the master:
It seems like it's having a problem creating a new token, but using the vault command line tool with the approle credentials works just fine. I think salt's broken, but there isn't enough debug output to tell what's going on exactly, and I'm not interested in downgrading the vault server to use HTTP so I can tcpdump it. |
I should add that I've put it into token auth mode and tried both an issued token as well as the root token and I get the same results. |
@darkpixel The fact that you have
My investigation lead that this makes the token creation to fail with an error "unknown role .." |
Description of Issue/Question
Vault allows for an issued token to be renewed while it is still active. When the salt-master is configured to use token auth, it does not attempt to renew the token, instead, it lets it expire and then fail.
This seems like poor behavior, especially since the other auth method
approle
appears to validate if it's expired and request a new token. (older versions of salt do not support approle).It would be beneficial if the salt-master monitored the remaining time to live of it's configured token and renew'd it.
Setup
(Please provide relevant configs and/or SLS files (Be sure to remove sensitive info).)
Steps to Reproduce Issue
Provision a token with the appropriate polices, wait until the ttl expires, be unable to access vault.
Versions Report
(Provided by running
salt --versions-report
. Please also mention any differences in master/minion versions.)The text was updated successfully, but these errors were encountered: