Skip to main content
Glama

who_shelled_into_pod

Retrieve Kubernetes audit logs to identify users who accessed pods via shell sessions for security monitoring and compliance verification.

Instructions

Get k8s audit logs with information about users who shelled into a pod

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoOptional Pod name
namespaceNoOptional Pod namespace
cluster_idNoOptional Cluster ID
from_timeNoStart time of the time range to search for audit events. Example: 2024-01-01T00:00:00Z. Default: 7 days ago
to_timeNoEnd time of the time range to search for audit events. Example: 2024-01-03T00:00:00Z
limitNoMaximum number of results to return
pageNoPage number to return

Implementation Reference

  • The handler function that executes the core logic of the 'who_shelled_into_pod' tool. It constructs API parameters for k8s_audit_logs_anomaly findings with rule A001, fetches violations from the RAD Security API, filters them by pod name and namespace, and returns matching audit logs.
    export async function whoShelledIntoPod( client: RadSecurityClient, name?: string, namespace?: string, cluster_id?: string, from_time: string = "now-7d", to_time: string = "", limit: number = 20, page: number = 1 ): Promise<any> { const params: Record<string, any> = { types: "k8s_audit_logs_anomaly", rule_ids: "A001", from: from_time , to: to_time, page: page, page_size: limit, }; if (cluster_id) { params.cluster_ids = cluster_id; } const violations = await client.makeRequest( `/accounts/${client.getAccountId()}/findings`, params ); const toReturn = []; for (const violation of violations.entries) { const auditLog = violation.source; if (!auditLog) { continue; } let match = true; if (name) { if (auditLog.objectRef && auditLog.objectRef.name !== name) { match = false; } } if (namespace) { if (auditLog.objectRef && auditLog.objectRef.namespace !== namespace) { match = false; } } if (match) { toReturn.push(auditLog); } } violations.entries = toReturn; return violations; }
  • Zod schema defining the input parameters and validation for the 'who_shelled_into_pod' tool.
    export const WhoShelledIntoPodSchema = z.object({ name: z.string().optional().describe("Optional Pod name"), namespace: z.string().optional().describe("Optional Pod namespace"), cluster_id: z.string().optional().describe("Optional Cluster ID"), from_time: z.string().optional().describe("Start time of the time range to search for audit events. Example: 2024-01-01T00:00:00Z. Default: 7 days ago"), to_time: z.string().optional().describe("End time of the time range to search for audit events. Example: 2024-01-03T00:00:00Z"), limit: z.number().optional().default(20).describe("Maximum number of results to return"), page: z.number().optional().default(1).describe("Page number to return"), });
  • src/index.ts:182-187 (registration)
    Registration of the tool in the ListTools handler, specifying name, description, and input schema.
    { name: "who_shelled_into_pod", description: "Get k8s audit logs with information about users who shelled into a pod", inputSchema: zodToJsonSchema(audit.WhoShelledIntoPodSchema), },
  • src/index.ts:817-836 (registration)
    Handler case in the CallToolRequest switch statement that parses arguments, invokes the whoShelledIntoPod function with the client, and formats the response.
    case "who_shelled_into_pod": { const args = audit.WhoShelledIntoPodSchema.parse( request.params.arguments ); const response = await audit.whoShelledIntoPod( client, args.name, args.namespace, args.cluster_id, args.from_time, args.to_time, args.limit, args.page ); return { content: [ { type: "text", text: JSON.stringify(response, null, 2) }, ], }; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rad-security/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server