Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
update webapps to support more MySQL audit events (#729) (#737)
Browse files Browse the repository at this point in the history
  • Loading branch information
greedy52 authored Apr 14, 2022
1 parent 5eb3223 commit 457a99e
Show file tree
Hide file tree
Showing 5 changed files with 453 additions and 2 deletions.
7 changes: 7 additions & 0 deletions packages/teleport/src/Audit/EventList/EventTypeCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ const EventIconMap: Record<EventCode, React.FC> = {
[eventCodes.MYSQL_STATEMENT_RESET]: Icons.Database,
[eventCodes.MYSQL_STATEMENT_FETCH]: Icons.Database,
[eventCodes.MYSQL_STATEMENT_BULK_EXECUTE]: Icons.Database,
[eventCodes.MYSQL_INIT_DB]: Icons.Database,
[eventCodes.MYSQL_CREATE_DB]: Icons.Database,
[eventCodes.MYSQL_DROP_DB]: Icons.Database,
[eventCodes.MYSQL_SHUT_DOWN]: Icons.Database,
[eventCodes.MYSQL_PROCESS_KILL]: Icons.Database,
[eventCodes.MYSQL_DEBUG]: Icons.Database,
[eventCodes.MYSQL_REFRESH]: Icons.Database,
[eventCodes.DESKTOP_SESSION_STARTED]: Icons.Desktop,
[eventCodes.DESKTOP_SESSION_STARTED_FAILED]: Icons.Desktop,
[eventCodes.DESKTOP_SESSION_ENDED]: Icons.Desktop,
Expand Down
263 changes: 261 additions & 2 deletions packages/teleport/src/Audit/__snapshots__/Audit.story.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,12 @@ exports[`list of all events 1`] = `
</strong>
-
<strong>
73
80
</strong>
of
<strong>
73
80
</strong>
</div>
<button
Expand Down Expand Up @@ -403,6 +403,265 @@ exports[`list of all events 1`] = `
</tr>
</thead>
<tbody>
<tr>
<td
style="vertical-align: inherit;"
>
<div
class="c11"
>
<span
class="c7 c12 icon icon-database c7 c12"
color="light"
font-size="3"
/>
MySQL Change Database
</div>
</td>
<td
style="word-break: break-word;"
>
User [alice@example.com] has changed default database to [another_database] on [self-hosted-mysql]
</td>
<td
style="min-width: 120px;"
>
2022-04-13 20:00:10
</td>
<td
align="right"
>
<button
class="c13"
kind="border"
width="87px"
>
Details
</button>
</td>
</tr>
<tr>
<td
style="vertical-align: inherit;"
>
<div
class="c11"
>
<span
class="c7 c12 icon icon-database c7 c12"
color="light"
font-size="3"
/>
MySQL Create Database
</div>
</td>
<td
style="word-break: break-word;"
>
User [alice@example.com] has created database [another_database] on [self-hosted-mysql]
</td>
<td
style="min-width: 120px;"
>
2022-04-13 20:00:09
</td>
<td
align="right"
>
<button
class="c13"
kind="border"
width="87px"
>
Details
</button>
</td>
</tr>
<tr>
<td
style="vertical-align: inherit;"
>
<div
class="c11"
>
<span
class="c7 c12 icon icon-database c7 c12"
color="light"
font-size="3"
/>
MySQL Drop Database
</div>
</td>
<td
style="word-break: break-word;"
>
User [alice@example.com] has dropped database [another_database] on [self-hosted-mysql]
</td>
<td
style="min-width: 120px;"
>
2022-04-13 20:00:08
</td>
<td
align="right"
>
<button
class="c13"
kind="border"
width="87px"
>
Details
</button>
</td>
</tr>
<tr>
<td
style="vertical-align: inherit;"
>
<div
class="c11"
>
<span
class="c7 c12 icon icon-database c7 c12"
color="light"
font-size="3"
/>
MySQL Shut Down
</div>
</td>
<td
style="word-break: break-word;"
>
User [alice@example.com] has attempted to shut down [self-hosted-mysql]
</td>
<td
style="min-width: 120px;"
>
2022-04-13 20:00:07
</td>
<td
align="right"
>
<button
class="c13"
kind="border"
width="87px"
>
Details
</button>
</td>
</tr>
<tr>
<td
style="vertical-align: inherit;"
>
<div
class="c11"
>
<span
class="c7 c12 icon icon-database c7 c12"
color="light"
font-size="3"
/>
MySQL Kill Process
</div>
</td>
<td
style="word-break: break-word;"
>
User [alice@example.com] has attempted to kill process [60] on [self-hosted-mysql]
</td>
<td
style="min-width: 120px;"
>
2022-04-13 20:00:06
</td>
<td
align="right"
>
<button
class="c13"
kind="border"
width="87px"
>
Details
</button>
</td>
</tr>
<tr>
<td
style="vertical-align: inherit;"
>
<div
class="c11"
>
<span
class="c7 c12 icon icon-database c7 c12"
color="light"
font-size="3"
/>
MySQL Debug
</div>
</td>
<td
style="word-break: break-word;"
>
User [alice@example.com] has asked [self-hosted-mysql] to dump debug information
</td>
<td
style="min-width: 120px;"
>
2022-04-13 20:00:05
</td>
<td
align="right"
>
<button
class="c13"
kind="border"
width="87px"
>
Details
</button>
</td>
</tr>
<tr>
<td
style="vertical-align: inherit;"
>
<div
class="c11"
>
<span
class="c7 c12 icon icon-database c7 c12"
color="light"
font-size="3"
/>
MySQL Refresh
</div>
</td>
<td
style="word-break: break-word;"
>
User [alice@example.com] has sent command [REFRESH_THREADS] to [self-hosted-mysql]
</td>
<td
style="min-width: 120px;"
>
2022-04-13 20:00:04
</td>
<td
align="right"
>
<button
class="c13"
kind="border"
width="87px"
>
Details
</button>
</td>
</tr>
<tr>
<td
style="vertical-align: inherit;"
Expand Down
89 changes: 89 additions & 0 deletions packages/teleport/src/Audit/fixtures/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,95 @@ export const events = [
time: "2022-02-10T20:57:53.000Z",
user: "alice@example.com"
},
{
cluster_name: "im-a-cluster-name",
code: "TMY07I",
db_name: "test",
db_protocol: "mysql",
db_service: "self-hosted-mysql",
db_uri: "localhost:3306",
db_user: "alice",
event: "db.session.mysql.init_db",
schema_name: "another_database",
time: "2022-04-13T20:00:10.000Z",
user: "alice@example.com"
},
{
cluster_name: "im-a-cluster-name",
code: "TMY08I",
db_name: "test",
db_protocol: "mysql",
db_service: "self-hosted-mysql",
db_uri: "localhost:3306",
db_user: "alice",
event: "db.session.mysql.create_db",
schema_name: "another_database",
time: "2022-04-13T20:00:09.000Z",
user: "alice@example.com"
},
{
cluster_name: "im-a-cluster-name",
code: "TMY09I",
db_name: "test",
db_protocol: "mysql",
db_service: "self-hosted-mysql",
db_uri: "localhost:3306",
db_user: "alice",
event: "db.session.mysql.drop_db",
schema_name: "another_database",
time: "2022-04-13T20:00:08.000Z",
user: "alice@example.com"
},
{
cluster_name: "im-a-cluster-name",
code: "TMY10I",
db_name: "test",
db_protocol: "mysql",
db_service: "self-hosted-mysql",
db_uri: "localhost:3306",
db_user: "alice",
event: "db.session.mysql.shut_down",
time: "2022-04-13T20:00:07.000Z",
user: "alice@example.com"
},
{
cluster_name: "im-a-cluster-name",
code: "TMY11I",
db_name: "test",
db_protocol: "mysql",
db_service: "self-hosted-mysql",
db_uri: "localhost:3306",
db_user: "alice",
event: "db.session.mysql.process_kill",
process_id: 60,
time: "2022-04-13T20:00:06.000Z",
user: "alice@example.com"
},
{
cluster_name: "im-a-cluster-name",
code: "TMY12I",
db_name: "test",
db_protocol: "mysql",
db_service: "self-hosted-mysql",
db_uri: "localhost:3306",
db_user: "alice",
event: "db.session.mysql.debug",
time: "2022-04-13T20:00:05.000Z",
user: "alice@example.com"
},
{
cluster_name: "im-a-cluster-name",
code: "TMY13I",
db_name: "test",
db_protocol: "mysql",
db_service: "self-hosted-mysql",
db_uri: "localhost:3306",
db_user: "alice",
event: "db.session.mysql.refresh",
subcommand: "REFRESH_THREADS",
time: "2022-04-13T20:00:04.000Z",
user: "alice@example.com"
},
].map(makeEvent);

export const eventsSample = [
Expand Down
Loading

0 comments on commit 457a99e

Please sign in to comment.