mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-25 12:06:37 +00:00
Add ssh access log
This commit is contained in:
@@ -24,6 +24,7 @@ import {
|
|||||||
sites,
|
sites,
|
||||||
userOrgs
|
userOrgs
|
||||||
} from "@server/db";
|
} from "@server/db";
|
||||||
|
import { logAccessAudit } from "#private/lib/logAccessAudit";
|
||||||
import { isLicensedOrSubscribed } from "#private/lib/isLicencedOrSubscribed";
|
import { isLicensedOrSubscribed } from "#private/lib/isLicencedOrSubscribed";
|
||||||
import { tierMatrix } from "@server/lib/billing/tierMatrix";
|
import { tierMatrix } from "@server/lib/billing/tierMatrix";
|
||||||
import response from "@server/lib/response";
|
import response from "@server/lib/response";
|
||||||
@@ -463,6 +464,24 @@ export async function signSshKey(
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await logAccessAudit({
|
||||||
|
action: true,
|
||||||
|
type: "ssh",
|
||||||
|
orgId: orgId,
|
||||||
|
resourceId: resource.siteResourceId,
|
||||||
|
user: req.user
|
||||||
|
? { username: req.user.username ?? "", userId: req.user.userId }
|
||||||
|
: undefined,
|
||||||
|
metadata: {
|
||||||
|
resourceName: resource.name,
|
||||||
|
siteId: resource.siteId,
|
||||||
|
sshUsername: usernameToUse,
|
||||||
|
sshHost: sshHost
|
||||||
|
},
|
||||||
|
userAgent: req.headers["user-agent"],
|
||||||
|
requestIp: req.ip
|
||||||
|
});
|
||||||
|
|
||||||
return response<SignSshKeyResponse>(res, {
|
return response<SignSshKeyResponse>(res, {
|
||||||
data: {
|
data: {
|
||||||
certificate: cert.certificate,
|
certificate: cert.certificate,
|
||||||
|
|||||||
@@ -493,7 +493,8 @@ export default function GeneralPage() {
|
|||||||
{
|
{
|
||||||
value: "whitelistedEmail",
|
value: "whitelistedEmail",
|
||||||
label: "Whitelisted Email"
|
label: "Whitelisted Email"
|
||||||
}
|
},
|
||||||
|
{ value: "ssh", label: "SSH" }
|
||||||
]}
|
]}
|
||||||
selectedValue={filters.type}
|
selectedValue={filters.type}
|
||||||
onValueChange={(value) =>
|
onValueChange={(value) =>
|
||||||
@@ -507,13 +508,12 @@ export default function GeneralPage() {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
cell: ({ row }) => {
|
cell: ({ row }) => {
|
||||||
// should be capitalized first letter
|
const typeLabel =
|
||||||
return (
|
row.original.type === "ssh"
|
||||||
<span>
|
? "SSH"
|
||||||
{row.original.type.charAt(0).toUpperCase() +
|
: row.original.type.charAt(0).toUpperCase() +
|
||||||
row.original.type.slice(1) || "-"}
|
row.original.type.slice(1);
|
||||||
</span>
|
return <span>{typeLabel || "-"}</span>;
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user