mirror of
https://github.com/rustfs/console.git
synced 2026-09-01 15:17:45 +08:00
feat: add audit target management
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
export function canManageAuditTargets(auditEnabled) {
|
||||
return auditEnabled !== false
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export function canManageAuditTargets(auditEnabled: boolean | undefined) {
|
||||
return auditEnabled !== false
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
export const AUDIT_TARGET_CONFIG_OPTIONS = {
|
||||
Kafka: [
|
||||
{ label: "KAFKA_BROKERS", name: "brokers", type: "text" },
|
||||
{ label: "KAFKA_TOPIC", name: "topic", type: "text" },
|
||||
{ label: "KAFKA_ACKS", name: "acks", type: "text" },
|
||||
{ label: "KAFKA_TLS_ENABLE", name: "tls_enable", type: "text" },
|
||||
{ label: "KAFKA_TLS_CA", name: "tls_ca", type: "text" },
|
||||
{ label: "KAFKA_TLS_CLIENT_CERT", name: "tls_client_cert", type: "text" },
|
||||
{ label: "KAFKA_TLS_CLIENT_KEY", name: "tls_client_key", type: "text" },
|
||||
{ label: "KAFKA_QUEUE_DIR", name: "queue_dir", type: "text" },
|
||||
{ label: "KAFKA_QUEUE_LIMIT", name: "queue_limit", type: "number" },
|
||||
{ label: "COMMENT_KEY", name: "comment", type: "text" },
|
||||
],
|
||||
MQTT: [
|
||||
{ label: "MQTT_BROKER", name: "broker", type: "text" },
|
||||
{ label: "MQTT_TOPIC", name: "topic", type: "text" },
|
||||
{ label: "MQTT_QOS", name: "qos", type: "number" },
|
||||
{ label: "MQTT_USERNAME", name: "username", type: "text" },
|
||||
{ label: "MQTT_PASSWORD", name: "password", type: "password" },
|
||||
{ label: "MQTT_RECONNECT_INTERVAL", name: "reconnect_interval", type: "number" },
|
||||
{ label: "MQTT_KEEP_ALIVE_INTERVAL", name: "keep_alive_interval", type: "number" },
|
||||
{ label: "MQTT_QUEUE_DIR", name: "queue_dir", type: "text" },
|
||||
{ label: "MQTT_QUEUE_LIMIT", name: "queue_limit", type: "number" },
|
||||
{ label: "MQTT_TLS_POLICY", name: "tls_policy", type: "text" },
|
||||
{ label: "MQTT_TLS_CA", name: "tls_ca", type: "text" },
|
||||
{ label: "MQTT_TLS_CLIENT_CERT", name: "tls_client_cert", type: "text" },
|
||||
{ label: "MQTT_TLS_CLIENT_KEY", name: "tls_client_key", type: "text" },
|
||||
{ label: "MQTT_TLS_TRUST_LEAF_AS_CA", name: "tls_trust_leaf_as_ca", type: "text" },
|
||||
{ label: "MQTT_WS_PATH_ALLOWLIST", name: "ws_path_allowlist", type: "text" },
|
||||
{ label: "COMMENT_KEY", name: "comment", type: "text" },
|
||||
],
|
||||
Webhook: [
|
||||
{ label: "WEBHOOK_ENDPOINT", name: "endpoint", type: "text" },
|
||||
{ label: "WEBHOOK_AUTH_TOKEN", name: "auth_token", type: "text" },
|
||||
{ label: "WEBHOOK_QUEUE_LIMIT", name: "queue_limit", type: "number" },
|
||||
{ label: "WEBHOOK_QUEUE_DIR", name: "queue_dir", type: "text" },
|
||||
{ label: "WEBHOOK_CLIENT_CERT", name: "client_cert", type: "text" },
|
||||
{ label: "WEBHOOK_CLIENT_KEY", name: "client_key", type: "text" },
|
||||
{ label: "WEBHOOK_CLIENT_CA", name: "client_ca", type: "text" },
|
||||
{ label: "WEBHOOK_SKIP_TLS_VERIFY", name: "skip_tls_verify", type: "text" },
|
||||
{ label: "COMMENT_KEY", name: "comment", type: "text" },
|
||||
],
|
||||
NATS: [
|
||||
{ label: "NATS_ADDRESS", name: "address", type: "text" },
|
||||
{ label: "NATS_SUBJECT", name: "subject", type: "text" },
|
||||
{ label: "NATS_USERNAME", name: "username", type: "text" },
|
||||
{ label: "NATS_PASSWORD", name: "password", type: "password" },
|
||||
{ label: "NATS_TOKEN", name: "token", type: "text" },
|
||||
{ label: "NATS_CREDENTIALS_FILE", name: "credentials_file", type: "text" },
|
||||
{ label: "NATS_TLS_CA", name: "tls_ca", type: "text" },
|
||||
{ label: "NATS_TLS_CLIENT_CERT", name: "tls_client_cert", type: "text" },
|
||||
{ label: "NATS_TLS_CLIENT_KEY", name: "tls_client_key", type: "text" },
|
||||
{ label: "NATS_TLS_REQUIRED", name: "tls_required", type: "text" },
|
||||
{ label: "NATS_QUEUE_DIR", name: "queue_dir", type: "text" },
|
||||
{ label: "NATS_QUEUE_LIMIT", name: "queue_limit", type: "number" },
|
||||
{ label: "COMMENT_KEY", name: "comment", type: "text" },
|
||||
],
|
||||
Pulsar: [
|
||||
{ label: "PULSAR_BROKER", name: "broker", type: "text" },
|
||||
{ label: "PULSAR_TOPIC", name: "topic", type: "text" },
|
||||
{ label: "PULSAR_AUTH_TOKEN", name: "auth_token", type: "text" },
|
||||
{ label: "PULSAR_USERNAME", name: "username", type: "text" },
|
||||
{ label: "PULSAR_PASSWORD", name: "password", type: "password" },
|
||||
{ label: "PULSAR_TLS_CA", name: "tls_ca", type: "text" },
|
||||
{ label: "PULSAR_TLS_ALLOW_INSECURE", name: "tls_allow_insecure", type: "text" },
|
||||
{ label: "PULSAR_TLS_HOSTNAME_VERIFICATION", name: "tls_hostname_verification", type: "text" },
|
||||
{ label: "PULSAR_QUEUE_DIR", name: "queue_dir", type: "text" },
|
||||
{ label: "PULSAR_QUEUE_LIMIT", name: "queue_limit", type: "number" },
|
||||
{ label: "COMMENT_KEY", name: "comment", type: "text" },
|
||||
],
|
||||
}
|
||||
|
||||
export const AUDIT_TARGET_TYPE_OPTIONS = [
|
||||
{
|
||||
labelKey: "Kafka",
|
||||
value: "Kafka",
|
||||
icon: "/svg/kafka.svg",
|
||||
descKey: "Send audit logs via Kafka",
|
||||
},
|
||||
{
|
||||
labelKey: "MQTT",
|
||||
value: "MQTT",
|
||||
icon: "/svg/mqtt.svg",
|
||||
descKey: "Send audit logs via MQTT broker",
|
||||
},
|
||||
{
|
||||
labelKey: "Webhook",
|
||||
value: "Webhook",
|
||||
icon: "/svg/webhooks.svg",
|
||||
descKey: "Send audit logs to HTTP endpoints",
|
||||
},
|
||||
{
|
||||
labelKey: "NATS",
|
||||
value: "NATS",
|
||||
icon: "/svg/nats.svg",
|
||||
descKey: "Send audit logs via NATS",
|
||||
},
|
||||
{
|
||||
labelKey: "Pulsar",
|
||||
value: "Pulsar",
|
||||
icon: "/svg/pulsar.svg",
|
||||
descKey: "Send audit logs via Pulsar",
|
||||
},
|
||||
]
|
||||
|
||||
export const AUDIT_TARGET_TYPE_MAPPING = {
|
||||
Kafka: "audit_kafka",
|
||||
MQTT: "audit_mqtt",
|
||||
Webhook: "audit_webhook",
|
||||
NATS: "audit_nats",
|
||||
Pulsar: "audit_pulsar",
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import {
|
||||
AUDIT_TARGET_CONFIG_OPTIONS as JS_AUDIT_TARGET_CONFIG_OPTIONS,
|
||||
AUDIT_TARGET_TYPE_MAPPING as JS_AUDIT_TARGET_TYPE_MAPPING,
|
||||
AUDIT_TARGET_TYPE_OPTIONS as JS_AUDIT_TARGET_TYPE_OPTIONS,
|
||||
} from "./audit-target-config.js"
|
||||
|
||||
export type AuditTargetType = "Kafka" | "MQTT" | "Webhook" | "NATS" | "Pulsar"
|
||||
|
||||
export type AuditTargetConfigField = {
|
||||
label: string
|
||||
name: string
|
||||
type: "text" | "password" | "number"
|
||||
}
|
||||
|
||||
export const AUDIT_TARGET_CONFIG_OPTIONS = JS_AUDIT_TARGET_CONFIG_OPTIONS as Record<
|
||||
AuditTargetType,
|
||||
AuditTargetConfigField[]
|
||||
>
|
||||
|
||||
export const AUDIT_TARGET_TYPE_OPTIONS = JS_AUDIT_TARGET_TYPE_OPTIONS as Array<{
|
||||
labelKey: string
|
||||
value: AuditTargetType
|
||||
icon: string
|
||||
descKey: string
|
||||
}>
|
||||
|
||||
export const AUDIT_TARGET_TYPE_MAPPING = JS_AUDIT_TARGET_TYPE_MAPPING as Record<AuditTargetType, string>
|
||||
@@ -36,6 +36,7 @@ export const PAGE_PERMISSIONS: Record<string, ConsoleScope[]> = {
|
||||
"/lifecycle": [CONSOLE_SCOPES.VIEW_BUCKET_LIFECYCLE],
|
||||
"/tiers": [CONSOLE_SCOPES.VIEW_TIERED_STORAGE],
|
||||
"/events-target": [CONSOLE_SCOPES.VIEW_EVENT_DESTINATIONS],
|
||||
"/audit-target": [CONSOLE_SCOPES.VIEW_EVENT_DESTINATIONS],
|
||||
"/sse": [CONSOLE_SCOPES.VIEW_SSE_SETTINGS],
|
||||
"/oidc": [CONSOLE_SCOPES.VIEW_OIDC_SETTINGS],
|
||||
"/settings": [CONSOLE_SCOPES.VIEW_SETTINGS],
|
||||
|
||||
@@ -19,6 +19,7 @@ export const MENU_CONTROLLED_DASHBOARD_ROUTES: readonly string[] = [
|
||||
"/status",
|
||||
"/tiers",
|
||||
"/events-target",
|
||||
"/audit-target",
|
||||
"/sse",
|
||||
"/oidc",
|
||||
"/settings",
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
RiBarChartBoxLine,
|
||||
RiStackLine,
|
||||
RiBookmark3Line,
|
||||
RiFileShield2Line,
|
||||
RiSecurePaymentLine,
|
||||
RiSettingsLine,
|
||||
RiFingerprintLine,
|
||||
@@ -34,6 +35,7 @@ const iconMap: Record<string, ComponentType<{ className?: string }>> = {
|
||||
"ri:bar-chart-box-line": RiBarChartBoxLine,
|
||||
"ri:stack-line": RiStackLine,
|
||||
"ri:bookmark-3-line": RiBookmark3Line,
|
||||
"ri:file-shield-2-line": RiFileShield2Line,
|
||||
"ri:secure-payment-line": RiSecurePaymentLine,
|
||||
"ri:settings-line": RiSettingsLine,
|
||||
"ri:fingerprint-line": RiFingerprintLine,
|
||||
|
||||
Reference in New Issue
Block a user