Skip to content

Commit 029b4ea

Browse files
authored
Merge pull request ceph#57535 from rkachach/fix_issue_66095
Adding support for ceph mgmt-gateway Reviewed-by: Adam King <[email protected]> Reviewed-by: Anthony D'Atri <[email protected]>
2 parents f4b0bb1 + 11aaee1 commit 029b4ea

File tree

24 files changed

+1226
-99
lines changed

24 files changed

+1226
-99
lines changed

doc/cephadm/services/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ for details on individual services:
2020
snmp-gateway
2121
tracing
2222
smb
23+
mgmt-gateway
2324

2425
Service Status
2526
==============
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
.. _deploy-cephadm-mgmt-gateway:
2+
3+
==================
4+
Management Gateway
5+
==================
6+
7+
Deploying mgmt-gateway
8+
======================
9+
10+
In Ceph releases beginning with Squid, the `mgmt-gateway` service introduces a new design for Ceph applications
11+
based on a modular, service-based architecture. This service, managed by cephadm and built on top of nginx
12+
(an open-source, high-performance web server), acts as the new front-end and single entry point to the
13+
Ceph cluster. The `mgmt-gateway` provides unified access to all Ceph applications, including the Ceph dashboard
14+
and monitoring stack. Employing nginx enhances security and simplifies access management due to its robust
15+
community support and high-security standards. The `mgmt-gateway` service acts as a reverse proxy that routes
16+
requests to the appropriate Ceph application instances.
17+
18+
In order to deploy the mgmt-gateway service, use the following command:
19+
20+
.. prompt:: bash #
21+
22+
ceph orch apply mgmt-gateway [--placement ...] ...
23+
24+
Once applied cephadm will reconfigure specific running daemons (such as monitoring) to run behind the
25+
new created service. External access to those services will not be possible anymore. Access will be
26+
consolidated behind the new service endpoint: `https://<node-ip>:<port>`.
27+
28+
29+
Benefits of the mgmt-gateway service
30+
====================================
31+
* ``Unified Access``: Consolidated access through nginx improves security and provide a single entry point to services.
32+
* ``Improved user experience``: User no longer need to know where each application is running (ip/host).
33+
* ``High Availability for dashboard``: nginx HA mechanisms are used to provide high availability for the Ceph dashboard.
34+
* ``High Availability for monitoring``: nginx HA mechanisms are used to provide high availability for monitoring.
35+
36+
Security enhancements
37+
=====================
38+
39+
Once the `mgmt-gateway` service is deployed user cannot access monitoring services without authentication through the
40+
Ceph dashboard.
41+
42+
43+
High availability enhancements
44+
==============================
45+
nginx HA mechanisms are used to provide high availability for all the Ceph management applications including the Ceph dashboard
46+
and monitoring stack. In case of the Ceph dashboard user no longer need to know where the active manager is running.
47+
`mgmt-gateway` handles manager failover transparently and redirects the user to the active manager. In case of the
48+
monitoring `mgmt-gateway` takes care of handling HA when several instances of Prometheus, Alertmanager or Grafana are
49+
available. The reverse proxy will automatically detect healthy instances and use them to process user requests.
50+
51+
52+
Accessing services with mgmt-gateway
53+
====================================
54+
55+
Once the `mgmt-gateway` service is deployed direct access to the monitoring services will not be allowed anymore.
56+
Applications including: Prometheus, Grafana and Alertmanager are now accessible through links
57+
from `Administration > Services`.
58+
59+
60+
Service Specification
61+
=====================
62+
63+
A mgmt-gateway service can be applied using a specification. An example in YAML follows:
64+
65+
.. code-block:: yaml
66+
67+
service_type: mgmt-gateway
68+
service_id: gateway
69+
placement:
70+
hosts:
71+
- ceph0
72+
spec:
73+
port: 5000
74+
ssl_protocols:
75+
- TLSv1.2
76+
- TLSv1.3
77+
- ...
78+
ssl_ciphers:
79+
- AES128-SHA
80+
- AES256-SHA
81+
- ...
82+
ssl_certificate: |
83+
-----BEGIN CERTIFICATE-----
84+
MIIDtTCCAp2gAwIBAgIYMC4xNzc1NDQxNjEzMzc2MjMyXzxvQ7EcMA0GCSqGSIb3
85+
DQEBCwUAMG0xCzAJBgNVBAYTAlVTMQ0wCwYDVQQIDARVdGFoMRcwFQYDVQQHDA5T
86+
[...]
87+
-----END CERTIFICATE-----
88+
ssl_certificate_key: |
89+
-----BEGIN PRIVATE KEY-----
90+
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC5jdYbjtNTAKW4
91+
/CwQr/7wOiLGzVxChn3mmCIF3DwbL/qvTFTX2d8bDf6LjGwLYloXHscRfxszX/4h
92+
[...]
93+
-----END PRIVATE KEY-----
94+
95+
Fields specific to the ``spec`` section of the mgmt-gateway service are described below.
96+
97+
.. py:currentmodule:: ceph.deployment.service_spec
98+
99+
.. autoclass:: MgmtGatewaySpec
100+
:members:
101+
102+
.. warning::
103+
104+
TLSv1.3 is considered safe at this moment and includes a set of secure ciphers by default.
105+
When configuring SSL/TLS ciphers for older versions, especially TLSv1.2, it is crucial to
106+
use only a subset of secure ciphers. Using weak or outdated ciphers can significantly
107+
compromise the security of your system.
108+
109+
Any alteration of the cipher list for SSL/TLS configurations is the responsibility of the
110+
system administrator. Avoid modifying these lists without a thorough understanding of the
111+
implications. Incorrect configurations can lead to vulnerabilities such as weak encryption,
112+
lack of forward secrecy, and susceptibility to various attacks. Always refer to up-to-date
113+
security guidelines and best practices when configuring SSL/TLS settings.
114+
115+
116+
The specification can then be applied by running the following command:
117+
118+
.. prompt:: bash #
119+
120+
ceph orch apply -i mgmt-gateway.yaml
121+
122+
123+
Limitations
124+
===========
125+
126+
A non-exhaustive list of important limitations for the mgmt-gateway service follows:
127+
128+
* High-availability configurations and clustering for the mgmt-gateway service itself are currently not supported.
129+
* Services must bind to the appropriate ports based on the applications being proxied. Ensure that there
130+
are no port conflicts that might disrupt service availability.
131+
132+
133+
Default images
134+
~~~~~~~~~~~~~~
135+
136+
The `mgmt-gateway` service internally makes use of nginx reverse proxy. The following container image is used by default:
137+
138+
::
139+
140+
DEFAULT_NGINX_IMAGE = 'quay.io/ceph/nginx:1.26.1'
141+
142+
Admins can specify the image to be used by changing the `container_image_nginx` cephadm module option. If there were already
143+
running daemon(s) you must redeploy the daemon(s) in order to have them actually use the new image.
144+
145+
For example:
146+
147+
.. code-block:: bash
148+
149+
ceph config set mgr mgr/cephadm/container_image_nginx <new-nginx-image>
150+
ceph orch redeploy mgmt-gateway

