How to use the elasticsearch.password function in elasticsearch

To help you get started, we’ve selected a few elasticsearch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github elastic / kibana / src / server / lib / load_settings_from_yaml.js View on Github external
module.exports = function (path) {
  var config = yaml.safeLoad(fs.readFileSync(path, 'utf8'));
  var settings = {};
  if (config.port) settings['kibana.server.port'] = config.port;
  if (config.host) settings['kibana.server.host'] = config.host;
  if (config.elasticsearch_url) settings['elasticsearch.url'] = config.elasticsearch_url;
  if (config.elasticsearch_preserve_host) settings['elasticsearch.preserveHost'] = config.elasticsearch_preserve_host;
  if (config.config_index) settings['config.index'] = config.config_index;
  if (config.config_elasticsearch_username) settings['elasticsearch.username'] = config.config_elasticsearch_username;
  if (config.config_elasticsearch_password) settings['elasticsearch.password'] = config.config_elasticsearch_password;
  if (config.config_elasticsearch_client_crt) settings['elasticsearch.ssl.cert'] = config.config_elasticsearch_client_crt;
  if (config.config_elasticsearch_client_key) settings['elasticsearch.ssl.key'] = config.config_elasticsearch_client_key;
  if (config.ca) settings['elasticsearch.ssl.ca'] = config.ca;
  if (config.verify_ssl) settings['elasticsearch.ssl.verify'] = config.verify_ssl;
  if (config.default_app_id) settings['kibana.defaultAppId'] = config.default_app_id;
  if (config.ping_timeout) settings['elasticsearch.pingTimeout'] = config.ping_timeout;
  if (config.request_timeout) settings['elasticsearch.requestTimeout'] = config.request_timeout;
  if (config.shard_timeout) settings['elasticsearch.shardTimeout'] = config.shard_timeout;
  if (config.startup_timeout) settings['elasticsearch.startupTimeout'] = config.startup_timeout;
  if (config.ssl_cert_file) settings['kibana.server.ssl.cert'] = config.ssl_cert_file;
  if (config.ssl_key_file) settings['kibana.server.ssl.key'] = config.ssl_key_file;
  if (config.pid_file) settings['config.server.pidFile'] = config.pid_file;
  if (config.log_file) settings['logging.file'] = config.log_file;
  if (config.bundled_plugin_ids) settings['kibana.bundledPluginIds'] = config.bundled_plugin_ids;
  return settings;
};
github elastic / kibana / x-pack / legacy / plugins / apm / scripts / kibana-security / setup-custom-kibana-user-role.ts View on Github external
import path from 'path';
import { argv } from 'yargs';

const config = yaml.safeLoad(
  fs.readFileSync(
    path.join(__filename, '../../../../../../../config/kibana.dev.yml'),
    'utf8'
  )
);

const KIBANA_INDEX = config['kibana.index'] as string;
const TASK_MANAGER_INDEX = config['xpack.task_manager.index'] as string;
const KIBANA_ROLE_SUFFIX = argv.roleSuffix as string;
const ELASTICSEARCH_USERNAME = (argv.username as string) || 'elastic';
const ELASTICSEARCH_PASSWORD = (argv.password ||
  config['elasticsearch.password']) as string;
const KIBANA_BASE_URL = (argv.kibanaUrl as string) || 'http://localhost:5601';

interface User {
  username: string;
  roles: string[];
  full_name?: string;
  email?: string;
  enabled?: boolean;
}

const getKibanaBasePath = once(async () => {
  try {
    await axios.request({ url: KIBANA_BASE_URL, maxRedirects: 0 });
  } catch (e) {
    if (isAxiosError(e)) {
      const location = e.response?.headers?.location;