vault icon indicating copy to clipboard operation
vault copied to clipboard

vault ssh helper is unable to verify otp with vault server - 403 error

Open grahamsk opened this issue 10 years ago • 6 comments

Hi,

I tried the freenode channel but it was quiet so posting here instead. A brief summation of what's happening: I'm trying to set up vault ssh helper in AWS and having a problem when vault ssh helper tries to verify an otp with vault server - Example is:

{ "response": { "redirect": "", "data": null, "secret": null }, "request": { "remote_address": "{MACHINE RUNNING VAULT SSH AGENT/HELPER", "data": { "otp": "{OTP PASS}" }, "path": "ssh/verify", "client_token": "", "operation": "update" }, "auth": { "metadata": null, "policies": null, "display_name": "" }, "error": "403Forbidden: 403 Forbidden\n\tstatus code: 403, request id: {REQUEST_ID}", "type": "response", "time": "2016-01-22T09:55:57Z" }

Could someone please help? I thought ssh/verify was an unauthenticated endpoint - I am using Vault v0.5.0-dev (e59a049f4260189588a4635a59461d0306783baf) so brand new basically.

Thanks in advance. If further information is required please let me know.

grahamsk avatar Jan 23 '16 00:01 grahamsk

Hi there,

Sorry you're having trouble. verify is indeed an unauthenticated path. Can you paste the output of "vault mounts" and your configuration file?

jefferai avatar Jan 23 '16 01:01 jefferai

Thanks for the fast response! Info is as follows: vault mounts:

Path Type Default TTL Max TTL Description cubbyhole/ cubbyhole n/a n/a per-token private secret storage secret/ generic system system generic secret storage ssh/ ssh system system
sys/ system n/a n/a system endpoints used for control, policy and debugging

Config file for server:

backend "s3" { bucket = "{s3_bucket_name}" access_key = "{blank as using IAM role}" secret_key = "{blank as using IAM role}" region = "{Region}" }

listener "tcp" { address = "0.0.0.0:8200" tls_disable = 1 }

A bit of further info: I run this when trying to ssh into a machine running vault-ssh-helper: {User}@{HOST}:~# vault ssh -role {Role_Name} {User}@{IP} I get: Failed to establish SSH connection:exit status 5

Previously I got an exit status 6 which I figured out was due to the fact that I hadn't ssh'ed into the machine. I solved this using StrictHostKeyChecking no in ssh_config in order to get it automated.

grahamsk avatar Jan 23 '16 02:01 grahamsk

Is Vault running behind ELB or something? Because this error:

"error": "403Forbidden: 403 Forbidden\n\tstatus code: 403, request id: 10B117C0DE7D69D2",

is not an error Vault produces. The only place I can find it is in one of the AWS libraries.

jefferai avatar Jan 23 '16 04:01 jefferai

Since you're using S3, my guess is that something is going wrong during the verify when it's trying to do a lookup on an S3 path.

Can you test out a write, read, and delete in either the cubbyhole/ or secret/ backends and make sure that's working? I'd be pretty surprised if the rest of your storage is working properly but this isn't, as it's all just prefixed.

Also -- you are using a self-built version. How did you build it? You should use "make dev" and run the resulting binary (in bin/). This will ensure that your deps are the correct versions.

jefferai avatar Jan 23 '16 04:01 jefferai

I just checked and it was s3 related as you suggested. I'd given s3:Get_, s3:Put_ & s3:List_. s3:Delete_ was missing which was causing the issue.

Thanks for your help Jeff. I really appreciate it.

grahamsk avatar Jan 23 '16 12:01 grahamsk

Glad it's fixed!

jefferai avatar Jan 23 '16 15:01 jefferai