49 Commits

Author SHA1 Message Date
Utku Ozdemir
2fe716d2c9
chore: enable go linting for build tags, fix linting errors
Add the build tags we were using, `integration` and `tools`, to be included in the linting/formatting of  golangci-lint.

Rename the build tag `tools` to `sidero.tools` to avoid colliding with the same named build tag in `github.com/johannesboyne/gofakes3` package - otherwise the dependency was failing to compile due to having multiple package names in the same package.

Fix all the linting errors surfaced by this enablement.

Also, temporarily re-enabled `nolintlint` to find the nolint directives which were no longer necessary and removed them.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2026-04-29 21:18:45 +02:00
Utku Ozdemir
5c4a6b5766
feat: remove image factory proxying
Omni now rejects legacy installation media download requests with a message asking users to upgrade omnictl instead of proxying them to the Talos image factory.

Current omnictl versions continue to download installation media directly from the Talos image factory.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2026-04-16 14:26:42 +02:00
Utku Ozdemir
590ea2e370
feat: add per-key creation and last-active tracking for service accounts
Add creation timestamps and per-key last-active tracking to service account key listings. The `omnictl serviceaccount list` command now shows KEY CREATED and KEY LAST ACTIVE columns for each public key, alongside the existing SA-level LAST ACTIVE.

A new PublicKeyLastActive resource tracks per-key usage. The activity interceptor now extracts the signing key fingerprint from the auth context and records last-used timestamps per key, with independent debouncing. The ServiceAccountStatusController aggregates this data into the service account status for display.

A cleanup controller removes PublicKeyLastActive resources when their corresponding public key is torn down.

Closes: siderolabs/omni#2661
Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2026-04-14 21:12:30 +02:00
Edward Sammut Alessi
cad3713552
feat: implement eula guard for omni
Implement a guard for Omni to prevent usage until users accept an EULA through the UI or a startup flag.

Signed-off-by: Edward Sammut Alessi <edward.sammutalessi@siderolabs.com>
2026-04-13 16:49:51 +02:00
Utku Ozdemir
1bbe869bb7
fix: clean up stale identity last active resources on identity removal
Add a cleanup controller that removes the identity last active resource when its corresponding identity is destroyed. This covers all identity types uniformly: users, service accounts, and infra providers.

Previously, users and service accounts had manual cleanup in their destroy paths, but infra providers did not, leaving orphaned resources. Remove the manual cleanup from user and service account destruction, as the controller now handles it.

Add a migration to remove any already-orphaned identity last active resources that have no matching identity.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2026-03-27 15:20:56 +01:00
Oguz Kilcan
6d03fc7cdb
feat: track user and service account last activity
* Add `IdentityLastActive` resource to record the last time each identity(`User`/`ServiceAccount`) made a gRPC call.
* Add `IdentityStatusController` to aggregate identity, user role, and last-active data into an ephemeral `IdentityStatus` resource.
* Expose last_active in ListUsers/ListServiceAccounts gRPC responses, omnictl CLI output, and the frontend Users/ServiceAccounts views.
* Add `UserMetricsController` exposing `omni_users` (total) and `omni_active_users` (7d/30d windows) Prometheus gauges.

Signed-off-by: Oguz Kilcan <oguz.kilcan@siderolabs.com>
2026-03-03 13:53:29 +01:00
Oguz Kilcan
e3df911d48
feat: enforce configurable limits on user and service account creation
Add state validation that rejects identity creation when the configured maximum number of users or service accounts is reached. The gRPC resource and management servers now use the validated state so these limits are enforced for all creation paths (CLI, UI, API). Identity is created before the user resource so the validation fires before any side effects.

Also adds create validation for join token name, e2e Playwright tests covering UI and AccountLimits integration test covering API and CLI for limit enforcement.

