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

SSL | Secure service for Noobaa metric #8673

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

naveenpaul1
Copy link
Contributor

Explain the changes

  1. add secure port for promethus service
  2. control prometesu http and https service creation with flags. non-secure service creation can be prevented using flag (ALLOW_HTTP_METRICS) in NC NSFS deployment only, and secure prometheus service will start only if ALLOW_HTTPS_METRICS flag is enabled for all the deployents.
  3. Same S3 ssl certs are used by metrics server
  4. Metrics https_port added in CLI and config for flexibility.

Issues: Fixed #xxx / Gap #xxx

  1. nsfs metrics from metrics port 7004 are only implemented over http. This should be changed to https as default.  #8198

Testing Instructions:

  1. start nsfs application
  2. verify metrics server is started by hitting url https://localhost:9443/
  3. try the same with valid local certificate, steps can be found in doc
  • Doc added/updated
  • Tests added

Signed-off-by: naveenpaul1 <napaul@redhat.com>
@@ -907,6 +909,8 @@ config.ENDPOINT_SSL_PORT = Number(process.env.ENDPOINT_SSL_PORT) || 6443;
config.ENDPOINT_SSL_STS_PORT = Number(process.env.ENDPOINT_SSL_STS_PORT) || (process.env.NC_NSFS_NO_DB_ENV === 'true' ? -1 : 7443);
config.ENDPOINT_SSL_IAM_PORT = Number(process.env.ENDPOINT_SSL_IAM_PORT) || -1;
config.ALLOW_HTTP = false;
config.ALLOW_HTTPS_METRICS = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

why false by default?

--https_port <port> (default 6443) Set the S3 endpoint listening HTTPS port to serve.
--https_port_sts <port> (default -1) Set the S3 endpoint listening HTTPS port for STS.
--https_port_iam <port> (default -1) Set the endpoint listening HTTPS port for IAM.
--metrics_port <port> (default -1) Set the metrics listening port for prometheus.
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. indentation of
  2. Add HTTP so it'll be clear like we have in the S3 HTTP port

--https_port_sts <port> (default -1) Set the S3 endpoint listening HTTPS port for STS.
--https_port_iam <port> (default -1) Set the endpoint listening HTTPS port for IAM.
--metrics_port <port> (default -1) Set the metrics listening port for prometheus.
--metrics_https_port <port> (default -1) Set the metrics listening https port for prometheus.
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. make sure HTTPS is capital letters like the other HTTPS usage
  2. why default is -1?

@@ -586,6 +586,7 @@ config.MIN_MEMORY_FOR_UPGRADE = 1200 * 1024 * 1024;
config.SEND_EVENTS_REMOTESYS = true;
config.PROMETHEUS_ENABLED = true;
config.PROMETHEUS_SERVER_RETRY_COUNT = Infinity;
config.PROMETHEUS_SSL_SERVER_RETRY_COUNT = Infinity;
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need another one?

@@ -46,7 +46,8 @@ const certs = {
S3: new CertInfo(config.S3_SERVICE_CERT_PATH),
EXTERNAL_DB: new CertInfo(config.EXTERNAL_DB_SERVICE_CERT_PATH),
STS: new CertInfo(config.STS_SERVICE_CERT_PATH),
IAM: new CertInfo(config.IAM_SERVICE_CERT_PATH)
IAM: new CertInfo(config.IAM_SERVICE_CERT_PATH),
METRICS: new CertInfo(config.S3_SERVICE_CERT_PATH) // metric server will use the S3 cert.
Copy link
Contributor

Choose a reason for hiding this comment

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

I know you have been told in the design meeting to use the S3 cert but I know @Neon-White had some work on changing STS cert to not re-use the S3 cert due to an issue mentioned in #8123
so per what Ben wrote, we might have an issue with this re-use on containerized env, Ben WDYT?
CC: @nimrod-becker

Copy link
Contributor

Choose a reason for hiding this comment

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

on the other hand, on non containerized - we currently have the certificates under certificates/ dir, and adding a new certificate will require some changes in the code/structure for allowing different certificates for different services.

Copy link
Contributor

@Neon-White Neon-White Jan 14, 2025

Choose a reason for hiding this comment

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

Good catch, @romayalon - indeed, if the metrics have their own endpoint (such as metrics.openshift-cluster.com:4123), certificates cannot be reused between different endpoints.

If the metrics will be under the S3 endpoint but will only utilize a different port, reusing the certificate should be fine

Copy link
Contributor

Choose a reason for hiding this comment

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

@Neon-White thanks Ben, I think you refer to the service k8s object, right? if so I think they are sharing it (service-s3.yaml)

Copy link
Contributor

@Neon-White Neon-White Jan 14, 2025

Choose a reason for hiding this comment

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

@romayalon Sure thing :) yep, I'm referring to the service. If the metrics are accessed via the same URL that serves S3 actions (for example s3.cluster-address.com:someport) then the reuse is okay.
The problem with the reuse happened because the certificate was meant for the s3 host, but sts is different. If the only difference is the port, there's no need for another certificate (since the host is the same).

Copy link
Contributor

Choose a reason for hiding this comment

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

yep, thanks Ben! so I looks like we can re-use the S3-cert, but this must be documented

Comment on lines 31 to +34
* @param {number?} metrics_port prometheus metris port.
* @param {number?} metrics_ssl_port prometheus metris https port.
* @param {number?} count number of workers to start.
* @param {string?} nsfs_config_root nsfs configuration path
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* @param {number?} metrics_port prometheus metris port.
* @param {number?} metrics_ssl_port prometheus metris https port.
* @param {number?} count number of workers to start.
* @param {string?} nsfs_config_root nsfs configuration path
* @param {number} [metrics_port]
* @param {number} [metrics_ssl_port]
* @param {number} [count] number of workers to start.
* @param {string} [nsfs_config_root] nsfs configuration path

while (retry_https_count) {
try {
if (ssl_port > 0 && config.ALLOW_HTTPS_METRICS) {
const ssl_cert_info = await ssl_utils.get_ssl_cert_info('METRICS', nsfs_config_root);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we re-use start_server_and_cert() like the other services?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants