Is generating bearer token the only way to access API? #400
-
Hello. Is generating a token using basic auth and then using that token for limited time before renewing the only way to use the API? Is there maybe a way to disable API authentication or use predefined credentials for it? I use API through unix socket, so going through all these hoops is kinda excessive. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 15 replies
-
Hi, yes this is the only way. This is not only for security reasons but also for performance, using jwt we can read the user and the permissions from the token, if we use basic auth, as before 2.0, we have to do a data provider query to get permissions for each request. We now have authentication and authorization, before 2.0 we had only authentication, we cannot easily revert back to the old model, sorry |
Beta Was this translation helpful? Give feedback.
-
Yeah, they have a good setup for sure. The sort of flow I was thinking of would be something like https://learn.hashicorp.com/tutorials/vault/approle. I like that it spells out which parts are human (e.g., provisioning the approle auth and generating a role + policy) vs. those which would be fully automated. I also like that they don’t tie an approle to a user account, so you can just generate a very granular API endpoint that can only do a fixed number of operations. And of course, my favorite, being able to generate tokens with a custom expiry time (including never-expire tokens) 😊
But all that flexibility will come with a cost. I mean, Vault’s entire purpose is secret management, so of course it’s very robust and highly configurable. It could be an immense undertaking to try and get even half the functionality they’ve built. I wouldn’t be disappointed to see something like this, but I imagine it would be a huge time sink.
If I get time I’ll look into it, but I don’t know if/when I could contribute anything massive like that ☹
From: Nicola Murino ***@***.***>
Sent: Tuesday, May 25, 2021 12:58
To: drakkan/sftpgo ***@***.***>
Cc: Jeremy Echols ***@***.***>; Comment ***@***.***>
Subject: Re: [drakkan/sftpgo] Is generating bearer token the only way to access API? (#400)
I think the vault can be considered an authoritative source on this topic, please take a look here:
https://www.vaultproject.io/docs/auth<https://urldefense.com/v3/__https:/www.vaultproject.io/docs/auth__;!!C5qS4YX3!WyCnHyUlVA0asMpLEArwf8BCzC6WDPokiohShzzCv3LC_YISFWjgFY5bdicb7OK8QA$>
https://www.vaultproject.io/docs/auth/approle<https://urldefense.com/v3/__https:/www.vaultproject.io/docs/auth/approle__;!!C5qS4YX3!WyCnHyUlVA0asMpLEArwf8BCzC6WDPokiohShzzCv3LC_YISFWjgFY5bdidcdQ1Png$>
https://www.vaultproject.io/docs/auth/app-id<https://urldefense.com/v3/__https:/www.vaultproject.io/docs/auth/app-id__;!!C5qS4YX3!WyCnHyUlVA0asMpLEArwf8BCzC6WDPokiohShzzCv3LC_YISFWjgFY5bdif1fLzNxw$>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https:/github.com/drakkan/sftpgo/discussions/400*discussioncomment-783046__;Iw!!C5qS4YX3!WyCnHyUlVA0asMpLEArwf8BCzC6WDPokiohShzzCv3LC_YISFWjgFY5bdif5twLQmw$>, or unsubscribe<https://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AAQO3FU2W5KJWMDIFQ5IU6TTPP6K3ANCNFSM4333P62A__;!!C5qS4YX3!WyCnHyUlVA0asMpLEArwf8BCzC6WDPokiohShzzCv3LC_YISFWjgFY5bdidTqqiBSA$>.
|
Beta Was this translation helpful? Give feedback.
-
The impersonation I previously spoke to Nicola about was intended to be at the file access level with windows users having the same name as the corresponding SFTPGo user (Using say advapi32.dll at the OS level). https://gist.github.com/kostix/68022534e22cc239a917 I understand that this is quite a large job. Windows impersonation for me we be good for the reason that Windows ACL can provide another layer of permissions checking (And also systems such as Filesure [Bystorm] which provide another layer of ACL and logging).
I agree this would be useful. One immediate option seems to be a custom authenticator which SFTPTGo already supports. For me windows impersonation at the OS level, is more important, but due to personal circumstances, I am not in a position to support it yet. I would like to be back to work and using SFTPGo first. |
Beta Was this translation helpful? Give feedback.
Hi,
yes this is the only way.
This is not only for security reasons but also for performance, using jwt we can read the user and the permissions from the token, if we use basic auth, as before 2.0, we have to do a data provider query to get permissions for each request. We now have authentication and authorization, before 2.0 we had only authentication, we cannot easily revert back to the old model, sorry