Signed-off-by: Oguz Kilcan <oguz.kilcan@siderolabs.com>
2026-02-26 13:47:52 +01:00
Oguz Kilcan
da60807d48
feat: add ManagementService gRPC endpoints for user operations
Migrate user create, list, update, and destroy operations from direct resource manipulation to dedicated ManagementService gRPC endpoints, matching the existing service account pattern.
Direct Identity/User resource mutations are now restricted, and the CLI, frontend, and client library are updated to use the new endpoints.

Signed-off-by: Oguz Kilcan <oguz.kilcan@siderolabs.com>
2026-02-26 09:33:27 +01:00
Edward Sammut Alessi
ad6cf5b1e3
feat: enforce auth_time in auth0 token validation
In the backend enfore auth_time checks to validate that a re-authentication has taken place, and that the token meets our minimum age policy.

Signed-off-by: Edward Sammut Alessi <edward.sammutalessi@siderolabs.com>
2026-02-24 16:25:15 +01:00
Utku Ozdemir
f3cdbda7e0
refactor: remove global config, inject it to services
Part of the effort to improve Omni codebase, reduce the usage of globals.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2026-02-09 14:16:02 +01:00
Oguz Kilcan
c241820e7f
fix: apply AccessPolicy rules on gRPC proxy for Talos backend
Apply AccessPolicy rules on gRPC proxy for Talos backend

Fixes: #2221

Signed-off-by: Oguz Kilcan <oguz.kilcan@siderolabs.com>
2026-01-29 16:18:43 +01:00
Utku Ozdemir
91c8bff46c
feat: generate omni config from schema
Make all leaf fields nillable, so that we can distinguish unset from explicit empty, and merging of CLI args and YAML configs work correctly.

Generate nil-safe accessors (getter/setters) for these nillable fields and use them in the code.

Wrap the cobra command line parser to support nillable flags.

Move all validations into the JSON schema and drop go-validator usage and its annotations.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2026-01-22 13:23:11 +01:00
Edward Sammut Alessi
d3ae77c0cc
chore: bump copyright to 2026
Bump copyright for conformance to 2026

Signed-off-by: Edward Sammut Alessi <edward.sammutalessi@siderolabs.com>
2026-01-21 15:30:49 +01:00
Pranav Patil
c6aaff0f9e
refactor: make namespace implicit in auth package
Simplify the code and make it less error prone.

Signed-off-by: Pranav Patil <pranavppatil767@gmail.com>
Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2026-01-14 21:07:33 +01:00
Utku Ozdemir
4bf2e0de92
test: fix flaky ECDSA signature generation in TestPlainSignature
The encodeRFC4754 test helper failed to pad ECDSA integers to the curve size, causing signatures to be shorter than 64 bytes when r or s had leading zeros. This resulted in intermittent verification failures. This fix ensures both values are correctly zero-padded to 32 bytes.

The actual signing code in the frontend was verified to not have the issue, as it hands over signing to the Web Crypto API.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2026-01-12 16:04:54 +01:00
Pranav Patil
de6e2c66f7
refactor: make namespace implicit in omni resources
Refactor for code simplicity.

Signed-off-by: Pranav Patil <pranavppatil767@gmail.com>
Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2026-01-12 12:54:11 +01:00
Utku Ozdemir
dd0bdb63cc
feat: store audit logs in sqlite
Use SQLite storage to store audit logs.
Use the same SQLite database used for the metrics state.

Refactor audit log storage to define a common interface for file and sqlite based logs.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2025-12-08 11:09:39 +01:00
Artem Chernyshev
292969717b
feat: support dynamically updating SAML label roles
Added new `update_on_each_login` field to the `SAMLLabelRule` spec.
Also renamed `assign_role_on_registration` to `assign_role` as it's no
longer reflecting the actual meaning.

The old field is kept there for the backward compatibility.

Fixes: https://github.com/siderolabs/omni/issues/1201

Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
2025-11-18 20:43:15 +03:00
Edward Sammut Alessi
6df818b2e8
chore: make FrontendAuthFlow generated
Move the FrontendAuthFlow variable into a generated one in resources.ts

