HEX
Server: nginx/1.24.0
System: Linux nowruzgan 6.8.0-57-generic #59-Ubuntu SMP PREEMPT_DYNAMIC Sat Mar 15 17:40:59 UTC 2025 x86_64
User: babak (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: //usr/share/opensearch-dashboards/node_modules/@opensearch-project/opensearch-next/lib/tools.js
/*
 * Copyright OpenSearch Contributors
 * SPDX-License-Identifier: Apache-2.0
 *
 * The OpenSearch Contributors require contributions made to
 * this file be licensed under the Apache-2.0 license or a
 * compatible open source license.
 *
 */

function strongPasswordRequired(os_version = process.env.OPENSEARCH_VERSION) {
  // OpenSearch 2.12.X and later require strong passwords
  if (os_version === undefined)
    throw new Error('OPENSEARCH_VERSION environment variable is not set');
  if (os_version === 'latest') return true;
  const [major, minor] = os_version.split('.');
  if (parseInt(major) > 2) return true;
  return major === '2' && (minor === 'x' || parseInt(minor) >= 12);
}

module.exports = { strongPasswordRequired };