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

Orbit authentication with Fleet #7109

Closed
sharvilshah opened this issue Aug 9, 2022 · 7 comments
Closed

Orbit authentication with Fleet #7109

sharvilshah opened this issue Aug 9, 2022 · 7 comments
Assignees
Labels
~agent Related to Fleet's osquery runtime and agent autoupdater (Orbit)

Comments

@sharvilshah
Copy link
Contributor

Goal

In order to us to remotely manage osquery flags (CLI flags in osquery which requires restarting osquery on the host), orbit should "enroll" and authenticate with Fleet

Parent Epic

How?

  • Create a new /orbit endpoint on Fleet
    • This new endpoint will be used for all subsequent orbit related API calls (/orbit/enroll, /orbit/<team|host>/flags, etc)
  • EnrollRequest <> EnrollResponse
    • When orbit requests an enroll on the new endpoint, Fleet should create a new orbit_node_key similar to osquery's node_key
    • orbit should use the existing enroll_secret to request an enrollment with Fleet
    • orbit should save the node_key locally (initially on filesystem, later migrate to something like Pebble by CockroachDB (https://pkg.go.dev/github.com/cockroachdb/pebble)
    • re-enrollment and invalidation:
      • Ideally both orbit and osquery node-keys should handle invalidation and reenrollment in tandem (TBD)
      • Failure scenario: what happens when Fleet is unreachable (retry?) (TBD)
  • Extend host MySQL datastore to store the following: host_id, node_key, orbit_node_key
    • orbit and osquery on the same host, shouldn't cause duplicate hosts
@sharvilshah sharvilshah added ~agent Related to Fleet's osquery runtime and agent autoupdater (Orbit) 5 labels Aug 9, 2022
@sharvilshah sharvilshah self-assigned this Aug 9, 2022
@lucasmrod
Copy link
Member

Hi @sharvilshah.

We've discussed a way in which Fleet could match an Orbit instance and its child osqueryd instance (basically to determine if both instances are coming from the same host).

Osquery enroll API is of the following form:

{
  "enroll_secret": "...", // Optional.
  "host_identifier": "..." // Determined by the --host_identifier flag
  "host_details": { // A dictionary of keys mapping to helpful osquery tables.
    "os_version": {},
    "osquery_info": {},
    "system_info": {},
    "platform_info": {}
  }
}

Fleet stores the host_identifier as hosts.osquery_host_id in MySQL. (And that's how Fleet identifies the host in case of e.g. re-enroll.)

Orbit always starts osqueryd with --host_identifier=uuid:

func FleetFlags(fleetURL *url.URL) []string {
hostname, prefix := fleetURL.Host, fleetURL.Path
return []string{
// Use uuid as the default identifier -- users can override this in their flagfile
"--host_identifier=uuid",

Such uuid value for --host_identifier is the UUID of the hardware:
https://github.com/osquery/osquery/blob/master/osquery/core/system.cpp#L126

Proposal: Orbit could run the following command before starting the osqueryd daemon:

# /opt/orbit/bin/osqueryd/macos-app/stable/osquery.app/Contents/MacOS/osqueryd -S --json "select uuid from system_info;"
[
  {"uuid":"3EBADBB4-B0B1-4BB2-ADAB-E82A53D6045D"}
]

# (system_info.uuid is the hardware UUID.)

Then, in the Orbit "enroll request", Orbit would send such hardware UUID + enroll secret. That way, Fleet has a way to match the two in MySQL.

Let me know if it makes sense to you.

@lukeheath
Copy link
Member

lukeheath commented Aug 31, 2022

@zhumo Question from @mna: Does this issue include the updates necessary for Orbit to receive agent options/flags or do we need to open a new ticket for that?

(As related to #7377)

cc @noahtalerman

@zhumo
Copy link
Contributor

zhumo commented Aug 31, 2022

Hey @lukeheath @mna, No this issue does not. This is a sub-issue of

This ticket only reflects the one-off work needed for orbit to authenticate and communicate with fleet server. A follow-on ticket will be created, when @sharvilshah starts working on it, to address the actual reading/updating of flags. Does that answer your question?

@zhumo
Copy link
Contributor

zhumo commented Aug 31, 2022

@lukeheath @mna never mind!

#7246 covers both the flags and the authentication piece.

@zhumo
Copy link
Contributor

zhumo commented Sep 30, 2022

@sharvilshah @zwass Hey! has this been addressed and ready for release? Its sibling issues are, but this one is not marked.

@zhumo zhumo moved this from 🥚 Ready to ✅ Ready for release in 🚀 Release Oct 7, 2022
@zhumo zhumo moved this to 🥚 Ready in 🚀 Release Oct 7, 2022
@zhumo zhumo moved this from ✅ Ready for release to 🐣 In progress in 🚀 Release Oct 7, 2022
@zhumo
Copy link
Contributor

zhumo commented Oct 7, 2022

@zwass

@zwass
Copy link
Member

zwass commented Oct 7, 2022

Yes, this was done as part of #7246.

@zwass zwass closed this as completed Oct 7, 2022
@zwass zwass removed this from 🚀 Release Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
~agent Related to Fleet's osquery runtime and agent autoupdater (Orbit)
Projects
None yet
Development

No branches or pull requests

5 participants