Signed-off-by: Edward Sammut Alessi <edward.sammutalessi@siderolabs.com>
2025-11-12 10:29:02 +01:00
lkc8fe
1dec8ed740
feat: allow OIDC providers which do not have email_verified claim
This fix allows using OIDC login for Azure or other similar Auth Systems.
Fixes: https://github.com/siderolabs/omni/issues/1818

Signed-off-by: lkc8fe <lukas.reckzuegel@de.bosch.com>
2025-11-10 17:36:33 +03:00
Artem Chernyshev
cb40d4fb75
feat: support plain keys in the request signatures
Omni now supports ECDSA P-256 keys for signing the requests.
The plain key should be encoded as PEM when it is submitted to
`RegisterPublicKey` method.

Signature should be encoded using RFC4754 method (`r||s`).

Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
2025-11-10 14:41:23 +03:00
Andrey Smirnov
75a9f3ee9f
feat: use sqlite as secondary resource storage
This pulls in https://github.com/cosi-project/state-sqlite/pull/2

Fixes https://github.com/siderolabs/omni/issues/1770

See https://github.com/siderolabs/omni/issues/1768

Sample migration logs:

```
2025-11-05T11:18:47.340Z        ESC[34mINFOESC[0m       omni/state_sqlite.go:122        migrated resources from BoltDB to SQLite        {"namespace": "metrics"
, "type": "EtcdBackupOverallStatuses.omni.sidero.dev", "count": 1}
2025-11-05T11:18:47.340Z        ESC[34mINFOESC[0m       omni/state_sqlite.go:122        migrated resources from BoltDB to SQLite        {"namespace": "metrics"
, "type": "EtcdBackupStatuses.omni.sidero.dev", "count": 0}
2025-11-05T11:18:47.342Z        ESC[34mINFOESC[0m       omni/state_sqlite.go:122        migrated resources from BoltDB to SQLite        {"namespace": "metrics"
, "type": "MachineStatusLinks.omni.sidero.dev", "count": 2}
2025-11-05T11:18:47.342Z        ESC[34mINFOESC[0m       omni/state_sqlite.go:67 removed old BoltDB database after migration     {"path": "_out/secondary-storag
e/bolt.db"}
```

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
2025-11-05 15:40:24 +04:00
Oguz Kilcan
d27624abc6
chore: rekres and bump go to 1.25.2
Rekres, fix linter issues, bump go to 1.25.2
See groups.google.com/g/golang-nuts/c/Gxn25BP4MXk/m/3KrM-XBOBAAJ

Signed-off-by: Oguz Kilcan <oguz.kilcan@siderolabs.com>
2025-10-08 13:22:55 +02:00
Utku Ozdemir
10829fafbd
fix: fix local resource server access auth check
Check if the actor is internal to make sure the local resource server remains accessible without authentication.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2025-09-23 15:48:25 +02:00
Utku Ozdemir
5beb24f7d0
fix: fix the order in the grpc interceptor chain
Change the interceptor order to move the Prometheus metrics collector earlier, so that we can get metrics for the calls that fail early. Related to siderolabs/omni#1606.

Additionally, ensure that `get` access to the `AuthConfig` resource does not require a GRPC signature.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2025-09-23 11:24:51 +02:00
Artem Chernyshev
b70560c166
feat: implement OIDC auth support
Fixes: https://github.com/siderolabs/omni/issues/92

Now Omni can be configured to use OIDC provider (tested against Google
provider).

New flags introduced:

```
--auth-oidc-enabled true
--auth-oidc-provider-url https://accounts.google.com
--auth-oidc-client-id REDACTED
--auth-oidc-client-secret REDACTED
--auth-oidc-scopes openid
--auth-oidc-scopes profile
--auth-oidc-scopes email
```

Initial users are created the same way as for Auth0 provider, same flag
should be used.

Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
2025-09-09 19:03:20 +03:00
Artem Chernyshev
150d61bfb9
fix: better detect user identity in SAML responses
Some checks failed
default / default (push) Has been cancelled
default / e2e-backups (push) Has been cancelled
default / e2e-cluster-import (push) Has been cancelled
default / e2e-forced-removal (push) Has been cancelled
default / e2e-omni-upgrade (push) Has been cancelled
default / e2e-scaling (push) Has been cancelled
default / e2e-short (push) Has been cancelled
default / e2e-short-secureboot (push) Has been cancelled
default / e2e-templates (push) Has been cancelled
default / e2e-upgrades (push) Has been cancelled
default / e2e-workload-proxy (push) Has been cancelled
Several changes:
- if identity doesn't look like a valid email address ignore the
  attribute.
- if identity was already detected in an attribute ignore other
  attributes.

Allow setting extra attribute mappings in the command line flags.

Fixes: https://github.com/siderolabs/omni/issues/1376

Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
2025-08-18 14:16:47 +03:00
Oguz Kilcan
69c4fd5d1e
fix: prevent service account creation if name is already in use
Prevent service account creation if name is already in use

Signed-off-by: Oguz Kilcan <oguz.kilcan@siderolabs.com>
2025-08-11 22:47:34 +02:00
Utku Ozdemir
0e76483bab
chore: rekres, bump deps, Go, Talos and k8s versions, satisfy linters
Some checks failed
default / default (push) Has been cancelled
default / e2e-backups (push) Has been cancelled
default / e2e-forced-removal (push) Has been cancelled
default / e2e-omni-upgrade (push) Has been cancelled
default / e2e-scaling (push) Has been cancelled
default / e2e-short (push) Has been cancelled
default / e2e-short-secureboot (push) Has been cancelled
default / e2e-templates (push) Has been cancelled
default / e2e-upgrades (push) Has been cancelled
default / e2e-workload-proxy (push) Has been cancelled
- Bump some deps, namely cosi-runtime and Talos machinery.
- Update `auditState` to implement the new methods in COSI's `state.State`.
- Bump default Talos and Kubernetes versions to their latest.
- Rekres, which brings Go 1.24.5. Also update it in go.mod files.
- Fix linter errors coming from new linters.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2025-07-11 18:23:48 +02:00
Artem Chernyshev
b1225c9312
feat: support setting custom name ID format in SAML metadata
Some checks are pending
default / default (push) Waiting to run
default / e2e-backups (push) Blocked by required conditions
default / e2e-forced-removal (push) Blocked by required conditions
default / e2e-omni-upgrade (push) Blocked by required conditions
default / e2e-scaling (push) Blocked by required conditions
default / e2e-short (push) Blocked by required conditions
default / e2e-short-secureboot (push) Blocked by required conditions
default / e2e-templates (push) Blocked by required conditions
default / e2e-upgrades (push) Blocked by required conditions
default / e2e-workload-proxy (push) Blocked by required conditions
Should help to support Fusion Auth.

Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
2025-06-27 19:55:01 +03:00
Artem Chernyshev
122b79605f
test: run Omni as part of integration tests
Some checks are pending
default / default (push) Waiting to run
default / e2e-backups (push) Blocked by required conditions
default / e2e-forced-removal (push) Blocked by required conditions
default / e2e-scaling (push) Blocked by required conditions
default / e2e-short (push) Blocked by required conditions
default / e2e-short-secureboot (push) Blocked by required conditions
default / e2e-templates (push) Blocked by required conditions
default / e2e-upgrades (push) Blocked by required conditions
default / e2e-workload-proxy (push) Blocked by required conditions
This enables test coverage, builds Omni with race detector.

Also redone the COSI state creation flow: no more callbacks.
The state is now an Object, which has `Stop` method, that should be
called when the app stops.
All defers were moved into the `Stop` method basically.

Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
2025-06-18 16:20:11 +03:00
Artem Chernyshev
ccd55cc8fb
feat: rewrite Omni config management
Some checks are pending
default / default (push) Waiting to run
default / e2e-backups (push) Blocked by required conditions
default / e2e-forced-removal (push) Blocked by required conditions
default / e2e-scaling (push) Blocked by required conditions
default / e2e-short (push) Blocked by required conditions
default / e2e-short-secureboot (push) Blocked by required conditions
default / e2e-templates (push) Blocked by required conditions
default / e2e-upgrades (push) Blocked by required conditions
default / e2e-workload-proxy (push) Blocked by required conditions
Omni can now be configured via a config file instead of the command line
flags.
The flags `--config-path` will now read the config provided in the YAML
format.
The config structure was completely changed. It was not public before,
so it's fine to ignore backward compatibility.
The command line flags were not changed.

Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
2025-06-09 14:44:29 +03:00
Utku Ozdemir
5057ba92cb
chore: rekres, bump deps, satisfy linters, fix generated test headers
Some checks failed
default / default (push) Has been cancelled
default / e2e-backups (push) Has been cancelled
default / e2e-forced-removal (push) Has been cancelled
default / e2e-scaling (push) Has been cancelled
default / e2e-short (push) Has been cancelled
default / e2e-short-secureboot (push) Has been cancelled
default / e2e-templates (push) Has been cancelled
default / e2e-upgrades (push) Has been cancelled
default / e2e-workload-proxy (push) Has been cancelled
- The license headers in the generated test sources via `mockgen` were getting commented-out after `make generate` was run.
  Fix this by replacing repeated double-slashes `// //` via a single double-slash `//`.
- Rekres, `make generate` and `make generate-frontend`.
- Bump Go deps.
- Fix linting errors to satisfy new rules in golangci-lint `v2.1.1`.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2025-04-22 13:00:20 +02:00
Dmitriy Matrenichev
0cda77bbce
chore: bump Go and rekres
Run rekres, update Go version and update all files affected by linters.

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
2025-02-14 12:31:38 +03:00
Artem Chernyshev
ed946b30a6
feat: display OMNI_ENDPOINT in the service account creation UI
Fixes: https://github.com/siderolabs/omni/issues/858

Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
2025-01-29 15:27:36 +03:00
Artem Chernyshev
c754cdc0d7
feat: support insecure localhost infra provider access mode
Some checks failed
default / default (push) Has been cancelled
default / e2e-backups (push) Has been cancelled
default / e2e-scaling (push) Has been cancelled
default / e2e-short (push) Has been cancelled
default / e2e-templates (push) Has been cancelled
default / e2e-upgrades (push) Has been cancelled
default / e2e-workload-proxy (push) Has been cancelled
Also:
- support generating the initial service account and dumping it's key
  somewhere.
- support running omni integration tests against the production build of
  Omni using a service account.
- enable `omni-integration-test` image.

Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
2024-10-18 17:29:57 +03:00
Artem Chernyshev
464f699137
chore: rename CloudProvider to InfraProvider
Including all namespaces, resources, roles.

Fixes: https://github.com/siderolabs/omni/issues/600

Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
2024-08-30 19:39:46 +03:00
Dmitriy Matrenichev
99f93179bd
chore: implement audit log for several types
This commit implements session tracking and log audit for those types:
- [x] auth.PublicKey
- [x] auth.AccessPolicy
- [x] auth.User
- [x] auth.Identity
- [x] omni.Machine
- [x] omni.MachineLabels
- [x] omni.Cluster
- [x] omni.MachineSet (only empty owners for update, log create and delete in all cases)
- [x] omni.MachineSetNode (only empty owners for update, log create and delete in all cases)
- [x] omni.ConfigPatch
- [x] Talos API Access
- [x] Kubernetes API access

Output example:

```
{"event_type":"update","resource_type":"Machines.omni.sidero.dev","event_ts":1723137771180,"event_data":{"session":{"user_agent":"Omni-Internal-Agent"},"machine":{"id":"18cec051-d975-483d-8d43-10ac6421648a","is_connected":true,"management_address":"fdae:41e4:649b:9303:da9b:1ed:a725:c3dd","labels":{"omni.sidero.dev/address":"fdae:41e4:649b:9303:da9b:1ed:a725:c3dd"}}}}
{"event_type":"update","resource_type":"Machines.omni.sidero.dev","event_ts":1723137771180,"event_data":{"session":{"user_agent":"Omni-Internal-Agent"},"machine":{"id":"18cec051-d975-483d-8d43-10ac6421648a","is_connected":true,"management_address":"fdae:41e4:649b:9303:da9b:1ed:a725:c3dd","labels":{"omni.sidero.dev/address":"fdae:41e4:649b:9303:da9b:1ed:a725:c3dd"}}}}
{"event_type":"update","resource_type":"Machines.omni.sidero.dev","event_ts":1723137771181,"event_data":{"session":{"user_agent":"Omni-Internal-Agent"},"machine":{"id":"18cec051-d975-483d-8d43-10ac6421648a","is_connected":true,"management_address":"fdae:41e4:649b:9303:da9b:1ed:a725:c3dd","labels":{"omni.sidero.dev/address":"fdae:41e4:649b:9303:da9b:1ed:a725:c3dd"}}}}
{"event_type":"create","resource_type":"MachineLabels.omni.sidero.dev","event_ts":1723137787549,"event_data":{"session":{"user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36","ip_address":"<snip>","user_id":"ea002172-b9da-423f-bd1d-b443b8a7b43c","role":"Admin","email":"dmitry.matrenichev@siderolabs.com","fingerprint":"da7b997eb68449a12bebc6a3bf4f59beaf167209"},"machine_labels":{"id":"18cec051-d975-483d-8d43-10ac6421648a","labels":{"222":""}}}}
{"event_type":"update","resource_type":"MachineLabels.omni.sidero.dev","event_ts":1723137787553,"event_data":{"session":{"user_agent":"Omni-Internal-Agent"},"machine_labels":{"id":"18cec051-d975-483d-8d43-10ac6421648a","labels":{"222":""}}}}
{"event_type":"update","resource_type":"MachineLabels.omni.sidero.dev","event_ts":1723137811532,"event_data":{"session":{"user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36","ip_address":"<snip>","user_id":"ea002172-b9da-423f-bd1d-b443b8a7b43c","role":"Admin","email":"dmitry.matrenichev@siderolabs.com","fingerprint":"da7b997eb68449a12bebc6a3bf4f59beaf167209"},"machine_labels":{"id":"18cec051-d975-483d-8d43-10ac6421648a","labels":{"222":"","333":""}}}}
{"event_type":"update","resource_type":"MachineLabels.omni.sidero.dev","event_ts":1723137811610,"event_data":{"session":{"user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36","ip_address":"<snip>","user_id":"ea002172-b9da-423f-bd1d-b443b8a7b43c","role":"Admin","email":"dmitry.matrenichev@siderolabs.com","fingerprint":"da7b997eb68449a12bebc6a3bf4f59beaf167209"},"machine_labels":{"id":"18cec051-d975-483d-8d43-10ac6421648a","labels":{"222":"","333":""}}}}
{"event_type":"update","resource_type":"MachineLabels.omni.sidero.dev","event_ts":1723137811611,"event_data":{"session":{"user_agent":"Omni-Internal-Agent"},"machine_labels":{"id":"18cec051-d975-483d-8d43-10ac6421648a","labels":{"222":"","333":""}}}}
{"event_type":"destroy","resource_type":"MachineLabels.omni.sidero.dev","event_ts":1723137811621,"event_data":{"session":{"user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36","ip_address":"<snip>","user_id":"ea002172-b9da-423f-bd1d-b443b8a7b43c","role":"Admin","email":"dmitry.matrenichev@siderolabs.com","fingerprint":"da7b997eb68449a12bebc6a3bf4f59beaf167209"},"machine_labels":{"id":"18cec051-d975-483d-8d43-10ac6421648a","labels":{"222":"","333":""}}}}
{"event_type":"create","resource_type":"Users.omni.sidero.dev","event_ts":1723141793888,"event_data":{"new_user":{"role":"Admin","id":"7903a72c-87af-43b8-94dc-82bd961ab768"},"session":{"user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36","ip_address":"<snip>","user_id":"ea002172-b9da-423f-bd1d-b443b8a7b43c","role":"Admin","email":"dmitry.matrenichev@siderolabs.com","fingerprint":"da7b997eb68449a12bebc6a3bf4f59beaf167209"}}}
{"event_type":"create","resource_type":"Identities.omni.sidero.dev","event_ts":1723141793981,"event_data":{"new_user":{"id":"7903a72c-87af-43b8-94dc-82bd961ab768","email":"some-user-email@email.com"},"session":{"user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36","ip_address":"<snip>","user_id":"ea002172-b9da-423f-bd1d-b443b8a7b43c","role":"Admin","email":"dmitry.matrenichev@siderolabs.com","fingerprint":"da7b997eb68449a12bebc6a3bf4f59beaf167209"}}}
```