src/cephadm/cephadm.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@
176176
NFSGanesha,
177177
SMB,
178178
SNMPGateway,
179+
MgmtGateway,
179180
Tracing,
180181
NodeProxy,
181182
)
@@ -227,6 +228,7 @@ def get_supported_daemons():
227228
supported_daemons.append(Keepalived.daemon_type)
228229
supported_daemons.append(CephadmAgent.daemon_type)
229230
supported_daemons.append(SNMPGateway.daemon_type)
231+
supported_daemons.append(MgmtGateway.daemon_type)
230232
supported_daemons.extend(Tracing.components)
231233
supported_daemons.append(NodeProxy.daemon_type)
232234
supported_daemons.append(SMB.daemon_type)
@@ -463,6 +465,8 @@ def update_default_image(ctx: CephadmContext) -> None:
463465
ctx.image = Keepalived.default_image
464466
if type_ == SNMPGateway.daemon_type:
465467
ctx.image = SNMPGateway.default_image
468+
if type_ == MgmtGateway.daemon_type:
469+
ctx.image = MgmtGateway.default_image
466470
if type_ == CephNvmeof.daemon_type:
467471
ctx.image = CephNvmeof.default_image
468472
if type_ in Tracing.components:
@@ -855,6 +859,10 @@ def create_daemon_dirs(
855859
sg = SNMPGateway.init(ctx, fsid, ident.daemon_id)
856860
sg.create_daemon_conf()
857861

862+
elif daemon_type == MgmtGateway.daemon_type:
863+
cg = MgmtGateway.init(ctx, fsid, ident.daemon_id)
864+
cg.create_daemon_dirs(data_dir, uid, gid)
865+
858866
elif daemon_type == NodeProxy.daemon_type:
859867
node_proxy = NodeProxy.init(ctx, fsid, ident.daemon_id)
860868
node_proxy.create_daemon_dirs(data_dir, uid, gid)
@@ -3571,6 +3579,9 @@ def list_daemons(
35713579
elif daemon_type == SNMPGateway.daemon_type:
35723580
version = SNMPGateway.get_version(ctx, fsid, daemon_id)
35733581
seen_versions[image_id] = version
3582+
elif daemon_type == MgmtGateway.daemon_type:
3583+
version = MgmtGateway.get_version(ctx, container_id)
3584+
seen_versions[image_id] = version
35743585
else:
35753586
logger.warning('version for unknown daemon type %s' % daemon_type)
35763587
else:

src/cephadm/cephadmlib/constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
DEFAULT_JAEGER_AGENT_IMAGE = 'quay.io/jaegertracing/jaeger-agent:1.29'
2020
DEFAULT_JAEGER_QUERY_IMAGE = 'quay.io/jaegertracing/jaeger-query:1.29'
2121
DEFAULT_SMB_IMAGE = 'quay.io/samba.org/samba-server:devbuilds-centos-amd64'
22+
DEFAULT_NGINX_IMAGE = 'quay.io/ceph/nginx:1.26.1'
2223
DEFAULT_REGISTRY = 'docker.io' # normalize unqualified digests to this
2324
# ------------------------------------------------------------------------------
2425

@@ -49,3 +50,5 @@
4950
DATEFMT = '%Y-%m-%dT%H:%M:%S.%fZ'
5051
QUIET_LOG_LEVEL = 9 # DEBUG is 10, so using 9 to be lower level than DEBUG
5152
NO_DEPRECATED = False
53+
UID_NOBODY = 65534
54+
GID_NOGROUP = 65534

src/cephadm/cephadmlib/daemons/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from .snmp import SNMPGateway
1010
from .tracing import Tracing
1111
from .node_proxy import NodeProxy
12+
from .mgmt_gateway import MgmtGateway
1213

1314
__all__ = [
1415
'Ceph',
@@ -25,4 +26,5 @@
2526
'SNMPGateway',
2627
'Tracing',
2728
'NodeProxy',
29+
'MgmtGateway',
2830
]

src/cephadm/cephadmlib/daemons/custom.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from ..deployment_utils import to_deployment_container
1616
from ..file_utils import write_new, makedirs
1717
from ..net_utils import EndPoint
18+
from ..constants import UID_NOBODY, GID_NOGROUP
1819

1920

2021
logger = logging.getLogger()
@@ -43,8 +44,8 @@ def __init__(
4344

4445
# config-json options
4546
self.entrypoint = dict_get(config_json, 'entrypoint')
46-
self.uid = dict_get(config_json, 'uid', 65534) # nobody
47-
self.gid = dict_get(config_json, 'gid', 65534) # nobody
47+
self.uid = dict_get(config_json, 'uid', UID_NOBODY)
48+
self.gid = dict_get(config_json, 'gid', GID_NOGROUP)
4849
self.volume_mounts = dict_get(config_json, 'volume_mounts', {})
4950
self.args = dict_get(config_json, 'args', [])
5051
self.envs = dict_get(config_json, 'envs', [])

0 commit comments

Comments
 (0)