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

feat: implement audit log #503

Merged
merged 1 commit into from
Aug 2, 2024
Merged

feat: implement audit log #503

merged 1 commit into from
Aug 2, 2024

Conversation

DmitriyMV
Copy link
Member

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:

{"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":"[email protected]","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

@DmitriyMV
Copy link
Member Author

Example of current output:

~ > sudo -E cat /var/lib/docker/volumes/compose_audit-logs/_data/2024-08-01.jsonlog
{"event_type":"create","resource_type":"PublicKeys.omni.sidero.dev","event_ts":1722538118343,"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":"04fe3aee-7c0b-4792-8369-6c27166737d2","role":"Admin","email":"[email protected]","fingerprint":"8c40b847b7fed2aeee88dfa479b1803de34d4c1e","public_key_expiration":1722566318}}
{"event_type":"update","resource_type":"PublicKeys.omni.sidero.dev","event_ts":1722538118955,"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":"04fe3aee-7c0b-4792-8369-6c27166737d2","role":"Admin","email":"[email protected]","confirmation_type":"auth0","fingerprint":"8c40b847b7fed2aeee88dfa479b1803de34d4c1e","public_key_expiration":1722566318}}

This PR only implements

PublicKey confirmation (what was the proof accepted)

part.

@DmitriyMV DmitriyMV force-pushed the audit branch 4 times, most recently from e2f4854 to 342ef2c Compare August 2, 2024 00:12
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":"[email protected]","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 siderolabs#37

Signed-off-by: Dmitriy Matrenichev <[email protected]>
@DmitriyMV
Copy link
Member Author

/m

@talos-bot talos-bot merged commit d194d59 into siderolabs:main Aug 2, 2024
19 checks passed
@DmitriyMV DmitriyMV deleted the audit branch August 2, 2024 20:14
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