Closes #37

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
2024-08-12 15:36:55 +03:00
Dmitriy Matrenichev
d194d59be8
feat: implement audit log
This PR implements audit logs. To enable it you have to set the `--audit-log-dir` flag
to a directory where the audit logs will be stored. The audit logs are stored in a JSON format.

Example:
```json
{"event_type":"update","resource_type":"PublicKeys.omni.sidero.dev","event_ts":1722537710182,"event_data":{"user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36","ip_address":"<snip>","user_id":"a19a7a38-1793-4262-a9ef-97bc00c7a155","role":"Admin","email":"useremail@userdomain.com","confirmation_type":"auth0","fingerprint":"15acb974f769bdccd38a4b28f282b78736b80bc7","public_key_expiration":1722565909}}
```

Keep in mind that `event_ts` are in milliseconds instead of seconds.
Field `event_data` contains all relevant information about the event.

To enabled it in the development environment you will have to add the
`--audit-log-dir /tmp/omni-data/audit-logs` line to `docker-compose.override.yml`
or run `generate-certs` again.

For #37

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
2024-08-02 03:15:31 +03:00
Utku Ozdemir
4ec7a434ba
feat: add cloud provider resources and role
Add the new resources for the cloud provider feature: `CloudConfigs`, `MachineRequests` and `MachineRequestStatuses`.

Add a new role, `CloudProvider` with access to the resources a cloud provider plugin requires.

Introduce the concept of "cloud provider service accounts" which are a special type of service accounts in the format `cloud-provider:<id>`. They must have the `CloudProvider` role and their id is matched against the label `omni.sidero.dev/cloud-provider-id` label on the `MachineRequest*` type resources.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2024-07-28 22:46:43 +02:00
Dmitriy Matrenichev
5dd52593ee
chore: add rotating log for audit data
Adds rotating audit log writer. Also minor improvements.

For #37

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
2024-07-25 19:52:09 +03:00
Dmitriy Matrenichev
4cfc0e6dd0
chore: rework auth.* keys, add ctxstore package
Using so-called phantom types we can use the types themselves as keys directly without loosing performance.
You no longer need to remember which type was attached to the thing you passed in context and can look up
all fields access directly.

Part of #37

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
2024-07-15 16:48:04 +03:00
Dmitriy Matrenichev
d0cb1bc744
chore: replace grpc.Dial* with grpc.NewClient
That should silence `staticcheck` linter.

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
2024-06-05 19:15:35 +03:00
Artem Chernyshev
ed26122ce0
fix: implement the controller for handling machine status snapshot
Make the controller run tasks that can collect machine status from each
machine.
Instead of changing the `MachineStatusSnapshot` directly in the
siderolink events handler pass these events to the controller through
the channel, so that all events are handled in the same place.

If either event comes from siderolink or if task runner gets the machine
status it updates the `MachineStatusSnapshot` resource.

Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
2024-06-04 13:59:47 +03:00
Dmitriy Matrenichev
82abb2ba53
chore: bump deps
- run rekres and fix nolint directives
- bump deps (keep gen to 0.4.8 for now) for server, client and tests

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
2024-06-03 22:43:37 +03:00
Utku Ozdemir
247c16550f
fix: improve wording in authentication error messages
Fix the grammar and improve the error messages about authentication.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2024-05-24 23:10:01 +02:00
Utku Ozdemir
987f8cdbd4
feat: improve auth flow when user email is not verified
If the user has their email not verified, instead of failing with a generic error message of "invalid JWT", print an error message asking user to verify their email and try again.

In Auth0 mode, if the JWT validation has failed on the backend at the moment of clicking "Login", get a new ID token from Auth0 on the next click. This way, the user will not have to reload the page after validating their email - they can simply click "Login" again to get in.

Part of siderolabs/omni#114.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2024-05-08 17:10:57 +02:00
Sherif Fanous
2e015a994a
chore: support Auth0 client playing nicely with other OAuth2/OIDC providers
Omni doesn't use a generic OAuth2/OIDC client/SDK instead it uses the Auth0 SDK for Vue and it's using a pretty old version,  v1.0.2 as can be seen by inspecting the Omni package.json [here](7fb5d2b20a/frontend/package.json (L13)). This SDK in turn uses [auth0-spa-js](https://github.com/auth0/auth0-spa-js) v1.22.1 which can be seen by inspecting its package.json [here](bb3bc817d1/package.json (L80)).

**This has significant implications as the v1 of the SDK is not compliant with OAuth2 in 1 critical area.**

OAuth2 mandates the use of  the `application/x-www-form-urlencoded` content type for grant messages sent to the token endpoint and that sending JSON request bodies will result in a 400 error.

Unfortunately the v1 of the SDK sends the request payload as JSON which means that IdPs such as Authentik rightfully returns a 400 error and this results in an infinite loop of requests from Omni to Authentik.

The behavior can be confirmed by looking at the comment in the Auth0 SDK code [here](371e5a82a6/src/global.ts (L251)). Interestingly the default for the `useFormData` was changed to `true` in v1.22.6 of the SDK.

This PR introduces a new Omni flag called `--auth-auth0-use-form-data`. By default the flag is set to `false` to maintain backwards compatibility. If the flag is set to `true` then the Auth0 client is created with the `useFormData` set to `true`

Signed-off-by: Sherif Fanous <sherif.fanous+github@gmail.com>
Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
2024-04-12 12:12:13 +03:00
Andrey Smirnov
dfcbaae7d0
chore: initial commit
Omni is source-available under BUSL.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
Co-Authored-By: Artem Chernyshev <artem.chernyshev@talos-systems.com>
Co-Authored-By: Utku Ozdemir <utku.ozdemir@siderolabs.com>
Co-Authored-By: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
Co-Authored-By: Philipp Sauter <philipp.sauter@siderolabs.com>
Co-Authored-By: Noel Georgi <git@frezbo.dev>
Co-Authored-By: evgeniybryzh <evgeniybryzh@gmail.com>
Co-Authored-By: Tim Jones <tim.jones@siderolabs.com>
Co-Authored-By: Andrew Rynhard <andrew@rynhard.io>
Co-Authored-By: Spencer Smith <spencer.smith@talos-systems.com>
Co-Authored-By: Christian Rolland <christian.rolland@siderolabs.com>
Co-Authored-By: Gerard de Leeuw <gdeleeuw@leeuwit.nl>
Co-Authored-By: Steve Francis <67986293+steverfrancis@users.noreply.github.com>
Co-Authored-By: Volodymyr Mazurets <volodymyrmazureets@gmail.com>
2024-02-29 17:19:57 +04:00