Index of every page on this site: llms.txt
All skills
jeremylongshore avatar

/clickhouse-security-basics

@0d57af8
Run it yourself

Secure ClickHouse with user management, network restrictions, TLS, and audit logging. Use when hardening a ClickHouse deployment, creating restricted users, enforcing multi-tenant row isolation, or configuring network-level access controls. Trigger with "clickhouse security", "clickhouse user management", "secure clickhouse", "clickhouse TLS", "clickhouse access control", "clickhouse firewall".

Use this Skill: https://skilld.dev/gh/jeremylongshore/tons-of-skills-marketplace/clickhouse-security-basics

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesexamples.md

≈610 tokens on demand. Your agent reads this file only when SKILL.md points to it.

ClickHouse Security — Worked Examples

Concrete end-to-end scenarios that combine the steps in implementation.md.

Example 1: Stand up a least-privilege analyst

Goal: a BI user who can only read the analytics database, capped at 5GB/query and a 60s timeout, with no ability to mutate data.

CREATE USER analyst
    IDENTIFIED WITH sha256_password BY 'strong-password-here'
    DEFAULT DATABASE analytics
    SETTINGS readonly = 1, max_memory_usage = 5000000000, max_execution_time = 60;

CREATE ROLE data_reader;
GRANT SELECT ON analytics.* TO data_reader;
GRANT data_reader TO analyst;

SHOW GRANTS FOR analyst;
-- Expect: GRANT SELECT ON analytics.* TO analyst (via data_reader)

Example 2: Multi-tenant isolation with a row policy

Goal: every tenant user sees only their own rows in analytics.events.

CREATE USER tenant_42
    IDENTIFIED WITH sha256_password BY 'pass'
    SETTINGS custom_tenant_id = 42;

CREATE ROW POLICY tenant_filter ON analytics.events
    FOR SELECT
    USING tenant_id = getSetting('custom_tenant_id')
    TO tenant_42;

-- Verify the policy is active
SHOW ROW POLICIES;

Example 3: Lock the app user to the VPC and require TLS

-- Restrict where the app user can connect from (ClickHouse 22.6+)
CREATE USER app_writer
    IDENTIFIED WITH sha256_password BY 'pass'
    HOST IP '10.0.0.0/8', IP '172.16.0.0/12';

GRANT SELECT, INSERT ON analytics.* TO app_writer;
REVOKE DROP, ALTER, CREATE ON *.* FROM app_writer;
import { createClient } from '@clickhouse/client';

const client = createClient({
  url: 'https://your-host:8443',        // HTTPS on the TLS port, never :8123 HTTP
  username: 'app_writer',                // minimal-privilege, not 'default'
  password: process.env.CH_PASSWORD!,    // from a secret manager
  database: 'analytics',
});

Example 4: Audit the last hour and hunt failed logins

-- Who ran what in the last hour (excluding system noise)
SELECT event_time, user, client_hostname, query_kind,
       substring(query, 1, 200) AS query_preview, exception_code
FROM system.query_log
WHERE event_time >= now() - INTERVAL 1 HOUR AND user NOT IN ('default')
ORDER BY event_time DESC
LIMIT 50;

-- Brute-force / bad-credential signal
SELECT event_time, user, client_hostname, exception
FROM system.query_log
WHERE exception_code = 516  -- AUTHENTICATION_FAILED
ORDER BY event_time DESC;

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts2mo3 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    The skill provides legitimate security hardening guidelines and code snippets for ClickHouse deployments. It promotes best practices such as least-privilege access, TLS encryption, network restrictions, and audit logging. No malicious patterns or security risks were detected.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

Signed by skilld at 0d57af8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 4 months ago
What it can do
Reads files
version
1.7.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
[
  "saas",
  "database",
  "analytics",
  "clickhouse",
  "olap"
]
All 1 allowed tools
Read
Other metadata
compatibility
Designed for Claude Code

README badge

README badge for jeremylongshore/tons-of-skills-marketplace/clickhouse-security-basics