Replies: 1 comment 1 reply
-
|
Tip: I'm trying to get accounts to auto-create using the Event Manager, and notice that some custom claims This is because kanidm by default stores the claim as an array rather than a string. To convert to strings, run this: kanidm system oauth2 update-claim-map-join sftpgo sftpgo_role ssv( Might as well look into integration with EDIT: It's not that hard. Follow #1072 and pass |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone, I'd like to share my Kanidm + SFTPGo integration using two approaches. For the first, I employed Kanidm's service account feature to be SFTPGo's admin, as it helps having a limited scope access account for management.
For the second, I want myself to be both user and admin of SFTPGo. However, I don't really like
implicit_rolesas it allows privileged access without attesting any claims from the IDM. So instead I configure 2 client IDs for webAdmin and webClient separately, that redirects to two separate domains/bindings.I think this approach would be better as it outsources sftpgo role management back to the IDM as the single source of truth, and it should be straightforward to implement with other software e.g. Authentik, Authelia. But honestly I'm not sure of all security implications it entails. Please share any improvements or details you may have with it, thanks!
1. Service account approach
If you'd like a dedicated admin account for SFTPGo, you should look at service accounts. They're non-human, scope-limited accounts meant to be managed by a privileged group (usually
idm_service_account_admins). Members of that group can then manage the service account from their own login sessions.graph TD subgraph Kanidm user:demo-user -->|part of| group:idm_service_account_admins -.-> |manages| svc-account:sftpgo-admin -->|part of| group:sftpgo_admins user:demo-user -->|part of| group:sftpgo_users end subgraph client:SFTPGo group:sftpgo_users -->|claim:sftpgo_role:user| webclient group:sftpgo_admins -->|claim:sftpgo_role:admin| webadmin endThe main drawback however, is that there can only be one logon password per service account. Supposedly there is also a new design proposal for better SAs OAuth2 support, but we resort to sharing the password for now.
Kanidm
First, create a service account
sftpgo-adminand make it a member of thesftpgo_adminsgroup:Then, create an
sftpgo_usersgroup with a user (e.g.demo-user) in it:Then, create an oauth2 client and configure it as below:
Finally, you have to define the
sftpgo_roleclaim for each group:kanidm system oauth2 update-claim-map sftpgo sftpgo_role sftpgo_users user kanidm system oauth2 update-claim-map sftpgo sftpgo_role sftpgo_admins admin # kanidm system oauth2 enable-strict-redirect-url sftpgoRun this to see the basic secret to be used in next step:
SFTPGo
Define the env vars in SFTPGo. Note the secret taken from previous step:
Restart SFTPGo. It should now work.
2. Two domains, two bindings approach
If instead, you want to be both admin and user, then consider hosting webAdmin and webClient on two different bindings, with different ports, that maps to two different domains, and has different OAuth2 client IDs. The webAdmin and webClient are now "separate" services, allowing separate sftpgo_role claims to be attested per-account.
graph TD subgraph Kanidm user:demo-user -->|part of| group:sftpgo_admins user:demo-user -->|part of| group:sftpgo_users group:sftpgo_admins group:sftpgo_users end subgraph SFTPGo subgraph client:sftpgo-webclient group:sftpgo_users -->|https:\/\/sftpgo-webclient.example.com| webclient[webclient on binding 0 port 8080] end subgraph client:sftpgo-webadmin group:sftpgo_admins -->|https:\/\/sftpgo-webadmin.example.com| webadmin[webadmin on binding 1 port 9090] end endYou can use a reverse proxy to map different ports to different domains. It's out-of-scope for this guide but should be fairly easy to do.
Kanidm
First, add our
demo-userto bothsftpgo_adminsandsftpgo_users:Then, create 2 OAuth2 clients -
sftpgo_webadminandsftpgo_webclient. Each of them will be mapped exclusively to their user groups -sftpgo_adminsandsftpgo_usersrespectively. They'll also have different origin domains.For
sftpgo_webadminFor
sftpgo_webclientSFTPGo
Fetch the client secrets with kanidm:
Configure the env vars for SFTPGo. Note the different ports and URLs.
Restart SFTPGo. The
demo-usershould now be able to log on with OIDC as different roles, via separate URL links for webClient and webAdmin.Beta Was this translation helpful? Give feedback.
All reactions