← CockroachDBCONTENT HISTORY
WHAT CHANGED
Update to CockroachDB
Snapshot Oct 28, 2026 · 18:07 UTC · version 0.1.3
Collection source: downloaded plugin package.
First saved snapshot
No earlier snapshot is available to establish a change.
Save CockroachDB and check future changes in Following.
Up to 10 plugins free · no card required.
Compare saved observations
Download comparison JSONFull technical diff · 0 changed fields
Full snapshot data
{
"description": "Configures and enforces password policies on CockroachDB clusters including minimum length, complexity requirements, and hash cost settings. Use when strengthening authentication requirements, setting up password policies for a new cluster, or meeting compliance password standards.",
"included_files": [
{
"relative_path": "references/sql-queries.md",
"size_in_bytes": 3814
}
],
"name": "enforcing-password-policies",
"skill_md_contents": "---\nname: enforcing-password-policies\ndescription: Configures and enforces password policies on CockroachDB clusters including minimum length, complexity requirements, and hash cost settings. Use when strengthening authentication requirements, setting up password policies for a new cluster, or meeting compliance password standards.\ncompatibility: Requires admin role for cluster setting changes.\n---\n\n# Enforcing Password Policies\n\nConfigures and enforces password policies on CockroachDB clusters by setting minimum password length and bcrypt hash cost. Ensures password strength meets organizational and compliance requirements.\n\n## When to Use This Skill\n\n- Strengthening password requirements to meet compliance standards (SOC 2, HIPAA, NIST 800-63B)\n- Setting up password policies for a new production cluster\n- Responding to a security audit finding about weak password policies\n- Increasing bcrypt hash cost to improve resistance against brute-force attacks\n\n## Prerequisites\n\n- **SQL access** with admin role (required to modify cluster settings)\n- **Understanding of impact:** Password policy changes affect new passwords only, not existing passwords\n\n**Check your access:**\n```sql\nSELECT member FROM [SHOW GRANTS ON ROLE admin] WHERE member = current_user();\n```\n\n## Steps\n\n### 1. Check Current Password Policy Settings\n\n```sql\n-- Minimum password length\nSHOW CLUSTER SETTING server.user_login.min_password_length;\n\n-- Password hash cost (bcrypt rounds)\nSHOW CLUSTER SETTING server.user_login.password_hashes.default_cost.crdb_bcrypt;\n```\n\nSee [SQL queries reference](references/sql-queries.md) for additional password-related queries.\n\n### 2. Set Minimum Password Length\n\n```sql\n-- Set minimum password length to 12 characters (recommended)\nSET CLUSTER SETTING server.user_login.min_password_length = 12;\n```\n\n**Recommended minimums by compliance framework:**\n\n| Framework | Minimum Length | Recommendation |\n|-----------|---------------|----------------|\n| NIST 800-63B | 8 characters | 12+ recommended |\n| SOC 2 | 8 characters | 12+ recommended |\n| HIPAA | 8 characters | 12+ recommended |\n| PCI DSS | 7 characters | 12+ recommended |\n| Internal best practice | — | 14+ for admin accounts |\n\n### 3. Configure Hash Cost\n\nThe bcrypt hash cost controls how computationally expensive password hashing is. Higher values make brute-force attacks slower but increase CPU during authentication.\n\n```sql\n-- Set bcrypt hash cost (default: 10, recommended: 12)\nSET CLUSTER SETTING server.user_login.password_hashes.default_cost.crdb_bcrypt = 12;\n```\n\n**Hash cost guidance:**\n\n| Cost | Time per Hash (approx.) | Recommendation |\n|------|------------------------|----------------|\n| 10 | ~100ms | Default, acceptable for most |\n| 12 | ~400ms | Recommended for production |\n| 14 | ~1.5s | High security, slower logins |\n\n**Trade-off:** Higher cost means slower password verification, which affects login latency. Cost 12 is a good balance.\n\n### 4. Verify Enforcement\n\n```sql\n-- Confirm settings\nSHOW CLUSTER SETTING server.user_login.min_password_length;\nSHOW CLUSTER SETTING server.user_login.password_hashes.default_cost.crdb_bcrypt;\n```\n\n**Test enforcement:**\n```sql\n-- This should fail if min_password_length is 12\nCREATE USER test_weak_password WITH PASSWORD 'short';\n-- Expected: ERROR: password too short\n\n-- This should succeed\nCREATE USER test_strong_password WITH PASSWORD 'a-secure-password-123';\nDROP USER test_strong_password;\n```\n\n### 5. Address Existing Users with Weak Passwords\n\nPassword policy changes only apply to new passwords. Existing users retain their old passwords until they change them.\n\n**Options for enforcing password rotation:**\n1. **Communicate the policy change** and ask users to update their passwords\n2. **Expire existing passwords** by requiring a password change on next login (if supported by your application layer)\n3. **Reset passwords administratively** for critical accounts:\n\n```sql\n-- Reset a user's password (forces them to use a new, policy-compliant password)\nALTER USER <username> WITH PASSWORD '<new-strong-password>';\n```\n\n### 6. Manage Password Changes and Rotation\n\n#### User Self-Service Password Changes\n\nSQL users can change their own passwords:\n\n```sql\n-- User changes their own password (CURRENT_USER, no parens)\nALTER USER CURRENT_USER WITH PASSWORD '<new-password>';\n```\n\n**Note:** Non-admin users can change their own passwords by default. If users report they cannot change their password, verify they are connected as the correct user and that there are no HBA rules blocking password-based authentication.\n\n#### Administrative Password Reset\n\n```sql\n-- Admin resets another user's password\nALTER USER <username> WITH PASSWORD '<new-strong-password>';\n\n-- Verify the user exists before resetting\nSELECT username FROM [SHOW USERS] WHERE username = '<username>';\n```\n\n#### Cloud Console vs SQL Passwords\n\nCockroachDB Cloud has two separate password domains:\n- **Cloud Console password** — Managed via Cloud Console UI or SSO. Reset via the Cloud Console login page \"Forgot password\" flow.\n- **SQL user password** — Managed via SQL `ALTER USER`. Independent of the Cloud Console password.\n\nChanging one does not affect the other. Users must manage both if they use both access methods.\n\n#### Password Rotation Best Practices\n\n- Rotate service account passwords on a regular schedule (e.g., every 90 days)\n- Use certificate-based authentication for service accounts to avoid password rotation entirely\n- Coordinate password rotation with application deployment cycles to avoid downtime\n- After changing a password, verify the application can connect with the new credentials before decommissioning the old password\n\n### 7. Troubleshoot Common Password Errors\n\n#### \"password too short\"\n\nThe password does not meet the `min_password_length` setting.\n\n```sql\n-- Check the current minimum\nSHOW CLUSTER SETTING server.user_login.min_password_length;\n```\n\nFix: Use a longer password that meets or exceeds the minimum length.\n\n#### \"bcrypt password hash too long\"\n\nThe password exceeds the bcrypt input limit of 72 bytes. This can occur with very long passwords or multi-byte Unicode characters.\n\n```sql\n-- Workaround: use a shorter password (under 72 bytes)\nALTER USER <username> WITH PASSWORD '<shorter-password>';\n```\n\nThis is a bcrypt limitation, not a CockroachDB-specific issue.\n\n#### Authentication failures after password change\n\nIf users report authentication failures immediately after changing their password:\n\n1. Verify the password was set correctly (no copy-paste whitespace)\n2. Check for connection pool caching of old credentials — restart the connection pool\n3. Verify the HBA configuration allows password authentication:\n ```sql\n SHOW CLUSTER SETTING server.host_based_authentication.configuration;\n ```\n\n## Safety Considerations\n\n- **New passwords only:** Changing `min_password_length` does not invalidate existing passwords. Users with short passwords can still log in until they change their password.\n- **Hash cost latency:** Increasing `crdb_bcrypt` cost increases login time. Test with realistic connection pools before setting cost above 12.\n- **Service accounts:** Ensure service accounts use strong passwords or certificate-based authentication (certificates bypass password policy).\n\n## Rollback\n\n```sql\n-- Reset minimum password length to default (1 = no minimum)\nSET CLUSTER SETTING server.user_login.min_password_length = 1;\n\n-- Reset hash cost to default\nRESET CLUSTER SETTING server.user_login.password_hashes.default_cost.crdb_bcrypt;\n```\n\n## References\n\n**Skill references:**\n- [SQL queries for password policies](references/sql-queries.md)\n\n**Related skills:**\n- [auditing-cloud-cluster-security](../audit-cloud-security/SKILL.md) — Run a full security posture audit\n- [configuring-sso-and-scim](../configuring-sso-and-scim/SKILL.md) — Use SSO to eliminate password-based authentication\n- [managing-tls-certificates](../managing-tls-certificates/SKILL.md) — Use certificate-based authentication instead of passwords\n\n**Official CockroachDB Documentation:**\n- [Cluster Settings Reference](https://www.cockroachlabs.com/docs/stable/cluster-settings.html)\n- [CREATE USER](https://www.cockroachlabs.com/docs/stable/create-user.html)\n- [ALTER USER](https://www.cockroachlabs.com/docs/stable/alter-user.html)\n- [Security Overview](https://www.cockroachlabs.com/docs/stable/security-reference/security-overview.html)\n- [Authentication](https://www.cockroachlabs.com/docs/stable/authentication.html)\n"
}SHA-256 of public snapshot: 11be7b2ca6762f9f8aafb30bc05e47a5227925059d47b03a11fb9757b176985b