Skip to content
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

Add remoteuser authenticator #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add remoteuser authenticator #1

wants to merge 1 commit into from

Conversation

nbarrientos
Copy link
Owner

@nbarrientos nbarrientos commented Apr 18, 2021

See https://github.com/nbarrientos/aaasvc/blob/issue84/README.md#login-delegation-via-x-remote-user

For "internal" comsumption only (needs discussion upstream):

~/dev/aaasvc λ curl -s --request POST -d '{"username":"ignored"}' -H "Content-type: application/json" -k http://localhost:8080/choria/v1/login -H 'X-Remote-User:nacho'
{"token":"eyJhbGciOiJSUzUxMiIsI..."}
(dlv) p claims
map[string]interface {} [
	"exp": 1618739030, 
	"nbf": 1618735370, 
	"iat": 1618735430, 
	"sub": "choria_client", 
	"agents": []string len: 1, cap: 4, [
		"puppet.*",
	], 
	"iss": "Choria Remoteuser Authenticator", 
	"callerid": "up=nacho", 
	"ou": "cern", 
	"user_properties": map[string]string [
		"group": "admins", 
	], 
]

With config:

{
  "logfile": "aaasvc.log",
  "loglevel": "info",
  "choria_config": "choria.conf",
  "authenticator": "remoteuser",
  "auditors": [
    "logfile"
  ],
  "authorizer": "actionlist",
  "signer": "basicjwt",
  "port": 8080,
  "monitor_port": 8081,
  "site": "default",
  "tls_certificate": "",
  "tls_key": "",
  "tls_ca": "",
  "basicjwt_signer": {
    "signing_certificate": "signing_pub.pem",
    "max_validity": "24h"
  },
  "logfile_auditor": {
    "logfile": "audit.log"
  },
  "remoteuser_authenticator": {
    "signing_key": "signing_key.pem",
    "validity": "1h",
    "default_user": {
        "acls": [
            "puppet.*"
        ],
        "properties": {
            "group": "admins"
        },
        "organization": "cern"
    }
  }
}

To be discussed in choria-io#84. We need though something quick to unblock the testing/validation.

//
// In the future, per-user ACLs/roles/etc could even be part of other
// headers. Alternatively, there could also be a local DB here (as in
// the userlist authenticator). Or a even a combination of both!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think maybe we can just add a flag to the userlist one, something like a default username when none is given.

Setting that option would trigger the userlist one to accept a empty login and then look for this header, if the header is set it would use the default username to find a user definition and use that as a template.

That feels like less code and probably a bit easier to handle?

@@ -312,6 +313,29 @@ Once you signed up for Okta and set up a application for Choria you'll get endpo

Here we configure `acls` based on Okta groups - all users can `rpcutil ping`, there are Puppet admins with appropriate rights and fleet wide admins capable of managing anything.

#### Login delegation via `X-Remote-User`

It's possible to delegate the responsibility of verifying the users' identity to a front-end configured using the mechanism of your choice (Kerberos, OIDC, etc) and setting the identity of the caller in the `X-Remote-User` HTTP header. In this case, configure the `remoteuser` authenticator and make sure that the entrypoint `/login` is well protected. All users will receive the same ACLs et al, configured via `default_user`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's all users strictly getdefault_user or users without a definition get default_user ? A fall back user may be useful. e.g we might have use for handful of special users .

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@traylenator
Copy link

Found an ancient comment I never submitted.

@nbarrientos can you rebase so I can give this a spin.

@nbarrientos
Copy link
Owner Author

can you rebase so I can give this a spin

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants