Elasticsearch 1.7.3和Docker上的盾牌

时间:2015-12-06 17:25:53

标签: security elasticsearch

当我尝试保护我的elasticsearch集群时遇到了一个问题(仅尝试使用1个节点)。它是在docker上的ES节点,当我试图安装shield并添加一个用户时它一直给我

Error: Could not find or load main class org.elasticsearch.shield.authc.esusers.tool.ESUsersTool

这是dockerfile命令

USER root

ENV ES_PKG_NAME 1.7.3
    # Install Elasticsearch.
    RUN \
      cd / && \
      wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-$ES_PKG_NAME.tar.gz && \
      tar xvzf elasticsearch-$ES_PKG_NAME.tar.gz && \
      rm -f elasticsearch-$ES_PKG_NAME.tar.gz && \
      mv /elasticsearch-$ES_PKG_NAME /elasticsearch 

    # Mount elasticsearch.yml config
    ADD config/elasticsearch.yml /elasticsearch/config/elasticsearch.yml

    ENV ES_JAVA_OPTS "-Des.path.conf=/elasticsearch -Des.default.path.logs=/elasticsearch/logs"


    RUN /elasticsearch/bin/plugin -install royrusso/elasticsearch-HQ && \
        /elasticsearch/bin/plugin -install elasticsearch/license/latest && \
        /elasticsearch/bin/plugin -install elasticsearch/shield/latest

    RUN ln -s /elasticsearch/config/shield /elasticsearch/shield
    RUN chmod +x /elasticsearch/bin/shield/*
    ENV PATH /elasticsearch/bin/shield:$PATH 
    RUN esusers useradd es_user -r admin -p pass

    # Define mountable directories.
    VOLUME ["/data"]


    # Define working directory.
    WORKDIR /data

    # Define default command.
    CMD ["/elasticsearch/bin/elasticsearch"]

    # Expose ports.
    #   - 9200: HTTP
    #   - 9300: transport
    EXPOSE 9200
    EXPOSE 9300

提前谢谢!

1 个答案:

答案 0 :(得分:1)

我认为您的Dockerfile正在屏蔽此错误:

$ /usr/share/elasticsearch/bin/shield/esusers useradd es_admin -r admin -p pass
ERROR: Invalid password...passwords must be at least [6] characters long

尝试将密码设置为超过pass