# vault read transit/keys/api
Key Value
cipher_mode aes-gcm
deletion_allowed false
derived false
keys map[1:1.447098432e+09]
min_decryption_version 0
name api
Also Cert Auth:
# vault read auth/cert/certs/web-api
.....
-----BEGIN CERTIFICATE-----
.....
-----END CERTIFICATE-----
display_name web-api
policies api
ttl 3600
And policy for it:
# vault policies api
path "transit/keys/api" {
policy = "read"
}
path "transit/encrypt/api" {
policy = "write"
}
path "transit/decrypt/api" {
policy = "write"
}
But when I do requests from other server:
# TOKEN=$(curl -s -X PUT --cert "/private/api-vault.pem" --key "private/api-vault.key" https://vault.local:8200/v1/auth/cert/login|awk -F, '{print $6}'|awk -F: '{print $3}'|sed 's/"//g')
# echo $TOKEN
b215b355-4726-a170-39b4-81e1ada65577
# curl -s -H "X-Vault-Token: $TOKEN" "https://vault.local:8200/v1/auth/token/lookup-self"
{"lease_id":"","renewable":false,"lease_duration":0,"data":{"creation_time":1450369653,"display_name":"web-api","id":"b215b355-4726-a170-39b4-81e1ada65577","meta":{"cert_name":"web-api","common_name":"api-vault"},"num_uses":0,"orphan":true,"path":"auth/cert/login","policies":["api","default"],"ttl":3600},"warnings":null,"auth":null}
# curl -s -H "X-Vault-Token: $TOKEN" "https://vault.local:8200/v1/transit/keys/api"
{"errors":["permission denied"]}
Also I can't to decrypt/encrypt!
Audit log:
{"time":"2015-12-17T16:29:57Z","type":"response","error":"permission denied","auth":{"display_name":"","policies":null,"metadata":null},"request":{"operation":"read","client_token":"","path":"transit/keys/api","data":null,"remote_address":"10.10.20.10"},"response":{"secret":null,"data":{"error":"hmac-sha256:9e83745982736489576234875628346587834938475"},"redirect":""}}
Also if I delete auth/cert/certs/web-api and add it again but without policies=api:
# TOKEN=$(curl -s -X PUT --cert "/usr/local/private/api-vault.pem" --key "/usr/local/private/api-vault.key" https://vault.local:8200/v1/auth/cert/login|awk -F, '{print $6}'|awk -F: '{print $3}'|sed 's/"//g')
# echo $TOKEN
c15yye45-8e9f-15a0-9e43-429ba9ad2a01
# curl -s -H "X-Vault-Token: $TOKEN" "https://vault.local:8200/v1/auth/token/lookup-self"
{"lease_id":"","renewable":false,"lease_duration":0,"data":{"creation_time":1450412945,"display_name":"cert-cc-web-api","id":"c15yye45-8e9f-15a0-9e43-429ba9ad2a01","meta":{"cert_name":"web-api","common_name":"web-api-vault"},"num_uses":0,"orphan":true,"path":"auth/cert/login","policies":["","default"],"ttl":3600},"warnings":null,"auth":null}