Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit system user login #579

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Unreleased

* Added the Prometheus annotations to ``grandCentral`` to allow metrics scrapping on it.

* Restricted system user login to 10.0.0.0/8


2.33.0 (2023-11-14)
-------------------
Expand Down
3 changes: 3 additions & 0 deletions crate/operator/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ class Config:
#: backup when restoring a snapshot.
RESTORE_BACKUP_SECRET_NAME = "restore-from-backup-{name}"

#: CIDR the system user is allowed to login from.
ALLOWED_SYSTEM_USER_CIDR = "10.0.0.0/8"

def __init__(self, *, prefix: str):
self._prefix = prefix

Expand Down
2 changes: 2 additions & 0 deletions crate/operator/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,8 @@ def get_statefulset_crate_command(
"-Cauth.host_based.config.0.user": "crate",
"-Cauth.host_based.config.0.address": "_local_",
"-Cauth.host_based.config.0.method": "trust",
"-Cauth.host_based.config.1.user": "system",
"-Cauth.host_based.config.1.address": config.ALLOWED_SYSTEM_USER_CIDR,
"-Cauth.host_based.config.99.method": "password",
"-Cpath.data": ",".join(
f"/data/data{i}" for i in range(node_spec["resources"]["disk"]["count"])
Expand Down
2 changes: 2 additions & 0 deletions crate/operator/handlers/handle_update_cratedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ async def update_cratedb(
do_restart = True
elif field_path == ("spec", "nodes", "master", "replicas"):
do_scale = True
elif field_path == ("spec", "allowedSystemUserCIDR"):
do_restart = True
elif field_path == ("spec", "nodes", "data"):
for node_spec_idx in range(len(old_spec)):
old_spec = old_spec[node_spec_idx]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ spec:
items:
type: string
type: array
allowedSystemUserCIDR:
Copy link
Contributor

@SStorm SStorm Jan 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need this, if the setting is coming from the environment (config.ALLOWED_SYSTEM_USER_CIDR) - we don't need to be able to override it for individual CrateDBs?

description: Limit system User to specific subnet
type: string
externalDNS:
description: The external DNS name record that should point to
the CrateDB cluster.
Expand Down
Loading